:root {
  --bg: #16161b;
  --panel: #23242c;
  --panel2: #2d2f39;
  --line: #3b3d4a;
  --text: #f6f6f8;
  --sub: #a9abb8;
  --accent: #ffd84d;
  --ok: #4ade80;
  --ng: #ff6b6b;
  --font: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); }
button { font: inherit; cursor: pointer; border: 0; }
button:disabled { cursor: default; opacity: .35; }
[hidden] { display: none !important; }

.tier { display: grid; grid-template-rows: repeat(var(--rows), minmax(0, 1fr)); gap: 6px; min-height: 0; }
.tier-row { display: grid; grid-template-columns: var(--label-w, 150px) minmax(0, 1fr); border-radius: 10px; overflow: hidden; background: var(--panel); min-height: 0; transition: opacity .2s, outline-color .2s; outline: 4px solid transparent; outline-offset: -4px; }
.tier-label { display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: var(--label-fs, 44px); letter-spacing: -.02em; }
.tier-words { display: flex; flex-wrap: wrap; align-content: center; gap: 8px; padding: 8px 12px; overflow: hidden; font-size: var(--chip-fs, 28px); min-width: 0; }
.chip { background: #fff; color: #222; border-radius: 999px; padding: .12em .7em; font-weight: 700; line-height: 1.35; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip.start { background: #dfe3ee; box-shadow: inset 0 0 0 3px #8e96ad; }
.chip.miss { background: #ffe1e1; box-shadow: inset 0 0 0 3px var(--ng); }
.chip.hidden { display: none; }
.chip.more { background: var(--panel2); color: var(--sub); }
.chip.pop { animation: pop .7s ease-out; }
.tier-row.hl { outline-color: var(--accent); background: #3d3920; }
.tier-row.sel { outline-color: #fff; background: #3a3f55; }
.tier-row.elim { opacity: .25; }
.tier-row.new { animation: slidein .8s ease-out; }
.tier-row.pickable { cursor: pointer; }
@keyframes pop { 0% { transform: scale(.2); } 60% { transform: scale(1.25); } 100% { transform: scale(1); } }
@keyframes slidein { from { transform: translateX(-110%); } to { transform: none; } }

.dialog { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; z-index: 50; }
.dialog-box { background: var(--panel); border-radius: 20px; padding: 36px 40px; max-width: min(820px, 92vw); text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.dialog-text { font-size: 30px; font-weight: 700; margin: 0 0 28px; overflow-wrap: anywhere; }
.dialog-btns { display: flex; gap: 16px; justify-content: center; }
.btn { background: var(--panel2); color: var(--text); border-radius: 14px; padding: 14px 28px; font-weight: 800; font-size: 24px; }
.btn.primary { background: var(--accent); color: #222; }
