/* ── Area Pages ─────────────────────────────── */
.area-page {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.area-header {
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 1.25rem;
  text-align: center;
}

/* Hero image */
.area-hero {
  margin-bottom: 1.25rem;
}

.area-hero__image {
  width: 100%;
  max-width: 680px;
  height: auto;
  display: block;
  margin: 0 auto;
  border-radius: var(--radius-lg);
}

.area-name {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  text-align: center;
}

.area-flavour {
  font-style: italic;
  color: var(--color-text-muted);
  text-align: center;
  max-width: 560px;
  margin: 0 auto;
}

.area-body {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ── NPC Section ────────────────────────────── */
.npc-section {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
}

@media (max-width: 600px) {
  .npc-section {
    flex-direction: column;
    align-items: center;
  }
  .npc-portrait { width: 100%; }
}

.npc-portrait {
  flex-shrink: 0;
  width: 220px;
}

.npc-portrait__image {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
}

@media (min-width: 600px) {
  .npc-portrait { width: 200px; }
}

.npc-content { flex: 1; }

.npc-name {
  font-size: 1.4rem;
  margin-bottom: 0;
}

.npc-species {
  color: var(--color-text-muted);
  font-style: italic;
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.npc-dialogue {
  margin-bottom: 1.25rem;
}

.dialogue-line {
  margin-bottom: 0.4rem;
  line-height: 1.6;
}

.dialogue-pause {
  color: var(--color-text-muted);
  letter-spacing: 0.2em;
}

.npc-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* ── Activity List ──────────────────────────── */
.area-activities h3 {
  margin-bottom: 1rem;
}

.activity-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.activity-item a {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  text-decoration: none;
  transition: border-color 0.2s, background 0.2s;
  flex-wrap: wrap;
}

@media (max-width: 600px) {
  .activity-item a { gap: 0.5rem; flex-direction: column; align-items: center; text-align: center; }
  .activity-icon { width: 100%; display: flex; align-items: center; justify-content: center; gap: 0.5rem; font-size: 1.2rem; }
  .activity-text { width: 100%; text-align: center; }
  .activity-action { width: 100%; text-align: center; justify-content: center; }
}

.activity-item a:hover {
  border-color: #e8be8e;
  background: rgba(232, 190, 142, 0.05);
  text-decoration: none;
}

.activity-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.activity-icon__candle {
  width: 32px;
  height: 40px;
  object-fit: contain;
  display: block;
}

.activity-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.activity-name {
  font-family: var(--font-heading);
  font-variant: small-caps;
  color: var(--color-text-heading);
}

.activity-desc {
  color: var(--color-text-muted);
  font-size: 0.85rem;
  font-style: italic;
}

.activity-action {
  flex-shrink: 0;
  pointer-events: none; /* parent link handles click */
}

/* ── Game Pages ─────────────────────────────── */
.game-page {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.game-header {
  padding-bottom: 1rem;
  text-align: center;
}

.breadcrumbs {
  font-family: var(--font-heading);
  font-variant: small-caps;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-top: 0.4rem;
}

.breadcrumbs__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
}

.breadcrumbs__item {
  display: inline-flex;
  align-items: center;
}

.breadcrumbs__link {
  color: var(--color-text-muted);
  text-decoration: none;
}

.breadcrumbs__link:hover { color: var(--color-gold); }

.breadcrumbs__current {
  color: var(--color-text);
}

.breadcrumbs__sep {
  margin: 0 0.5rem;
  color: var(--color-border);
}

.game-title {
  font-size: 2rem;
  margin-bottom: 0.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.game-title__icon {
  width: 2rem;
  height: 2rem;
  object-fit: contain;
  flex-shrink: 0;
}

.game-subtitle {
  font-style: italic;
  color: var(--color-text-muted);
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
}

.game-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  font-size: 0.9rem;
  color: var(--color-text-muted);
  flex-wrap: wrap;
}

.game-meta__stat {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
}

.game-meta__score {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  color: #e8be8e;
}

.game-meta__label {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.daily-plays {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  white-space: nowrap;
}

.daily-plays__count {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  color: #e8be8e;
}

.daily-plays__label {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.daily-plays__coin {
  width: 18px;
  height: 18px;
  object-fit: contain;
  vertical-align: middle;
}

.game-leaderboard h3 { margin-bottom: 1rem; }

/* ── Leaderboard ────────────────────────────── */
.leaderboard-list {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: leaderboard;
}

.leaderboard-entry {
  counter-increment: leaderboard;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.9rem;
}

.leaderboard-entry:last-child { border-bottom: none; }

.lb-rank::before {
  content: counter(leaderboard);
  font-family: var(--font-mono);
  color: var(--color-text-muted);
  font-size: 0.8rem;
  width: 20px;
  display: inline-block;
}

.lb-name {
  font-family: var(--font-heading);
  font-variant: small-caps;
  color: var(--color-text-heading);
  flex: 1;
}

.lb-detail {
  color: var(--color-text-muted);
  font-style: italic;
  font-size: 0.8rem;
}

.lb-score {
  font-family: var(--font-mono);
  color: var(--color-gold);
  min-width: 48px;
  text-align: right;
}

/* ── Game Instructions ──────────────────────── */
.game-instructions p  { margin-bottom: 0.75rem; }
.game-instructions ul { padding-left: 1.25rem; margin-bottom: 0.75rem; }
.game-instructions li { margin-bottom: 0.4rem; }

.instructions-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin: 0.75rem 0;
}

.instructions-table th,
.instructions-table td {
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--color-border);
  text-align: center;
}

.instructions-table th {
  font-family: var(--font-heading);
  font-variant: small-caps;
  color: var(--color-text-heading);
  background: rgba(232, 190, 142, 0.05);
  letter-spacing: 0.04em;
}

.instructions-table td:first-child {
  color: var(--color-text-muted);
  font-style: italic;
}

.instructions-table td:last-child {
  color: var(--color-gold);
  font-family: var(--font-heading);
}

.instructions-coin {
  width: 18px;
  height: 18px;
  object-fit: contain;
  vertical-align: middle;
  margin-left: 2px;
}

/* ── Mastermind Board ───────────────────────────── */
.mm-board {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem;
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
}

/* Palette row */
.mm-palette {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--color-border);
}

.mm-palette__colours {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Peg base */
.mm-peg {
  width: 44px;
  height: 56px;
  border-radius: var(--radius);
  border: 2px solid rgba(255,255,255,0.2);
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
  flex-shrink: 0;
  padding: 2px;
  background: transparent;
  overflow: hidden;
  touch-action: manipulation;
}

.mm-peg:hover { transform: scale(1.1); box-shadow: 0 0 8px rgba(255,255,255,0.3); }
.mm-peg--empty { background: var(--color-bg-panel) !important; border: 2px dashed var(--color-border); cursor: pointer; }
.mm-peg--filled { border-color: rgba(255,255,255,0.3); }
.mm-peg--past { cursor: default; pointer-events: none; }
.mm-peg--past:hover { transform: none; box-shadow: none; }
.mm-peg--small { width: 24px; height: 24px; display: inline-block; vertical-align: middle; }

/* Candle images inside pegs */
.mm-candle-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  pointer-events: none;
}

/* Row number */
.mm-row-number {
  font-family: var(--font-heading);
  font-variant: small-caps;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  width: 1rem;
  flex-shrink: 0;
  text-align: left;
}

.mm-row-number--spacer { visibility: hidden; }

/* Current row */
.mm-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.mm-row--active .mm-pegs {
  display: flex;
  gap: 0.5rem;
  flex: 1;
  justify-content: space-between;
}

/* Dots row — indented to align under pegs */
.mm-dots-row {
  display: flex;
  align-items: center;
  width: 100%;
}

/* Submit button */
.mm-submit {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid #e8be8e;
  background: rgba(232, 190, 142, 0.1);
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  overflow: hidden;
  touch-action: manipulation;
}

.mm-submit:hover { background: rgba(232, 190, 142, 0.25); }
.mm-submit--disabled { border-color: var(--color-border); opacity: 0.35; pointer-events: none; }

.mm-match-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

/* History */
.mm-history {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: center;
}

.mm-history-entry {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

[data-mastermind-target="currentRow"] {
  width: 100%;
}

.mm-pegs {
  display: flex;
  gap: 0.5rem;
  flex: 1;
  justify-content: space-between;
}

/* Score dots */
.mm-dots {
  display: flex;
  gap: 0.3rem;
}

.mm-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: inline-block;
}

.mm-dot--exact { background: #b896d4; }
.mm-dot--close { background: transparent; border: 2px solid #b896d4; }
.mm-dot--miss  { background: transparent; border: 2px solid rgba(255,255,255,0.1); }

/* Status / end game */
.mm-status {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-lg);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: center;
}

.mm-status--solved { border: 1px solid #e8be8e; background: rgba(232,190,142,0.08); }
.mm-status--failed { border: 1px solid var(--color-border); }

.mm-status p { margin: 0; }
.mm-status__code { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; }
.mm-status__code-label { font-style: italic; color: var(--color-text-muted); font-size: 0.9rem; }
.mm-status__code-candles { display: flex; gap: 0.35rem; align-items: center; justify-content: center; }

/* Drag ghost */
.mm-drag-ghost {
  position: fixed;
  pointer-events: none;
  z-index: 1000;
  opacity: 0.85;
  transform: translate(-50%, -50%) scale(1.15);
  transition: none;
  border-radius: var(--radius);
  overflow: hidden;
  width: 44px;
  height: 56px;
}

.mm-drag-ghost img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* Mobile */
@media (max-width: 600px) {
  .mm-peg { width: 36px; height: 46px; }
  .mm-submit { width: 34px; height: 34px; font-size: 1rem; }
  .mm-board { padding: 0.75rem; }
}

/* ── Same Game ───────────────────────────── */
.sg-board {
  padding: 1rem;
  width: 100%;
  max-width: min(520px, calc(100dvh - 260px));
  margin: 0 auto;
}

.sg-grid {
  display: grid;
  gap: 3px;
  margin-bottom: 1rem;
  width: 100%;
  aspect-ratio: 1;
}

.sg-cell {
  border-radius: 4px;
  cursor: default;
  transition: filter 0.1s ease, transform 0.1s ease, opacity 0.35s ease;
  aspect-ratio: 1;
  position: relative;
}

.sg-cell--filled { opacity: 1; }
.sg-cell--empty  { background: rgba(255,255,255,0.04); }
.sg-cell--clickable { cursor: pointer; }

.sg-potion-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  pointer-events: none;
  padding: 1px;
}

.sg-cell--highlighted {
  filter: brightness(1.4);
  transform: scale(1.08);
  z-index: 1;
  box-shadow: 0 0 6px rgba(255,255,255,0.3);
}

/* Touch: tap-to-confirm indicator on the origin cell */
.sg-cell--pending {
  outline: 2px solid #e8be8e;
  outline-offset: 1px;
  z-index: 2;
  position: relative;
}

@keyframes sg-shatter {
  0%   { transform: scale(1);   opacity: 1; }
  40%  { transform: scale(1.3); opacity: 0.8; }
  100% { transform: scale(0);   opacity: 0; }
}

.sg-cell--shattering {
  animation: sg-shatter 0.35s ease-out forwards;
  pointer-events: none;
}

/* Special block overlays */
.sg-cell__badge {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65em;
  pointer-events: none;
  border-radius: 4px;
}

/* Volatile — cracked glow */
.sg-cell--volatile {
  box-shadow: inset 0 0 0 2px rgba(255, 80, 80, 0.7);
}

.sg-cell--volatile::after {
  content: "\01F4A5";
  position: absolute;
  top: 1px;
  right: 2px;
  font-size: 0.55em;
  pointer-events: none;
}

/* Transmutation Flask — pulsing gold border, always clickable */
@keyframes sg-transmute-pulse {
  0%, 100% { box-shadow: inset 0 0 0 2px rgba(232, 190, 142, 0.6); }
  50%       { box-shadow: inset 0 0 0 2px rgba(232, 190, 142, 1), 0 0 8px rgba(232, 190, 142, 0.4); }
}

.sg-cell--transmute {
  animation: sg-transmute-pulse 1.5s ease-in-out infinite;
}

.sg-cell--transmute::after {
  content: "✴";
  position: absolute;
  top: 1px;
  right: 2px;
  font-size: 0.55em;
  pointer-events: none;
}

/* Elixir — iridescent shimmer */
@keyframes sg-shimmer {
  0%   { filter: hue-rotate(0deg) brightness(1.2); }
  50%  { filter: hue-rotate(180deg) brightness(1.4); }
  100% { filter: hue-rotate(360deg) brightness(1.2); }
}

.sg-cell--elixir {
  animation: sg-shimmer 2s linear infinite;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,0.6);
}

.sg-cell--elixir::after {
  content: "✦";
  position: absolute;
  top: 1px;
  right: 2px;
  font-size: 0.6em;
  color: white;
  pointer-events: none;
}

.sg-score {
  text-align: center;
  color: var(--color-text-muted);
  font-size: 1rem;
  margin: 0.5rem 0;
}

.sg-over {
  text-align: center;
  padding: 1rem 0;
}

.sg-over p {
  font-style: italic;
  color: var(--color-text-muted);
  margin-bottom: 0.5rem;
}

.sg-final-score {
  font-size: 1.2rem;
  color: var(--color-text-heading);
  margin-bottom: 1.5rem;
}

.sg-over__level {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  margin-bottom: 0.25rem;
}

.sg-level-clear {
  text-align: center;
  padding: 2rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.sg-level-clear p:first-child {
  font-family: var(--font-heading);
  font-variant: small-caps;
  font-size: 1.4rem;
  color: #e8be8e;
  letter-spacing: 0.05em;
}

.sg-level-clear__sub {
  font-style: italic;
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

/* -- Memory Game ------------------------------------------------- */

.memory-board {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.memory-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.5rem;
}

@media (max-width: 500px) {
  .memory-grid { grid-template-columns: repeat(4, 1fr); gap: 0.35rem; }
}

.memory-card {
  aspect-ratio: 3 / 4;
  cursor: pointer;
  perspective: 600px;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.memory-card__inner {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.4s ease;
  border-radius: var(--radius);
}

.memory-card--flipped .memory-card__inner,
.memory-card--matched .memory-card__inner {
  transform: rotateY(180deg);
}

.memory-card__front,
.memory-card__back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg-panel);
  border: 1px solid var(--color-border);
  transition: opacity 0.1s ease 0.2s;
}

.memory-card__front {
  transform: rotateY(180deg);
  opacity: 0;
}

/* When flipped: show front (toy), hide back (card pattern) */
.memory-card--flipped .memory-card__front,
.memory-card--matched .memory-card__front {
  opacity: 1;
}

.memory-card--flipped .memory-card__back,
.memory-card--matched .memory-card__back {
  opacity: 0;
}

.memory-card__front img,
.memory-card__back img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

.memory-card--matched .memory-card__front {
  border-color: rgba(232, 190, 142, 0.4);
}

.memory-status-bar {
  min-height: 2rem;
  text-align: center;
}

.memory-status {
  display: flex;
  gap: 1.5rem;
  font-family: var(--font-heading);
  font-variant: small-caps;
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

.memory-complete {
  font-family: var(--font-heading);
  font-variant: small-caps;
  color: var(--color-gold);
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.memory-score {
  color: var(--color-text-muted);
  margin-bottom: 1rem;
}


/* ── Mansion Room Map ───────────────────── */
.mansion-map-panel h3 { margin-bottom: 0.25rem; }

.mansion-map__flavour {
  font-style: italic;
  color: var(--color-text-muted);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.mansion-map {
  position: relative;
  display: inline-block;
  width: 100%;
}

.mansion-map__image {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius-lg);
}

.mansion-map__hotspots {
  position: absolute;
  inset: 0;
}

.mansion-hotspot {
  position: absolute;
  border-radius: 50%;
  text-decoration: none;
  cursor: pointer;
  pointer-events: auto;
}

.mansion-hotspot:hover {
  background: radial-gradient(circle, rgba(212, 165, 116, 0.25) 0%, transparent 70%);
  text-decoration: none;
}

.mansion-hotspot--soon:hover {
  background: radial-gradient(circle, rgba(255, 255, 255, 0.05) 0%, transparent 70%);
}

.mansion-hotspot__label {
  display: none;
}

/* Room list below map */
.mansion-map__rooms {
  margin-top: 0.75rem;
  text-align: center;
  font-family: var(--font-heading);
  font-variant: small-caps;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
}

.mansion-map__rooms a {
  color: var(--color-gold);
  text-decoration: none;
}

.mansion-map__rooms a:hover { text-decoration: underline; }

.mansion-map__sep {
  color: var(--color-border);
  margin: 0 0.4rem;
}

.mansion-map__soon {
  color: var(--color-text-muted);
  opacity: 0.6;
}

/* Hotspot positions — percentages relative to map image
   These will need tuning once you see it in the browser */
.mansion-hotspot--gallery      { top: 20%; left: 12%;  width: 18%; height: 0; padding-bottom: 18%; }
.mansion-hotspot--attic        { top: 10%; left: 42%;  width: 16%; height: 0; padding-bottom: 16%; }
.mansion-hotspot--conservatory { top: 10%; left: 68%;  width: 18%; height: 0; padding-bottom: 18%; }
.mansion-hotspot--cellar       { top: 62%; left: 8%;   width: 18%; height: 0; padding-bottom: 18%; }
.mansion-hotspot--lab          { top: 62%; left: 62%;  width: 20%; height: 0; padding-bottom: 20%; }

/* ── Memory Game ─────────────────────── */
.memory-board {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
}

@media (min-width: 900px) {
  .memory-board {
    max-width: 680px;
  }
}

.memory-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin: 0 auto 1rem;
  width: 100%;
  max-width: 480px;
}

@media (min-width: 900px) {
  .memory-grid {
    max-width: 560px;
  }
}

.memory-card {
  aspect-ratio: 438 / 429;
  cursor: pointer;
  perspective: 600px;
  user-select: none;
}

.memory-card__inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.4s ease;
}

.memory-card--flipped .memory-card__inner,
.memory-card--matched .memory-card__inner {
  transform: rotateY(180deg);
}

.memory-card__front,
.memory-card__back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: var(--radius);
  overflow: hidden;
}

.memory-card__front {
  transform: rotateY(180deg);
}

.memory-card__front img,
.memory-card__back img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.memory-card--matched .memory-card__front {
  opacity: 0.7;
  filter: brightness(1.1) saturate(0.7);
}

.memory-status {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-variant: small-caps;
  color: var(--color-text-muted);
  font-size: 0.9rem;
  padding: 0.5rem 0;
}

.memory-status__moves strong,
.memory-status__matches strong {
  color: #e8be8e;
}

.memory-status__time {
  color: var(--color-text-muted);
  font-family: var(--font-mono, monospace);
  font-variant: normal;
}

.memory-complete {
  text-align: center;
  font-style: italic;
  color: var(--color-text-muted);
  margin-bottom: 0.5rem;
}

.memory-score {
  text-align: center;
  font-family: var(--font-heading);
  font-variant: small-caps;
  color: var(--color-text-heading);
  margin-bottom: 1rem;
}

.memory-status-bar {
  min-height: 2.5rem;
}

/* ── Scroll Modal (rolled-parchment style) ── */
.scroll-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 600;
  background: rgba(0, 0, 0, 0.7);
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.scroll-modal--open {
  display: flex;
}

.scroll-modal__paper {
  position: relative;
  width: 100%;
  max-width: 480px;
  background: #1a1510;
  border: 2px solid #7a6545;
  border-radius: 4px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.8), inset 0 0 60px rgba(120, 90, 40, 0.1);
}

.scroll-modal__paper-top,
.scroll-modal__paper-bottom {
  height: 18px;
  background: linear-gradient(to bottom, #5a4020, #3a2a10);
  border-radius: 2px;
}

.scroll-modal__paper-bottom {
  background: linear-gradient(to top, #5a4020, #3a2a10);
}

.scroll-modal__paper-body {
  padding: 1.5rem 2rem;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 27px,
    rgba(120, 90, 40, 0.15) 27px,
    rgba(120, 90, 40, 0.15) 28px
  );
}

.scroll-modal__date {
  font-family: var(--font-heading);
  font-variant: small-caps;
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-bottom: 0.5rem;
  letter-spacing: 0.08em;
}

.scroll-modal__title {
  font-family: var(--font-heading);
  color: #e8be8e;
  font-size: 1.1rem;
  margin-bottom: 1rem;
  letter-spacing: 0.04em;
}

.scroll-modal__body {
  color: var(--color-text);
  font-style: italic;
  line-height: 1.7;
  font-size: 0.95rem;
}

.scroll-modal__close {
  position: absolute;
  top: 0.4rem;
  right: 0.5rem;
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  line-height: 1;
}

.scroll-modal__close:hover { color: #e8be8e; }

body.modal-open { overflow: hidden; }

/* ── Tavern Regulars ─────────────────────── */
.regulars-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

@media (min-width: 600px) {
  .regulars-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.regular-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  text-align: center;
}

.regular-card__portrait {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
}

.regular-card__name {
  font-family: var(--font-heading);
  font-variant: small-caps;
  color: var(--color-text-heading);
  font-size: 0.9rem;
  letter-spacing: 0.04em;
}

.regular-card__desc {
  font-size: 0.75rem;
  font-style: italic;
  color: var(--color-text-muted);
  line-height: 1.4;
}

/* ── Gallows Dice ────────────────────────────── */
.gd-ante-panel {
  max-width: 480px;
  margin: 0 auto;
  text-align: center;
}

.gd-ante-flavour {
  font-style: italic;
  color: var(--color-text-muted);
  margin-bottom: 1.25rem;
}

.gd-ante-options {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.gd-ante-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
}

.gd-ante-coin {
  width: 40px;
  height: auto;
  object-fit: contain;
}

.gd-ante-btn { min-width: 52px; }

.btn-disabled { opacity: 0.4; cursor: not-allowed; }

.btn-outline {
  background: transparent;
  border: 2px solid #e8be8e;
  color: #e8be8e;
  font-family: var(--font-heading);
  font-variant: small-caps;
  letter-spacing: 0.05em;
  transition: background 0.15s, color 0.15s;
}

.btn-outline:hover {
  background: rgba(232, 190, 142, 0.12);
}

.gd-balance {
  font-family: var(--font-heading);
  font-variant: small-caps;
  color: var(--color-text-muted);
  font-size: 0.85rem;
}

.gd-board {
  max-width: 680px;
  margin: 0 auto;
}

.gd-section { margin-bottom: 1.5rem; }

.gd-section-title {
  font-family: var(--font-heading);
  font-variant: small-caps;
  color: var(--color-text-heading);
  font-size: 1rem;
  letter-spacing: 0.06em;
  margin-bottom: 0.75rem;
}

.gd-die-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  cursor: pointer;
}

.gd-die-check { display: none; }

/* Die images — used in roll grid, hand, qualifiers */
.gd-die-img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  border-radius: var(--radius);
  border: 2px solid transparent;
  background: transparent;
  transition: border-color 0.15s, background 0.15s;
  display: block;
}

.gd-die-img--dead {
  opacity: 0.35;
  filter: grayscale(60%);
  cursor: default;
}

.gd-die-label--dead {
  cursor: default;
}

.gd-die-check:checked + .gd-die-img {
  border-color: #e8be8e;
  background: rgba(232, 190, 142, 0.15);
  box-shadow: 0 0 8px rgba(232, 190, 142, 0.3);
}

/* Roll area — 6 dice in one row, full width */
.gd-roll-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}

.gd-die-label {
  display: block;
  cursor: pointer;
  width: 100%;
}

.gd-roll-actions {
  display: flex;
  justify-content: center;
  margin-top: 0.5rem;
}

/* Your Hand — 4 slots top row, 2 qualifiers centred below */
.gd-hand-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
}

.gd-hand-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.4rem;
  width: 100%;
}

@media (min-width: 600px) {
  .gd-hand-section {
    width: 65%;
    margin: 0 auto;
  }
}

.gd-hand-die {
  aspect-ratio: 1;
  border-radius: var(--radius);
  border: 2px solid var(--color-border);
  background: rgba(232, 190, 142, 0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* Once a die image is inside, let the image speak for itself */
.gd-hand-die:has(img) {
  border-color: transparent;
  background: transparent;
}

.gd-hand-die img { width: 100%; height: 100%; object-fit: contain; display: block; }
.gd-hand-die--empty { opacity: 0.3; }

/* Qualifiers — same size as hand dice */
.gd-qualifiers-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.4rem;
  width: 50%; /* matches 2 of 4 hand slots */
}

.gd-qualifier {
  aspect-ratio: 1;
  border-radius: var(--radius);
  border: 2px dashed var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.3);
  overflow: hidden;
}

.gd-qualifier img { width: 100%; height: 100%; object-fit: contain; display: block; }

.gd-qualifier--met {
  border-color: transparent;
  border-style: solid;
  background: transparent;
}


/* Opponent qualifiers — smaller */
.gd-qualifier--sm {
  width: 32px;
  height: 32px;
}

.gd-qualifier-slot {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  color: var(--color-text-muted);
  font-weight: 700;
}

.gd-hand-score {
  font-family: var(--font-heading);
  font-variant: small-caps;
  color: var(--color-text-muted);
  font-size: 0.9rem;
  margin-top: 0.25rem;
  text-align: center;
}

.gd-qualified { color: #e8be8e; margin-left: 0.5rem; }

/* Status — inline in roll area */
.gd-status-inline {
  font-style: italic;
  color: var(--color-text-muted);
  font-size: 0.85rem;
  text-align: center;
  margin: 0.35rem 0;
  min-height: 1.2rem;
}

/* Status — standalone (used after game ends) */
.gd-status {
  font-style: italic;
  color: var(--color-text-muted);
  font-size: 0.9rem;
  min-height: 1.5rem;
  text-align: center;
  margin-bottom: 0.25rem;
}

.gd-wins-stats {
  font-family: var(--font-heading);
  font-variant: small-caps;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  text-align: center;
  margin-top: 0.25rem;
}

.gd-unlock-list {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0;
}

.gd-unlock-list li {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  padding: 0.1rem 0;
}

.gd-session-stats {
  font-family: var(--font-heading);
  font-variant: small-caps;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  text-align: center;
  margin-bottom: 1rem;
  min-height: 1.2rem;
}

.gd-net--positive { color: #7ec87e; }
.gd-net--negative { color: #c97070; }

.gd-session-balance {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-family: var(--font-heading);
  font-variant: small-caps;
  font-size: 0.9rem;
  color: #e8be8e;
  margin-top: 0.25rem;
}

.gd-session-coin-img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  vertical-align: middle;
}

/* Opponents — 2 col mobile, 4 col desktop */
.gd-opponent-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

@media (min-width: 600px) {
  .gd-opponent-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.gd-opponent {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  text-align: center;
  background: rgba(10, 10, 15, 0.4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.6rem 0.4rem;
  min-width: 0;
}

.gd-opponent__avatar {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  flex-shrink: 0;
}

.gd-opponent__name {
  font-family: var(--font-heading);
  font-variant: small-caps;
  font-size: 0.75rem;
  color: var(--color-text-heading);
  letter-spacing: 0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* Opponent dice: 4 in a row */
.gd-opponent__dice {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.2rem;
  width: 100%;
}

.gd-opponent__dice .gd-hand-die {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
}

.gd-opponent__qualifiers {
  display: flex;
  gap: 0.25rem;
  justify-content: center;
}

.gd-opponent__score {
  font-family: var(--font-heading);
  font-variant: small-caps;
  font-size: 0.7rem;
  color: var(--color-text-muted);
}

.gd-opponent__disqualified {
  color: #c97070;
  font-size: 0.7rem;
  font-style: italic;
}

.gd-opponent__score-val { color: #e8be8e; }

.gd-play-again {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  padding: 0.5rem 0;
}

.gd-play-again button[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

.hidden { display: none !important; }

/* ── Change Ante Modal ───────────────────────── */
.gd-ante-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 600;
  background: rgba(0, 0, 0, 0.7);
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.gd-ante-modal--open {
  display: flex;
}

.gd-ante-modal__inner {
  background: var(--color-bg-panel);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.gd-ante-modal__inner h3 {
  font-family: var(--font-heading);
  color: var(--color-text-heading);
  margin-bottom: 0.5rem;
}

.gd-ante-modal__cancel {
  margin-top: 1rem;
}

/* ── Unlock toast ────────────────────────── */
.gd-unlock-toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-bg-panel);
  border: 1px solid #e8be8e;
  border-radius: var(--radius-lg);
  padding: 0.75rem 1.25rem;
  font-family: var(--font-heading);
  font-variant: small-caps;
  color: #e8be8e;
  font-size: 0.95rem;
  z-index: 700;
  box-shadow: 0 4px 20px rgba(0,0,0,0.6);
  animation: gd-toast-in 0.3s ease;
  white-space: nowrap;
}

@keyframes gd-toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(1rem); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ── Bogwyrds ─────────────────────────────── */
.bw-game-board {
  width: 100%;
  max-width: min(520px, calc(100dvh - 260px));
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

.bw-status-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  margin-bottom: 0.4rem;
}

.bw-timer-row {
  text-align: center;
}

.bw-timer {
  font-size: 2rem;
  color: #7ec87e;
  font-family: var(--font-mono, monospace);
  font-variant: normal;
  font-weight: bold;
}

.bw-timer--critical { color: #c97070; }

.bw-stats-row {
  display: flex;
  gap: 1.5rem;
  font-family: var(--font-heading);
  font-variant: small-caps;
  font-size: 0.85rem;
}

.bw-stats-row strong { color: #e8be8e; }

/* Grid */
.bw-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  user-select: none;
  touch-action: none;
  width: 100%;
}



.bw-cell {
  aspect-ratio: 1;
  border-radius: var(--radius);
  border: 2px solid var(--color-border);
  background: rgba(232, 190, 142, 0.04);
  font-family: var(--font-heading);
  font-size: 1.8rem;
  font-variant: small-caps;
  color: var(--color-text-heading);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.1s, background 0.1s;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

.bw-cell--path {
  border-color: #e8be8e;
  background: rgba(232, 190, 142, 0.18);
  color: #e8be8e;
}

/* Mid area — current word + feedback + timesup, fixed height so nothing jumps */
.bw-mid-area {
  min-height: 2.8rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.05rem;
  margin: 0.2rem 0 0.1rem;
}

.bw-current-word {
  text-align: center;
  font-family: var(--font-heading);
  font-size: 1.2rem;
  color: var(--color-text-heading);
  letter-spacing: 0.1em;
  height: 1.2rem;
}

.bw-feedback {
  text-align: center;
  font-style: italic;
  font-size: 0.85rem;
  min-height: 1.2rem;
  color: var(--color-text-muted);
}

.bw-feedback--good { color: #7ec87e; }
.bw-feedback--bad  { color: #c97070; }

.bw-timesup {
  font-family: var(--font-heading);
  font-variant: small-caps;
  color: #e8be8e;
  font-size: 0.95rem;
  text-align: center;
  margin: 0;
}

.bw-actions {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 20px;
}

.bw-score-line {
  text-align: center;
  font-family: var(--font-heading);
  font-variant: small-caps;
  font-size: 0.9rem;
  color: var(--color-text-muted);
  padding: 0.4rem 0 0.2rem;
}

.bw-score-line strong { color: #e8be8e; }

.bw-score-coin {
  width: 18px;
  height: 18px;
  object-fit: contain;
  vertical-align: middle;
  margin-left: 2px;
}

.bw-word-log-wrap {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: rgba(0,0,0,0.2);
  padding: 0.4rem 0.75rem;
  margin-top: 0.3rem;
}

.bw-word-log {
  font-family: var(--font-heading);
  font-variant: small-caps;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  height: 72px;
  overflow-y: auto;
  word-break: break-word;
  line-height: 1.8;
}

.lb-empty {
  font-style: italic;
  color: var(--color-text-muted);
  font-size: 0.9rem;
}
