/* ============================================================
   Questing Table — "The Table Room" (virtual tabletop theme,
   Aaron's pick 2026-08-10, replacing the shelf/nook layout).
   The page is a game room: the table sits in the middle with the
   selected game laid out on it, seats wait around it, and every
   game is a saved table in the SWITCH TABLE tray below.
   Same palette and textures as before — same room, new furniture.
   ============================================================ */

:root {
  --wood-deep:  #2A1E16;
  --wood-mid:   #4A3626;
  --felt:       #1E3A2F;
  --lamplight:  #E8C87A;
  --parchment:  #D9CDB8;
  --wax-red:    #8C2F2F;

  --display: "Alegreya SC", "Bitstream Charter", Georgia, serif;
  --body:    Georgia, "Iowan Old Style", "Palatino Linotype", serif;
  --mono:    "DM Mono", "Courier New", monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  background-color: #1c1510;
  /* One ambient effect: the lamp over the table. */
  background-image:
    radial-gradient(
      110vmax 80vmax at 50% -14%,
      rgba(232, 200, 122, 0.16),
      rgba(232, 200, 122, 0.04) 40%,
      rgba(0, 0, 0, 0.42) 100%
    ),
    url("/assets/textures/wood.svg");
  background-size: auto, 480px 320px;
  background-attachment: fixed, scroll;
  color: var(--parchment);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.6;
  min-height: 100vh;
}

/* ---------- Room bar ---------- */

.roombar {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1.3rem 1rem 0.4rem;
  text-align: center;
}

.wordmark {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.5rem, 5vw, 2.1rem);
  letter-spacing: 0.04em;
  color: var(--lamplight);
  margin: 0;
  text-shadow: 0 1px 0 rgba(0,0,0,0.55), 0 2px 18px rgba(232,200,122,0.28);
}

.roomname {
  font-style: italic;
  opacity: 0.75;
  font-size: 0.95rem;
}

.open-count {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--lamplight);
  opacity: 0.9;
  border: 1px solid rgba(232,200,122,0.35);
  border-radius: 99px;
  padding: 0.25rem 0.8rem;
}
.open-count.lit { color: #7fd998; border-color: rgba(127,217,152,0.5); }

/* ---------- The table scene ---------- */

.scene {
  position: relative;
  max-width: 62rem;
  margin: 0 auto;
  padding: 1.6rem 1rem 0;
}

.table-tilt { perspective: 1100px; }

.tabletop {
  position: relative;
  /* pivot on the NEAR edge: the far edge recedes and narrows, so the
     projection never grows past the layout box (no horizontal scroll
     at any width — the top-edge pivot version overflowed) */
  transform: rotateX(30deg);
  transform-origin: 50% 100%;
  margin-top: -3%;   /* reclaim the headroom the tilt frees up */
  border-radius: 22px;
  padding: clamp(10px, 2.4vw, 22px);
  background:
    url("/assets/textures/felt.svg"),
    linear-gradient(180deg, #24473a, var(--felt) 60%, #142a1f);
  background-size: 240px 240px, auto;
  box-shadow:
    0 46px 70px rgba(0, 0, 0, 0.65),
    inset 0 0 70px rgba(0, 0, 0, 0.5),
    inset 0 0 0 8px #3a2b1c,
    inset 0 0 0 10px rgba(232, 200, 122, 0.22);
}

.table-art {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 2 / 1;
  object-fit: cover;
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.6);
  background: var(--felt);
  transition: opacity 0.28s ease;
}
.table-art.swapping { opacity: 0; }

@media (prefers-reduced-motion: reduce) {
  .table-art { transition: none; }
}

.dice-decor {
  position: absolute;
  left: 12%;
  bottom: 9%;
  display: flex;
  gap: 0.5rem;
  filter: drop-shadow(0 4px 5px rgba(0,0,0,0.55));
  pointer-events: none;
}

/* Seats waiting around the table. Purely scenic. */
.seat {
  position: absolute;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: var(--parchment);
  opacity: 0.75;
  background: rgba(16, 12, 8, 0.82);
  border: 1px solid rgba(232, 200, 122, 0.25);
  border-radius: 99px;
  padding: 0.32rem 0.8rem;
  box-shadow: 0 6px 14px rgba(0,0,0,0.5);
  white-space: nowrap;
}
.seat::before { content: "○ "; color: var(--lamplight); }

@media (max-width: 639px) {
  .seat { display: none; }   /* the small table is crowded enough */
}

/* ---------- Table talk (info console) ---------- */

.talk {
  max-width: 62rem;
  margin: 1.5rem auto 0;
  padding: 0 1rem;
  display: flex;
  gap: 1.2rem;
  align-items: stretch;
}

.talk-log {
  flex: 0 0 15rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  line-height: 2;
  color: #9a8a6a;
  font-style: italic;
  background: rgba(12, 9, 6, 0.72);
  border: 1px solid rgba(232,200,122,0.18);
  border-radius: 10px;
  padding: 0.9rem 1rem;
  overflow: hidden;
  align-self: stretch;
}
.talk-log .line { display: block; }
.talk-log .line.new { color: var(--parchment); }

.talk-info {
  flex: 1;
  min-width: 0;
  background-image:
    url("/assets/textures/wood.svg"),
    linear-gradient(180deg, #3f2f20, #2c2014);
  background-size: 480px 320px, auto;
  border: 1px solid rgba(232,200,122,0.3);
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.5), inset 0 1px 0 rgba(232,200,122,0.16);
  padding: 1.1rem 1.3rem 1.2rem;
}

.talk-info h2 {
  font-family: var(--display);
  color: var(--lamplight);
  font-size: clamp(1.25rem, 4vw, 1.6rem);
  margin: 0;
  line-height: 1.2;
  text-shadow: 0 1px 0 rgba(0,0,0,0.5);
}

.talk-info .edition {
  font-size: 0.82rem;
  font-style: italic;
  opacity: 0.75;
  margin: 0.1rem 0 0.55rem;
}

.talk-info .tagline { margin: 0 0 0.8rem; font-size: 0.95rem; }

.stats {
  font-family: var(--mono);
  font-size: 0.78rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.2rem;
  align-items: center;
  margin-bottom: 1rem;
}

.play {
  display: inline-block;
  background: linear-gradient(180deg, #a03a37, var(--wax-red) 60%, #6f2424);
  color: #F2E6D5;
  font-family: var(--display);
  font-size: 1.05rem;
  letter-spacing: 0.05em;
  text-decoration: none;
  border: 1px solid rgba(0,0,0,0.4);
  border-radius: 6px;
  padding: 0.7rem 1.9rem;
  min-height: 48px;
  min-width: 48px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.14);
}
.play:hover { filter: brightness(1.15); }

.coming {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--lamplight);
  opacity: 0.75;
  margin: 0;
}

@media (max-width: 719px) {
  .talk { flex-direction: column; }
  .talk-log { flex: none; max-height: 5.6rem; }
}

/* ---------- Status lamps ---------- */

.lamp {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--mono);
  font-size: 0.75rem;
}

.lamp::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #55483a;
  box-shadow: inset 0 0 2px rgba(0,0,0,0.6);
  flex: none;
}

.lamp.open::before {
  background: radial-gradient(circle at 35% 30%, #c85a4a, var(--wax-red) 70%);
  box-shadow: 0 0 9px 2px rgba(200,70,70,0.75);
}

.lamp.dark::before { background: #3a3129; }

/* ---------- Complexity pips ---------- */

.pips { display: inline-flex; gap: 4px; vertical-align: middle; }
.pips svg { display: block; }

/* ---------- Switch table tray ---------- */

.traywrap {
  max-width: 62rem;
  margin: 1.6rem auto 0;
  padding: 0 1rem 3rem;
}

.tray-label {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 0 0 1rem;
  font-family: var(--mono);
  font-weight: 400;
  font-size: 0.72rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--lamplight);
  opacity: 0.8;
}
.tray-label::before,
.tray-label::after {
  content: "";
  flex: 1;
  border-top: 1px solid rgba(232,200,122,0.28);
}

.tray {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(122px, 1fr));
  gap: 0.8rem;
}

.tray li { display: flex; }

.save {
  width: 100%;
  background: rgba(12, 9, 6, 0.8);
  border: 1px solid rgba(232,200,122,0.22);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  color: inherit;
  font: inherit;
  padding: 0;
  text-align: left;
  min-height: 48px;
  box-shadow: 0 6px 14px rgba(0,0,0,0.45);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.save:hover,
.save:focus-visible {
  transform: translateY(-3px);
  box-shadow: 0 10px 20px rgba(0,0,0,0.55), 0 0 16px rgba(232,200,122,0.22);
}
.save:focus-visible { outline: 2px solid var(--lamplight); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  .save { transition: none; }
  .save:hover, .save:focus-visible {
    transform: none;
    box-shadow: 0 6px 14px rgba(0,0,0,0.45), 0 0 0 2px rgba(232,200,122,0.55);
  }
}

.save .thumb {
  display: block;
  width: 100%;
  aspect-ratio: 2 / 1;
  object-fit: cover;
  background: var(--felt);
}

.save .nm {
  display: block;
  font-family: var(--body);
  font-size: 0.78rem;
  line-height: 1.3;
  padding: 0.45rem 0.6rem 0.1rem;
  color: var(--parchment);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.save .st {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  padding: 0 0.6rem 0.5rem;
  color: #9a8a6a;
}

.save.at-table {
  border-color: var(--lamplight);
  box-shadow: 0 6px 14px rgba(0,0,0,0.45), 0 0 0 1px var(--lamplight);
}
.save.at-table .st .load { color: var(--lamplight); }

.save.dev .thumb { filter: grayscale(0.5) brightness(0.8); }

/* ---------- Errors / footer ---------- */

.tray-error {
  text-align: center;
  font-family: var(--mono);
  font-size: 0.9rem;
  color: var(--lamplight);
  padding: 2rem 1rem;
}

.colophon {
  border-top: 1px solid rgba(232,200,122,0.16);
  padding: 1.3rem 1.25rem 2.2rem;
  text-align: center;
  font-size: 0.82rem;
  opacity: 0.65;
}
.colophon .fleuron {
  color: var(--lamplight);
  font-size: 1rem;
  display: block;
  margin-bottom: 0.5rem;
}
.colophon p { max-width: 40rem; margin: 0 auto; }
