/* The table in a browser, on one of our own books: the hand's dress from the guest page (/t), with a header that names
   the book and a sheet for sharing the table. BRAND: the die low at the thumb in a pocket of light, the written line
   above it, the newest ruling nearest the die; reading before performing; never red. */
:root {
  --floor: #0E111B; --wall: #1A2130; --lantern: #F2B33D; --circle: #5DE0F0; --bone: #EDE6D6;
  --ember: #E2543B; --moss: #8FD18C; --hot: #FFE7B0;
  --serif: ui-serif, "New York", "Iowan Old Style", "Noto Serif", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, "Roboto Mono", monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--floor); color: var(--bone); font-family: var(--sans); }
body { display: flex; flex-direction: column; overflow: hidden; }
button, input { font: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--lantern); outline-offset: 4px; border-radius: 6px; }

.room { position: fixed; inset: 0; pointer-events: none; background: radial-gradient(ellipse at 50% 100%, rgba(0,0,0,0) 55%, rgba(0,0,0,.5) 100%); }
.pocket { position: fixed; left: 50%; bottom: 36px; width: 300px; height: 300px; margin-left: -150px; margin-bottom: -150px; border-radius: 50%; pointer-events: none;
  transition: opacity .6s ease, transform .6s ease; background: radial-gradient(circle, rgba(242,179,61,.36) 0%, rgba(242,179,61,.12) 50%, rgba(242,179,61,0) 70%); }
.pocket.cold { background: radial-gradient(circle, rgba(93,224,240,.26) 0%, rgba(93,224,240,.08) 50%, rgba(93,224,240,0) 70%); }
.pocket.ember { background: radial-gradient(circle, rgba(226,84,59,.28) 0%, rgba(226,84,59,.09) 50%, rgba(226,84,59,0) 70%); }
.pocket.dark { opacity: .25; }

header { position: relative; z-index: 2; padding: calc(14px + env(safe-area-inset-top)) 20px 10px; display: flex; flex-direction: column; gap: 10px; }
.logo { display: flex; align-items: center; gap: 7px; color: rgba(237,230,214,.55); font-family: var(--serif); font-weight: 500; font-size: 17px; letter-spacing: -.015em; text-decoration: none; width: max-content; }
.logo svg { width: 16px; height: 16px; }
.game { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.game .name { font-family: var(--serif); font-weight: 500; font-size: 22px; color: rgba(237,230,214,.9); }
.stamp { font-family: var(--mono); font-size: 10px; font-weight: 600; letter-spacing: .15em; text-transform: uppercase; color: var(--circle); margin: 0; }
.stamp.dim { color: rgba(237,230,214,.45); }
.game .pdf { margin-left: auto; font-size: 13px; color: rgba(237,230,214,.6); text-decoration: underline; text-decoration-color: rgba(237,230,214,.3); text-underline-offset: 3px; padding: 6px 0; }

main { position: relative; z-index: 1; flex: 1; overflow-y: auto; padding: 8px 16px 24px; display: flex; flex-direction: column; justify-content: flex-end; gap: 12px; }
main::-webkit-scrollbar { display: none; }
.slab { position: relative; background: rgba(26,33,48,.92); border: 1px solid rgba(237,230,214,.07); border-radius: 16px; padding: 14px 16px 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,.35); transition: opacity .5s ease, transform .5s ease; }
.slab.older { opacity: .45; transform: scale(.985); }
.slab.oldest { opacity: .2; transform: scale(.97); }
.slab .q { font-family: var(--mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: rgba(237,230,214,.45); margin: 0 0 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slab .verdict { font-family: var(--serif); font-weight: 600; font-size: 24px; color: var(--lantern); margin: 0 0 2px; }
.slab .ruling { font-family: var(--serif); font-weight: 600; font-size: 21px; line-height: 1.3; color: var(--bone); margin: 0; }
.slab .ruling.silent { color: rgba(237,230,214,.8); }
.slab.trouble { border-color: rgba(237,230,214,.14); }
.slab .ruling .lead { color: rgba(237,230,214,.55); }
.slab .body { margin: 10px 0 0; padding-left: 12px; border-left: 2px solid rgba(237,230,214,.25); font-size: 15px; line-height: 1.45; color: rgba(237,230,214,.6); }
.slab .body.quiet { border-left-color: rgba(242,179,61,.35); color: rgba(237,230,214,.55); font-size: 14px; }
.slab .again { margin-top: 12px; height: 44px; padding: 0 18px; border-radius: 999px; border: 1px solid rgba(242,179,61,.55); background: none; color: var(--lantern); font-weight: 600; font-size: 15px; cursor: pointer; }
.slab .quote { margin: 12px 0 0; padding-left: 12px; border-left: 2px solid var(--lantern); font-family: var(--serif); font-style: italic; font-size: 16px; line-height: 1.4; color: rgba(237,230,214,.85); }
.slab .source { margin: 8px 0 0; font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--lantern); }
.slab .source.unverified { color: var(--ember); }
.slab.fresh { animation: rise .5s cubic-bezier(.2,.9,.3,1.1); }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.word { font-family: var(--serif); font-size: 20px; line-height: 1.35; color: var(--bone); margin: 0; text-align: center; padding: 0 12px; text-wrap: balance; }
.word .dim { color: rgba(237,230,214,.55); }

footer { position: relative; z-index: 2; padding: 0 16px calc(14px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; align-items: center; gap: 2px; }
.line { min-height: 48px; width: 100%; display: flex; align-items: flex-end; justify-content: center; text-align: center; padding: 0 8px 4px;
  font-family: var(--serif); font-size: 20px; line-height: 1.3; color: var(--bone); }
.line .hint { color: rgba(237,230,214,.5); font-family: var(--sans); font-size: 14px; }
.line .listening { color: var(--circle); }
.line .mono { font-family: var(--mono); font-size: 10px; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: rgba(237,230,214,.6); }
.line .mono.warm { color: var(--lantern); }
.die { width: 166px; height: 201px; touch-action: none; user-select: none; -webkit-user-select: none; cursor: pointer; position: relative; }
.die canvas { width: 100%; height: 100%; display: block; }
.die .fallback { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; }
.die .fallback svg { width: 124px; height: 124px; }
.die.nolive .fallback { display: flex; }
.type { display: flex; gap: 8px; width: 100%; max-width: 440px; margin-top: 8px; }
.type input { flex: 1; min-width: 0; background: rgba(26,33,48,.95); border: 1px solid rgba(237,230,214,.12); border-radius: 999px; padding: 12px 16px; color: var(--bone); outline: none; }
.type input:focus { border-color: rgba(93,224,240,.5); }
.type button { background: var(--lantern); color: var(--floor); border: 0; border-radius: 999px; padding: 0 18px; font-weight: 600; }
.type button:disabled { opacity: .5; }
.links { display: flex; gap: 6px; }
.link { background: none; border: 0; color: rgba(93,224,240,.85); font-size: 14px; padding: 8px 12px; cursor: pointer; }
.link:disabled { opacity: .5; }
.hidden { display: none !important; }
.about { font-size: 11px; color: rgba(237,230,214,.35); text-align: center; margin: 6px 0 0; padding: 0 12px; }
.about a { color: inherit; }

/* the sheet: this table's code and link */
.sheet { position: fixed; inset: 0; z-index: 6; display: flex; align-items: flex-end; justify-content: center; background: rgba(14,17,27,.72); padding: 16px; }
.sheet .card { width: 100%; max-width: 440px; background: var(--wall); border: 1px solid rgba(237,230,214,.12); border-radius: 22px; padding: 18px 20px calc(16px + env(safe-area-inset-bottom)); box-shadow: 0 30px 40px rgba(0,0,0,.5); display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; animation: rise .4s cubic-bezier(.2,.9,.3,1.1); }
.sheet h2 { font-family: var(--serif); font-weight: 600; font-size: 24px; line-height: 1.22; margin: 0; color: var(--bone); text-wrap: balance; }
.sheet .note { margin: 0; font-size: 15px; line-height: 1.45; color: rgba(237,230,214,.6); text-wrap: pretty; }
.sheet .qr { width: 196px; height: 196px; image-rendering: pixelated; border-radius: 10px; }
.sheet .linktext { margin: 0; font-family: var(--mono); font-size: 11px; color: rgba(237,230,214,.5); word-break: break-all; user-select: all; -webkit-user-select: all; }
.sheet .row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.chip { height: 44px; padding: 0 18px; border-radius: 999px; background: none; border: 1px solid rgba(242,179,61,.55); color: var(--lantern); font-weight: 600; font-size: 15px; cursor: pointer; }

.closed { position: fixed; inset: 0; z-index: 5; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 14px; padding: 32px; text-align: center; background: var(--floor); }
.closed h1 { font-family: var(--serif); font-weight: 600; font-size: 26px; line-height: 1.25; margin: 0; color: var(--bone); max-width: 340px; text-wrap: balance; }
.closed h1 .lead { color: rgba(237,230,214,.55); }
.closed p { margin: 0; color: rgba(237,230,214,.6); max-width: 340px; line-height: 1.45; text-wrap: pretty; }
.closed .rest { width: 120px; height: 120px; display: grid; place-items: center; margin-bottom: 4px; background: radial-gradient(circle, rgba(237,230,214,.07) 0%, rgba(237,230,214,0) 60%); }
.closed .rest svg { width: 54px; height: 54px; opacity: .45; }
.closed .again { margin-top: 8px; height: 44px; padding: 0 20px; border-radius: 999px; border: 1px solid rgba(242,179,61,.55); background: none; color: var(--lantern); font-weight: 600; font-size: 15px; cursor: pointer; }
.closed .fine { margin-top: 20px; font-size: 13px; color: rgba(237,230,214,.55); }
.closed .fine a { display: inline-block; padding: 14px 6px; color: inherit; text-decoration: underline; text-decoration-color: rgba(237,230,214,.3); text-underline-offset: 3px; }

@media (min-width: 700px) { main, footer, header { width: 520px; margin-left: auto; margin-right: auto; } }
@media (prefers-reduced-motion: reduce) { .slab.fresh, .sheet .card { animation: none; } .pocket { transition: none; } }

/* signing in, on the same sheet: Apple's button as Apple draws it, our field, our words */
.sheet .card h2 + .note { margin-top: -2px; }
.sheet .apple { height: 44px; padding: 0 20px 0 16px; border-radius: 999px; border: 0; background: #fff; color: #000; display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; cursor: pointer; }
.sheet .apple svg { width: 15px; height: 18px; fill: #000; margin-top: -2px; }
.sheet .field { width: 100%; max-width: 320px; height: 48px; border-radius: 999px; padding: 0 18px; background: rgba(14,17,27,.62); border: 1px solid rgba(237,230,214,.12); color: var(--bone); font-size: 16px; outline: none; text-align: center; }
.sheet .field:focus { border-color: rgba(93,224,240,.5); }
.sheet .field[name="code"] { font-family: var(--mono); letter-spacing: .3em; font-size: 20px; }
.sheet .said { margin: 0; font-size: 14px; line-height: 1.4; color: rgba(237,230,214,.6); }
.sheet .said .lead { color: rgba(237,230,214,.85); }
.sheet form { display: flex; flex-direction: column; align-items: center; gap: 12px; width: 100%; }
.sheet [data-step] { display: flex; flex-direction: column; align-items: center; gap: 12px; width: 100%; }
