/*
 * Tsumami — the merge game.
 *
 * Deliberately NOT Mug Climb's look. That one is a pixel arcade cabinet; this
 * is soft, glossy and warm, because the pleasure here is watching things
 * settle rather than reacting. Two distinct looks across the set reads as
 * range; forcing one house style onto both would make this one look cheap.
 */
.ts-stage { position: relative; overflow: hidden; touch-action: none; }
.ts-stage canvas#canvas { display: block; width: 100%; height: 100%;
  background: #15100c; }

/* juraku-game.css absolutely positions every canvas inside .jg-stage, which
   is right for the one game canvas and wrong for the two little decorative
   ones (the ladder on the menu, the next-up swatch in the HUD) that live in
   panels nested inside the same stage. Without this they escape their
   parents and stack up in the stage's top-left corner. */
.ts-stage canvas#ladder-cv, .ts-stage canvas#next-cv {
  position: static; inset: auto; height: auto; touch-action: auto;
}

:root {
  --ts-gold: #e7b84b;
  --ts-cream: #f2e7d3;
  --ts-line: rgba(231, 184, 75, 0.28);
  --ts-panel: rgba(20, 14, 10, 0.72);
  --ts-serif: "Shippori Mincho B1", "Hiragino Mincho ProN", Georgia, serif;
}

.ts-hud[hidden], .ts-screen[hidden], .ts-initials[hidden],
.ts-record.hidden { display: none !important; }

/* ---- HUD ---- */
.ts-hud { position: absolute; inset: 0; pointer-events: none; padding: 12px 14px;
  display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.ts-panel { background: var(--ts-panel); border: 1px solid var(--ts-line);
  border-radius: 10px; padding: 8px 12px; backdrop-filter: blur(6px);
  display: flex; flex-direction: column; gap: 2px; }
.ts-lbl { font-size: 9px; letter-spacing: .18em; text-transform: uppercase;
  color: rgba(242, 231, 211, 0.5); }
.ts-score { font-family: var(--ts-serif); font-size: 30px; line-height: 1;
  color: var(--ts-cream); font-variant-numeric: tabular-nums; }
.ts-best { font-size: 10px; color: rgba(231, 184, 75, 0.8);
  font-variant-numeric: tabular-nums; }
.ts-next { align-items: center; padding: 6px 8px 4px; }
.ts-next canvas { width: 46px; height: 46px; }

/* ---- screens ---- */
.ts-screen { position: absolute; inset: auto; left: 50%; top: 50%;
  transform: translate(-50%, -50%); width: min(94%, 400px); max-height: 94%;
  overflow-y: auto; justify-content: flex-start;
  background: linear-gradient(180deg, rgba(30, 21, 15, 0.97), rgba(16, 11, 8, 0.98));
  border: 1px solid var(--ts-line); border-radius: 16px;
  font-family: var(--ts-serif); color: var(--ts-cream);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .6); z-index: 5; }
.ts-logo { text-align: center; margin: 0; }
.ts-logo span { display: block; font-size: 46px; letter-spacing: .14em;
  color: var(--ts-gold); line-height: 1.1; }
.ts-logo em { display: block; font-style: normal; font-family: Inter, system-ui, sans-serif;
  font-size: 9px; letter-spacing: .34em; color: rgba(242, 231, 211, 0.5); margin-top: 8px; }
.ts-logo.ts-small span { font-size: 34px; }
.ts-screen p { font-size: 15px; line-height: 1.55; text-align: center;
  color: rgba(242, 231, 211, 0.82); }
.ts-fine { font-size: 12px !important; color: rgba(242, 231, 211, 0.45) !important; }
.ts-ladder { width: 100%; overflow: hidden; }
.ts-ladder canvas { width: 100%; height: auto; display: block; }

.ts-btn-gold { background: var(--ts-gold); color: #2a1c07; border: 0;
  font-family: Inter, system-ui, sans-serif; font-weight: 700; font-size: 12px;
  letter-spacing: .14em; text-transform: uppercase; border-radius: 999px;
  padding: 13px 30px; }
.ts-screen .jg-btn { border-radius: 999px; font-family: Inter, system-ui, sans-serif;
  font-size: 12px; letter-spacing: .14em; }

.ts-stats { display: flex; gap: 10px; width: 100%; }
.ts-stat { flex: 1; background: rgba(255, 255, 255, .035);
  border: 1px solid var(--ts-line); border-radius: 12px; padding: 12px 6px;
  text-align: center; }
.ts-stat b { display: block; font-size: 22px; color: var(--ts-gold);
  font-variant-numeric: tabular-nums; }
.ts-stat span { font-family: Inter, system-ui, sans-serif; font-size: 8px;
  letter-spacing: .16em; text-transform: uppercase; color: rgba(242, 231, 211, 0.45); }
.ts-record { font-family: Inter, system-ui, sans-serif; font-size: 11px;
  letter-spacing: .16em; color: var(--ts-gold); text-align: center; }

.ts-initials { display: flex; flex-wrap: wrap; align-items: center;
  justify-content: center; gap: 8px; font-size: 13px; }
.ts-initials input { width: 4.6em; font-family: var(--ts-serif); font-size: 20px;
  letter-spacing: .3em; text-transform: uppercase; text-align: center;
  background: rgba(255, 255, 255, .05); color: var(--ts-gold);
  border: 1px solid var(--ts-line); border-radius: 10px; padding: 8px 4px; }
.ts-initials input:focus { outline: 2px solid var(--ts-gold); }

.ts-board { width: 100%; font-family: Inter, system-ui, sans-serif; font-size: 12px;
  background: rgba(255, 255, 255, .03); border: 1px solid var(--ts-line);
  border-radius: 12px; padding: 10px 12px; line-height: 1.9; }
.ts-board h3 { font-size: 8px; letter-spacing: .18em; text-transform: uppercase;
  color: rgba(242, 231, 211, 0.42); margin: 0 0 4px; font-weight: 600; }
.ts-board ol { list-style: none; margin: 0; padding: 0; }
.ts-board li { display: flex; gap: 10px; font-variant-numeric: tabular-nums; }
.ts-board li .r { color: rgba(242, 231, 211, 0.4); width: 1.6em; }
.ts-board li .n { letter-spacing: .16em; }
.ts-board li .s { margin-left: auto; color: var(--ts-gold); }
.ts-board li.me { color: var(--ts-gold); }
.ts-board .empty { color: rgba(242, 231, 211, 0.35); }

@media (max-width: 430px) {
  .ts-logo span { font-size: 38px; }
  .ts-screen { gap: .7rem; padding: 1rem; }
  .ts-screen p { font-size: 14px; }
}
