* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: #111820;
  font-family: Georgia, serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 8px;
}

h1 {
  margin-bottom: 10px;
  text-align: center;
}

.title-tiles {
  display: flex;
  gap: 4px;
  justify-content: center;
  align-items: center;
}

.title-tile {
  position: relative;
  background: linear-gradient(145deg, #f8eacb, #dfc07a);
  border: 1px solid #b8963e;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-family: Georgia, serif;
  color: #1a1a1a;
  box-shadow: 1px 2px 5px rgba(0,0,0,0.5);
  line-height: 1;
}

.title-pts {
  position: absolute;
  top: 1px;
  left: 2px;
  font-weight: normal;
  color: #444;
}

.title-tiles--lg .title-tile { width: 48px; height: 48px; font-size: 1.7rem; }
.title-tiles--lg .title-pts  { font-size: 0.55rem; }
.title-tiles--lg .tile-color { width: 6px; height: 6px; }

.title-tiles--sm .title-tile { width: 32px; height: 32px; font-size: 1.1rem; border-radius: 3px; }
.title-tiles--sm .title-pts  { font-size: 0.4rem; }
.title-tiles--sm .tile-color { width: 4px; height: 4px; }

/* ── GAME OVER BUTTONS ── */
.go-btns {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 22px;
}

/* ── HUD ── */
#hud {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
  align-items: stretch;
}

.hud-box {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  padding: 6px 14px;
  text-align: center;
  min-width: 70px;
}

.hud-label {
  font-size: 0.6rem;
  letter-spacing: 2px;
  color: #888;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.hud-val {
  font-size: 1.25rem;
  font-weight: bold;
  color: #e8e8e8;
}

.hud-val.warn { color: #e67e22; }
.hud-val.danger { color: #e74c3c; }

#hud-score-box {
  flex: 1;
  min-width: 130px;
}

#score-fraction {
  font-size: 1.05rem;
  font-weight: bold;
  color: #e8e8e8;
  white-space: nowrap;
}

#score-fraction .target { color: #888; font-size: 0.85rem; }

#progress-wrap {
  height: 5px;
  background: rgba(255,255,255,0.1);
  border-radius: 3px;
  margin-top: 4px;
  overflow: hidden;
}

#progress-bar {
  height: 100%;
  background: #e8c84a;
  border-radius: 3px;
  width: 0%;
  transition: width 0.4s ease;
}

#progress-bar.done { background: #55efc4; }

/* ── MAIN LAYOUT ── */
#curse-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(180, 0, 0, 0.18);
  border: 1px solid #c0392b;
  border-radius: 8px;
  padding: 8px 14px;
  margin-bottom: 10px;
  color: #f5a0a0;
  font-size: 0.82rem;
  max-width: 560px;
  width: 100%;
}

.curse-icon {
  font-size: 1rem;
  flex-shrink: 0;
  color: #e74c3c;
}

.curse-text strong { color: #e74c3c; }

.shop-curse-warning {
  background: rgba(180, 0, 0, 0.15);
  border: 1px solid #c0392b;
  border-radius: 6px;
  color: #f5a0a0;
  font-size: 0.78rem;
  padding: 6px 10px;
  margin-top: 6px;
  text-align: center;
}

#main {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

/* ── BOARD ── */
#board-wrap {
  background: #1c0e08;
  padding: 5px;
  border-radius: 6px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.7);
}

#board {
  display: grid;
  gap: 1px;
}

.cell {
  width: var(--cs, 52px);
  height: var(--cs, 52px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: var(--spfs, 0.4rem);
  font-weight: bold;
  text-align: center;
  cursor: pointer;
  border-radius: 2px;
  background: #c8b99a;
  transition: filter 0.1s;
  user-select: none;
  position: relative;
  overflow: visible;
}

/* ── SCORE ANIMATIONS ── */
.cell.scoring-active .tile {
  box-shadow: 0 0 0 3px #ffe57a, 0 0 14px rgba(255, 229, 122, 0.65);
  transform: scale(1.08);
  transition: box-shadow 0.08s, transform 0.08s;
  z-index: 1;
}

.score-popup {
  position: absolute;
  pointer-events: none;
  font-family: Georgia, serif;
  font-weight: bold;
  white-space: nowrap;
  z-index: 200;
  line-height: 1;
}

/* Per-tile: letter value (+X) — floats upward from tile center */
.score-popup--pts {
  color: #fffde7;
  text-shadow: 0 1px 4px rgba(0,0,0,0.9), 0 0 8px rgba(0,0,0,0.6);
  font-size: 0.75rem;
  left: 55%;
  top: 45%;
  transform: translateX(-50%) translateY(-50%);
  animation: scoreFloat 0.4s ease-out forwards;
}

/* Per-tile: tile effect trigger — bottom-left, purple to match effect icon */
.score-popup--effect {
  color: #b794f4;
  text-shadow: 0 1px 4px rgba(0,0,0,0.9);
  font-size: 0.65rem;
  left: 3px;
  bottom: 3px;
  top: auto;
  animation: scoreFloat 0.45s ease-out forwards;
}

/* Per-tile: letter multiplier (×N) — top-left corner */
.score-popup--mult {
  color: #ffe57a;
  text-shadow: 0 1px 3px rgba(0,0,0,0.9);
  font-size: 0.6rem;
  left: 3px;
  top: 3px;
  animation: scoreFloat 0.35s ease-out forwards;
}

/* Word-level multiplier (×N) — right of last tile for horizontal words */
.score-popup--word-mult-right {
  color: #f6ad55;
  text-shadow: 0 1px 5px rgba(0,0,0,0.9);
  font-size: 0.8rem;
  left: calc(100% + 5px);
  top: 20%;
  animation: scoreAppear 0.55s ease-out forwards;
}

/* Word-level multiplier — below last tile for vertical words */
.score-popup--word-mult-below {
  color: #f6ad55;
  text-shadow: 0 1px 5px rgba(0,0,0,0.9);
  font-size: 0.8rem;
  left: 10%;
  top: calc(100% + 5px);
  animation: scoreAppear 0.55s ease-out forwards;
}

/* Word total score — right of last tile for horizontal words */
.score-popup--total-right {
  color: #9ae6b4;
  text-shadow: 0 1px 6px rgba(0,0,0,0.95);
  font-size: 1rem;
  left: calc(100% + 5px);
  top: 50%;
  animation: scoreAppear 0.7s ease-out forwards;
}

/* Word total score — below last tile for vertical words */
.score-popup--total-below {
  color: #9ae6b4;
  text-shadow: 0 1px 6px rgba(0,0,0,0.95);
  font-size: 1rem;
  left: 50%;
  top: calc(100% + 5px);
  animation: scoreAppear 0.7s ease-out forwards;
}

/* Coin delta — centered below last tile, gold for gain, red for cost */
.score-popup--coins-pos,
.score-popup--coins-neg {
  font-size: 0.9rem;
  left: 50%;
  top: calc(100% + 5px);
  animation: scoreAppearCentered 0.7s ease-out forwards;
}
.score-popup--coins-pos { color: #ffd700; text-shadow: 0 1px 6px rgba(0,0,0,0.95); }
.score-popup--coins-neg { color: #fc8181; text-shadow: 0 1px 6px rgba(0,0,0,0.95); }

@keyframes scoreAppearCentered {
  0%   { opacity: 0; transform: translateX(-50%) scale(0.5); }
  20%  { opacity: 1; transform: translateX(-50%) scale(1.15); }
  40%  { opacity: 1; transform: translateX(-50%) scale(1); }
  75%  { opacity: 1; transform: translateX(-50%) scale(1); }
  100% { opacity: 0; transform: translateX(-50%) scale(0.85); }
}

@keyframes scoreFloat {
  0%   { opacity: 0; transform: translateY(2px) scale(0.7); }
  20%  { opacity: 1; transform: translateY(-6px) scale(1); }
  65%  { opacity: 1; transform: translateY(-13px) scale(1); }
  100% { opacity: 0; transform: translateY(-22px) scale(0.85); }
}

@keyframes scoreAppear {
  0%   { opacity: 0; transform: scale(0.5); }
  20%  { opacity: 1; transform: scale(1.12); }
  40%  { opacity: 1; transform: scale(1); }
  75%  { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(0.85); }
}

.cell:not(.has-tile):hover { filter: brightness(1.15); }
.cell.TW   { background: #c0392b; color: #fff; }
.cell.DW   { background: #e8827a; color: #fff; }
.cell.TL   { background: #1f6fa8; color: #fff; }
.cell.DL   { background: #6baed6; color: #fff; }
.cell.star { background: #e8827a; font-size: var(--starfs, 1rem); color: #c0392b; }
.cell.has-tile { background: transparent; cursor: default; }
.cell.has-tile.placeable { cursor: pointer; }

/* ── TILES ON BOARD ── */
.tile {
  width: var(--ts, 48px);
  height: var(--ts, 48px);
  background: linear-gradient(145deg, #f8eacb, #dfc07a);
  border: 1px solid #b8963e;
  border-radius: 3px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: var(--tfs, 1.1rem);
  font-weight: bold;
  color: #1a1a1a;
  position: relative;
  box-shadow: 1px 1px 3px rgba(0,0,0,0.35);
  line-height: 1;
}

.tile .pts {
  font-size: 0.65rem;
  position: absolute;
  top: 1px;
  left: 2px;
  font-weight: normal;
  color: #444;
}

.tile-effect-icon {
  position: absolute;
  bottom: 2px;
  left: 2px;
  font-size: 0.42rem;
  font-weight: bold;
  font-family: Georgia, serif;
  color: #9f7aea;
  line-height: 1;
  pointer-events: none;
}

.tile-color {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
}
.tile-color--red    { background: #e53e3e; }
.tile-color--green  { background: #38a169; }
.tile-color--blue   { background: #3182ce; }
.tile-color--yellow { background: #d69e2e; }

.tile.new-tile {
  background: linear-gradient(145deg, #fffde7, #fff176);
  border-color: #f9a825;
  box-shadow: 0 0 8px rgba(249,168,37,0.85);
}

/* ── RACK TILES ── */
.rack-tile {
  width: 36px;
  height: 42px;
  background: linear-gradient(145deg, #f8eacb, #dfc07a);
  border: 1px solid #b8963e;
  border-radius: 3px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  font-weight: bold;
  color: #1a1a1a;
  cursor: pointer;
  position: relative;
  box-shadow: 2px 3px 5px rgba(0,0,0,0.4);
  transition: transform 0.12s, box-shadow 0.12s;
  user-select: none;
}

.rack-tile:hover { transform: translateY(-3px); box-shadow: 2px 6px 10px rgba(0,0,0,0.5); }

.rack-tile.selected {
  background: linear-gradient(145deg, #fffde7, #fff176);
  border-color: #f9a825;
  box-shadow: 0 0 12px rgba(249,168,37,0.9);
  transform: translateY(-5px);
}

.rack-tile.for-swap {
  border-color: #e74c3c;
  box-shadow: 0 0 10px rgba(231,76,60,0.85);
}

.rack-tile .pts {
  font-size: 0.65rem;
  position: absolute;
  top: 1px;
  left: 2px;
  font-weight: normal;
}

.rack-tile.empty {
  background: rgba(255,255,255,0.05);
  border: 1px dashed #444;
  cursor: default;
  box-shadow: none;
}

.rack-tile.empty:hover { transform: none; }

/* Disable browser touch gestures on draggable elements so our JS can handle them */
.rack-tile:not(.empty), .tile.new-tile { touch-action: none; }

/* ── RESPONSIVE: portrait phones ── */
@media (max-width: 700px) {
  body {
    padding: 6px;
  }

  /* h1 is redundant during gameplay — hidden to save vertical space */
  h1 { display: none; }

  /* HUD: score/target spans the full width on its own row, rest share the second row */
  #hud {
    flex-wrap: wrap;
    gap: 4px;
    width: 100%;
    margin-bottom: 8px;
  }

  #hud-score-box {
    order: -1;
    flex-basis: 100%;
  }

  .hud-box {
    flex: 1;
    min-width: 0;
    padding: 3px 5px;
  }

  .hud-label { font-size: 0.5rem; }
  .hud-val   { font-size: 0.9rem; }

  /* Stack board above sidebar */
  #main {
    flex-direction: column;
    align-items: center;
    width: 100%;
    gap: 8px;
  }

  /* Sidebar goes full width below the board */
  #sidebar {
    width: 100%;
    align-self: stretch;
    gap: 6px;
  }

  #msg {
    min-height: 40px;
    padding: 7px 10px;
    font-size: 0.74rem;
  }

  .panel { padding: 8px; }
  .panel-label { font-size: 0.65rem; margin-bottom: 5px; }

  #rack {
    justify-content: center;
  }

  /* Keep buttons touch-friendly but trim height */
  #controls button {
    height: 42px;
  }
}

.rack-tile.dragging { opacity: 0.35; transform: none; box-shadow: none; }

.cell.drag-over {
  outline: 2px solid #e8c84a;
  outline-offset: -2px;
  filter: brightness(1.3);
}

#rack.rack-drop-active {
  outline: 2px dashed #6baed6;
  outline-offset: 2px;
  border-radius: 8px;
}

/* ── SIDEBAR ── */
#sidebar {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

@media (min-width: 701px) {
  #sidebar { width: 185px; }
}

#msg {
  background: rgba(0,0,0,0.5);
  color: #d0d0d0;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.78rem;
  line-height: 1.5;
  min-height: 64px;
  border: 1px solid rgba(255,255,255,0.07);
}

#msg.error    { color: #ff7675; }
#msg.success  { color: #55efc4; }
#msg.checking { color: #fdcb6e; }

.msg-definition {
  margin-top: 4px;
  font-style: italic;
  color: #a0a0a0;
  font-size: 0.85em;
}

.panel {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 10px;
}

.panel-label {
  color: #e8c84a;
  font-size: 0.72rem;
  letter-spacing: 2px;
  margin-bottom: 8px;
}

#rack { display: flex; gap: 3px; flex-wrap: wrap; }

#controls {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
}

#controls button {
  height: 44px;
  padding: 0;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: filter 0.1s, transform 0.1s;
}

#controls button svg {
  width: 22px;
  height: 22px;
  pointer-events: none;
}

#controls button:hover:not(:disabled) { filter: brightness(1.18); transform: translateY(-1px); }
#controls button:disabled { opacity: 0.4; cursor: default; transform: none; }

#btn-play    { background: #27ae60; color: #fff; grid-column: 1 / -1; }
#btn-play.btn-pending-pass { background: #c0392b; font-size: 0.85rem; font-family: Georgia, serif; font-weight: bold; }
#btn-recall  { background: #c0392b; color: #fff; }
#btn-pass    { background: #555e6b; color: #fff; }
#btn-swap    { background: #6c3483; color: #fff; }
#btn-confirm { background: #e74c3c; color: #fff; display: none; grid-column: 1 / -1; }
#btn-shuffle  { background: #1a6090; color: #fff; }
#btn-view-bag { background: #4a5568; color: #fff; }

/* ── BAG VIEWER MODAL ── */
#bag-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  z-index: 200;
  align-items: center;
  justify-content: center;
}
#bag-modal.show { display: flex; }

#bag-modal-box {
  background: #1c2230;
  border: 2px solid #e8c84a;
  border-radius: 12px;
  padding: 22px;
  color: #fff;
  text-align: center;
  max-width: 380px;
  width: 90%;
}

#bag-modal-box h3 {
  color: #e8c84a;
  margin-bottom: 6px;
  font-size: 1rem;
  letter-spacing: 2px;
}

#bag-modal-total {
  color: #888;
  font-size: 0.78rem;
  margin-bottom: 14px;
}

#bag-modal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
  gap: 5px;
  margin-bottom: 18px;
}

.bag-tile {
  background: linear-gradient(145deg, #f8eacb, #dfc07a);
  border: 1px solid #b8963e;
  border-radius: 3px;
  padding: 5px 2px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.2;
}

.bag-tile-letter {
  font-size: 1rem;
  font-weight: bold;
  color: #1a1a1a;
}

.bag-tile-count {
  font-size: 0.6rem;
  color: #555;
}

#btn-close-bag {
  padding: 8px 24px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 6px;
  color: #ccc;
  font-family: Georgia, serif;
  font-size: 0.85rem;
  cursor: pointer;
}
#btn-close-bag:hover { background: rgba(255,255,255,0.18); }

/* ── TOOLTIPS ── */
#controls [data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.88);
  color: #e8e8e8;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-family: Georgia, serif;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 100;
}

#controls [data-tooltip]:hover::after { opacity: 1; }

.btn-cost {
  font-size: 0.65rem;
  opacity: 0.8;
  margin-left: 4px;
}

#bag-info {
  color: #666;
  font-size: 0.65rem;
  text-align: center;
}

/* ── MODAL (blank tile picker) ── */
#modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  z-index: 200;
  align-items: center;
  justify-content: center;
}
#modal.show { display: flex; }

#modal-box {
  background: #1c2b1e;
  border: 2px solid #e8c84a;
  border-radius: 12px;
  padding: 22px;
  color: #fff;
  text-align: center;
  max-width: 340px;
  width: 90%;
}

#modal-box h3 { color: #e8c84a; margin-bottom: 16px; font-size: 1rem; letter-spacing: 1px; }

#letter-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }

.lbtn {
  padding: 9px 4px;
  background: linear-gradient(145deg, #f8eacb, #dfc07a);
  border: 1px solid #b8963e;
  border-radius: 3px;
  cursor: pointer;
  font-weight: bold;
  color: #1a1a1a;
  font-size: 0.9rem;
  font-family: Georgia, serif;
  transition: background 0.1s;
}
.lbtn:hover { background: #e8c84a; }

/* ── LEVEL CLEAR OVERLAY ── */
#levelclear {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.82);
  z-index: 300;
  align-items: center;
  justify-content: center;
}
#levelclear.show { display: flex; }

#lc-box {
  background: #0e1f14;
  border: 2px solid #55efc4;
  border-radius: 16px;
  padding: 32px 44px;
  text-align: center;
  color: #fff;
  max-width: 360px;
}

#lc-box h2 { color: #55efc4; letter-spacing: 4px; margin-bottom: 6px; font-size: 1.4rem; }
#lc-box .lc-sub { color: #888; font-size: 0.85rem; margin-bottom: 20px; }

.lc-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  font-size: 0.95rem;
}
.lc-row:last-of-type { border-bottom: none; }
.lc-row .lc-key { color: #aaa; }
.lc-row .lc-num { color: #e8c84a; font-weight: bold; }

#btn-next {
  margin-top: 22px;
  padding: 11px 32px;
  background: #55efc4;
  color: #0e1f14;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: bold;
  font-family: Georgia, serif;
  cursor: pointer;
  letter-spacing: 1px;
}
#btn-next:hover { background: #00d2a0; }

/* ── SHOP OVERLAY ── */
#shop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.82);
  z-index: 300;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  padding: 20px 0;
}
#shop.show { display: flex; }

#shop-box {
  background: #1a1505;
  border: 2px solid #e8c84a;
  border-radius: 16px;
  padding: 28px 36px;
  color: #fff;
  text-align: center;
  max-width: 400px;
  width: 90%;
  margin: auto;
}

#shop-box h2 { color: #e8c84a; letter-spacing: 6px; margin-bottom: 6px; font-size: 1.4rem; }

#shop-coins-row {
  color: #aaa;
  font-size: 0.9rem;
  margin-bottom: 20px;
}

#shop-coins-row span { color: #e8c84a; font-weight: bold; font-size: 1.1rem; }

.shop-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(232,200,74,0.25);
  border-radius: 10px;
  padding: 12px 16px;
  gap: 12px;
}

.shop-item-info { text-align: left; }
.shop-item-name { font-size: 0.95rem; font-weight: bold; color: #e8e8e8; margin-bottom: 4px; }
.shop-item-desc { font-size: 0.75rem; color: #888; }
.shop-item-right { display: flex; flex-direction: column; align-items: center; gap: 6px; flex-shrink: 0; }
.shop-item-cost { font-size: 0.75rem; color: #e8c84a; white-space: nowrap; }

.shop-item button {
  padding: 6px 14px;
  background: #e8c84a;
  color: #1a1505;
  border: none;
  border-radius: 6px;
  font-weight: bold;
  font-family: Georgia, serif;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.1s;
  white-space: nowrap;
}

.shop-item button:hover:not(:disabled) { background: #f4d03f; }
.shop-item button:disabled { background: #555; color: #888; cursor: default; }

.shop-section-label {
  font-size: 0.65rem;
  letter-spacing: 3px;
  color: #666;
  margin: 14px 0 8px;
  text-align: left;
}

#shop-tiles { display: flex; flex-direction: column; gap: 10px; }
#shop-trinkets { display: flex; flex-direction: column; gap: 10px; }

.shop-tile-info { display: flex; align-items: center; gap: 12px; }
.shop-tile-preview {
  position: relative;
  width: var(--ts, 44px);
  height: var(--ts, 44px);
  font-size: var(--tfs, 1rem);
  flex-shrink: 0;
  pointer-events: none;
}
.shop-tile-sold { color: #555; font-style: italic; font-weight: normal; }
.shop-tile-effect-desc { color: #b794f4; font-size: 0.72rem; }

.trinket-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: #ccc;
  padding: 4px 0;
}

.trinket-badge .t-icon {
  font-size: 1rem;
}

.trinket-badge .t-name {
  flex: 1;
}

.btn-sell-trinket {
  margin-left: auto;
  padding: 2px 6px;
  font-size: 0.7rem;
  background: #4a2020;
  color: #f8a0a0;
  border: 1px solid #7a3030;
  border-radius: 4px;
  cursor: pointer;
}
.btn-sell-trinket:hover {
  background: #6a2828;
}

.shop-cap-note {
  font-size: 0.65rem;
  color: #888;
  text-align: center;
  margin-top: 4px;
  padding: 4px;
}
.shop-cap-note:not(:empty) {
  color: #e8a040;
}

#btn-reroll {
  width: 100%;
  margin-top: 8px;
  padding: 7px;
  background: transparent;
  color: #e8c84a;
  border: 1px solid #e8c84a;
  border-radius: 6px;
  font-size: 0.8rem;
  font-family: Georgia, serif;
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
}
#btn-reroll:hover:not(:disabled) { background: rgba(232,200,74,0.15); }
#btn-reroll:disabled { opacity: 0.35; cursor: default; }

#shop-owned-trinkets { display: flex; flex-direction: column; gap: 6px; }

/* ── CURSE REWARD ────────────────────────────────────────────────────────── */

#curse-reward {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 350;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  padding: 20px 0;
}
#curse-reward.show { display: flex; }

#cr-box {
  background: #150510;
  border: 2px solid #c0392b;
  border-radius: 16px;
  padding: 28px 36px;
  color: #fff;
  text-align: center;
  max-width: 400px;
  width: 90%;
  margin: auto;
}
#cr-box h2 { color: #e74c3c; letter-spacing: 4px; margin-bottom: 6px; font-size: 1.4rem; }

.cr-sub { color: #aaa; font-size: 0.88rem; margin-bottom: 18px; }

#cr-choices { display: flex; flex-direction: column; gap: 10px; }

.cr-pick-btn {
  padding: 6px 14px;
  background: #27ae60;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-weight: bold;
  font-family: Georgia, serif;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.1s;
  white-space: nowrap;
}
.cr-pick-btn:hover:not(:disabled) { background: #2ecc71; }
.cr-pick-btn:disabled { background: #555; color: #888; cursor: default; }

#cr-owned-trinkets {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-top: 1px solid rgba(192,57,43,0.35);
  margin-top: 16px;
  padding-top: 12px;
}
.cr-owned-label {
  font-size: 0.65rem;
  letter-spacing: 3px;
  color: #666;
  margin-bottom: 4px;
  text-align: left;
}

.shop-sell-btn {
  padding: 6px 10px;
  background: #4a1515;
  color: #f8a0a0;
  border: 1px solid #7a3030;
  border-radius: 6px;
  font-weight: bold;
  font-family: Georgia, serif;
  font-size: 0.78rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.1s;
}
.shop-sell-btn:hover { background: #6a2020; }

#btn-begin-level {
  margin-top: 18px;
  padding: 11px 28px;
  background: #27ae60;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: bold;
  font-family: Georgia, serif;
  cursor: pointer;
  letter-spacing: 1px;
}
#btn-begin-level:hover { background: #2ecc71; }

/* ── GAME OVER OVERLAY ── */
#gameover {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 300;
  align-items: center;
  justify-content: center;
}
#gameover.show { display: flex; }

#go-box {
  background: #1c0e08;
  border: 2px solid #e74c3c;
  border-radius: 16px;
  padding: 32px 44px;
  text-align: center;
  color: #fff;
  max-width: 360px;
}

#go-box h2 { color: #e74c3c; letter-spacing: 4px; margin-bottom: 6px; font-size: 1.4rem; }
#go-box .go-sub { color: #888; font-size: 0.85rem; margin-bottom: 20px; }
#go-reason { color: #bbb; font-size: 0.9rem; margin-bottom: 20px; font-style: italic; }

.go-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  font-size: 0.95rem;
}
.go-row:last-of-type { border-bottom: none; }
.go-row .go-key { color: #aaa; }
.go-row .go-num { color: #e8c84a; font-weight: bold; }

#btn-copy-result, #btn-restart {
  padding: 11px 28px;
  background: #e74c3c;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: bold;
  font-family: Georgia, serif;
  cursor: pointer;
  letter-spacing: 1px;
}
#btn-copy-result:hover, #btn-restart:hover { background: #c0392b; }

/* ── MAIN MENU OVERLAY ── */
#menu {
  display: none;
  position: fixed;
  inset: 0;
  background: #111820;
  z-index: 500;
  align-items: center;
  justify-content: center;
}
#menu.show { display: flex; }

#menu-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  text-align: center;
  padding: 40px 32px;
  max-width: 360px;
  width: 90%;
}

#menu-box h2 {
  margin-bottom: 8px;
}

.menu-tagline {
  color: #666;
  font-size: 0.85rem;
  letter-spacing: 1px;
  margin-bottom: 40px;
}

.menu-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.menu-btn-daily {
  padding: 14px;
  font-size: 1rem;
  font-family: Georgia, serif;
  letter-spacing: 3px;
  background: #e8c84a;
  color: #111820;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: bold;
}
.menu-btn-daily:hover { background: #f5d76e; }
.menu-btn-daily-done { background: #5a5020 !important; color: #b8a84a !important; cursor: pointer; }
.menu-btn-daily-done:hover { background: #6b6025 !important; }
.menu-btn-daily-sub { display: block; font-size: 0.78rem; font-weight: normal; letter-spacing: 1px; margin-top: 3px; }

.menu-btn-secondary {
  padding: 12px;
  font-size: 0.9rem;
  font-family: Georgia, serif;
  letter-spacing: 2px;
  background: transparent;
  color: #aaa;
  border: 1px solid #444;
  border-radius: 8px;
  cursor: pointer;
}
.menu-btn-secondary:hover { border-color: #888; color: #ddd; }

.menu-divider {
  color: #444;
  font-size: 0.65rem;
  letter-spacing: 1px;
  margin: 4px 0;
}

.menu-seed-row {
  display: flex;
  gap: 8px;
}

.menu-seed-row input {
  flex: 1;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  color: #e8e8e8;
  font-size: 0.85rem;
  padding: 10px 12px;
  outline: none;
  font-family: monospace;
}
.menu-seed-row input:focus { border-color: #e8c84a; }

.menu-seed-row button {
  padding: 10px 18px;
  font-family: Georgia, serif;
  letter-spacing: 1px;
  background: #2d4a3e;
  color: #55efc4;
  border: 1px solid #55efc4;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
}
.menu-seed-row button:hover { background: #3a6050; }

.menu-speed-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}

.menu-speed-label {
  color: #888;
  font-size: 0.7rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  text-align: center;
}

.menu-speed-opts {
  display: flex;
  gap: 6px;
  justify-content: center;
}

.speed-opt {
  display: flex;
  align-items: center;
  cursor: pointer;
}

.speed-opt input[type="radio"] { display: none; }

.speed-opt span,
.speed-opt {
  padding: 5px 12px;
  border: 1px solid #444;
  border-radius: 4px;
  color: #888;
  font-size: 0.8rem;
  font-family: Georgia, serif;
  transition: background 0.1s, border-color 0.1s, color 0.1s;
}

.speed-opt:has(input:checked) {
  border-color: #e8c84a;
  color: #e8c84a;
  background: rgba(232, 200, 74, 0.1);
}
