:root {
  --room: #1d130d;
  --cream: #f3e3c3;
  --orange: #e2772b;
  --mustard: #d9a52e;
  --wood-2: #5a2f17;
  --wood-3: #3c1e0e;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
[hidden] { display: none !important; }

body {
  min-height: 100vh;
  background:
    radial-gradient(ellipse 90% 50% at 50% 12%, #4a2c18 0%, transparent 70%),
    var(--room);
  color: var(--cream);
  font-family: Georgia, 'Times New Roman', serif;
  -webkit-tap-highlight-color: transparent;
}
body.playing { overflow: hidden; }

.wall {
  max-width: 1160px;
  margin: 0 auto;
  padding: 26px max(16px, env(safe-area-inset-right)) 40px max(16px, env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  align-items: center;
}

.masthead { text-align: center; margin-bottom: 24px; }
.masthead h1 {
  margin: 0;
  font: 400 clamp(38px, 11vw, 60px)/1 'Righteous', 'Cooper Black', Georgia, serif;
  letter-spacing: .02em;
  text-shadow: 3px 3px 0 var(--orange), 6px 6px 0 #8f3d1c;
}
.masthead p { margin: 16px 0 0; font-size: 17px; font-style: italic; opacity: .85; }

/* ---------- tiles ---------- */

.tiles {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 18px;
}

.tile {
  display: flex;
  flex-direction: column;
  height: 100%;
  border-radius: 16px;
  overflow: hidden;
  background: linear-gradient(180deg, var(--wood-2), var(--wood-3));
  color: inherit;
  text-decoration: none;
  box-shadow: inset 0 1px 0 rgba(255, 220, 180, .22), 0 6px 18px rgba(0, 0, 0, .55);
  transition: transform .15s ease;
}
.tile:active { transform: scale(.985); }
.tile:focus-visible { outline: 3px solid var(--mustard); outline-offset: 3px; }
@media (hover: hover) { .tile:hover { transform: translateY(-3px); } }

.tile .pic {
  position: relative;
  aspect-ratio: 16 / 10;
  margin: 8px 8px 0;
  border-radius: 10px;
  overflow: hidden;
  background: #120b07;
}
.tile .pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile .pic.plain {
  display: grid;
  place-items: center;
  padding: 14px;
  text-align: center;
  color: #fff8f0;
  font: 400 clamp(26px, 8vw, 34px)/1.05 'Righteous', Georgia, serif;
  text-shadow: 0 2px 0 rgba(0, 0, 0, .25);
}
.tile .pic.plain::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 40% at 30% 18%, rgba(255, 255, 255, .38), transparent 70%),
    radial-gradient(ellipse 80% 60% at 70% 110%, rgba(0, 0, 0, .35), transparent 70%);
  pointer-events: none;
}
.tile .pic.plain span { position: relative; z-index: 1; }

.tile .words {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px 16px;
  flex: 1;
}
.tile .text { flex: 1; min-width: 0; }
.tile h2 { margin: 0; font: 400 21px/1.15 'Righteous', Georgia, serif; letter-spacing: .01em; }
.tile p { margin: 5px 0 0; font-size: 15px; line-height: 1.35; opacity: .82; }
.tile .note { color: var(--mustard); font-style: italic; opacity: 1; }
.tile .go {
  flex: none;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(180deg, #ea8a3c, #c2591b);
  color: #1d0f05;
  font-size: 18px;
  padding-left: 3px;
  box-shadow: inset 0 1px 0 rgba(255, 220, 180, .35), 0 2px 6px rgba(0, 0, 0, .5);
}

.empty { text-align: center; font-style: italic; opacity: .8; }

.tv-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin-top: 30px;
  padding: 0 22px;
  border-radius: 8px;
  background: linear-gradient(180deg, #4a2c18, #2c190d);
  color: var(--cream);
  font: 400 15px/1 'Righteous', Georgia, serif;
  letter-spacing: .08em;
  text-decoration: none;
  box-shadow: inset 0 1px 0 rgba(255, 220, 180, .25), 0 2px 6px rgba(0, 0, 0, .5);
}
.tv-link:focus-visible { outline: 3px solid var(--mustard); outline-offset: 2px; }

footer { margin-top: 26px; font-size: 13px; opacity: .55; }

/* ---------- a piece, full screen ---------- */

.player {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  background: #0d0806;
}
.player-bar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: max(6px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) 6px max(8px, env(safe-area-inset-left));
  background: linear-gradient(180deg, #33200f, #22140a);
  box-shadow: 0 1px 0 rgba(255, 220, 180, .12);
}
.player-bar button {
  flex: none;
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(180deg, #ea8a3c, #c2591b);
  color: #1d0f05;
  font: 400 15px/1 'Righteous', Georgia, serif;
  letter-spacing: .06em;
  cursor: pointer;
}
.player-bar #playerShare { background: linear-gradient(180deg, #4a2c18, #2c190d); color: var(--cream); }
.player-bar button:focus-visible { outline: 3px solid var(--mustard); outline-offset: 2px; }
.player-bar span {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
  font: 400 16px/1 'Righteous', Georgia, serif;
}
.player-stage { position: relative; flex: 1; min-height: 0; }
.player-stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #fff; }
.player-loading { position: absolute; inset: 0; margin: 0; display: grid; place-items: center; font-style: italic; z-index: 1; color: #3c1e0e; pointer-events: none; }

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