:root {
  --bg: #0e1116; --bg-2: #161b22; --surface: #1c2230; --surface-2: #232b3a; --border: #2b3242;
  --text: #e6e9ef; --text-muted: #8b93a7; --accent: #ff9d3a; --accent-2: #ffb865;
  --g: #4ade80; --y: #e5b53a; --r: #eb4b4b;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  background: radial-gradient(1200px 500px at 50% -100px, #1a2130, var(--bg)) fixed;
  color: var(--text); min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
.wrap { width: 100%; max-width: 780px; margin: 0 auto; padding: 0 1rem; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 1rem; margin-bottom: 1rem; }
.muted, .sub { color: var(--text-muted); }

header { border-bottom: 1px solid var(--border); background: rgba(14,17,22,.85); backdrop-filter: blur(6px); position: sticky; top: 0; z-index: 20; }
.header-inner { display: flex; align-items: center; justify-content: space-between; padding: .8rem 1rem; }
h1 { font-size: 1.25rem; font-weight: 750; }
h1::before { content: "🔫 "; }
.hstats { display: flex; align-items: center; gap: 1rem; font-size: .9rem; }
.hstats b { color: var(--text); }
.mode { display: flex; gap: .25rem; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: .2rem; }
.mtab { font: inherit; cursor: pointer; background: transparent; border: none; color: var(--text-muted); padding: .3rem .7rem; border-radius: 6px; font-size: .82rem; }
.mtab.active { background: var(--surface-2); color: var(--text); font-weight: 700; }

main { padding: 1.25rem 0 3rem; }
.sub { text-align: center; margin-bottom: 1rem; font-size: .95rem; }

.mystery { text-align: center; padding: 1.25rem; }
.mystery img { width: 340px; max-width: 88%; height: 200px; object-fit: contain; filter: blur(var(--blur, 16px)) brightness(.9); transition: filter .5s ease; }
.mystery img.revealed { filter: none; }
.guesses-left { margin-top: .5rem; color: var(--text-muted); font-size: .9rem; }

.guess-box { position: relative; }
#guess-input { width: 100%; background: var(--bg-2); border: 1px solid var(--border); color: var(--text); border-radius: 8px; padding: .7rem .9rem; font: inherit; }
#guess-input:focus { outline: none; border-color: var(--accent); }
.autocomplete { position: absolute; left: 1rem; right: 1rem; top: calc(100% - .5rem); background: var(--surface-2); border: 1px solid var(--border); border-radius: 0 0 10px 10px; z-index: 10; max-height: 300px; overflow-y: auto; }
.autocomplete:empty { display: none; }
.ac-item { display: flex; align-items: center; gap: .6rem; padding: .45rem .7rem; cursor: pointer; border-top: 1px solid var(--border); }
.ac-item:hover, .ac-item.active { background: var(--bg-2); }
.ac-item img { width: 42px; height: 30px; object-fit: contain; }
.ac-item .acn { font-size: .85rem; }
.ac-item .acs { font-size: .7rem; color: var(--text-muted); }

.legend { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; justify-content: center; font-size: .72rem; color: var(--text-muted); margin-bottom: .75rem; }
.legend > span:nth-child(-n+6) { display: none; }
.lg { display: inline-flex; align-items: center; gap: .3rem; }
.sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.sw.g { background: var(--g); } .sw.y { background: var(--y); } .sw.r { background: var(--r); }

.guesses { display: flex; flex-direction: column; gap: .4rem; }
.grow { display: grid; grid-template-columns: 46px 1.6fr 1fr .9fr 1.4fr .8fr; gap: .3rem; align-items: stretch; }
.gcell { border-radius: 7px; padding: .35rem .4rem; font-size: .74rem; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; line-height: 1.15; min-height: 46px; border: 1px solid var(--border); background: var(--bg-2); }
.gcell.skin { padding: 2px; }
.gcell.skin img { width: 100%; height: 40px; object-fit: contain; }
.gcell.g { background: rgba(74,222,128,.18); border-color: var(--g); }
.gcell.y { background: rgba(229,181,58,.18); border-color: var(--y); }
.gcell.r { background: rgba(235,75,75,.16); border-color: var(--r); }
.gcell .arw { font-size: 1rem; font-weight: 700; }
.gcell .lbl { font-size: .58rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.grow.header .gcell { background: transparent; border: none; min-height: 0; padding: 0 0 .1rem; color: var(--text-muted); font-size: .6rem; text-transform: uppercase; letter-spacing: .05em; }
.grow.pop { animation: pop .3s ease; }
@keyframes pop { from { transform: scale(.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.endgame { text-align: center; }
.endgame.win h2 { color: var(--g); } .endgame.lose h2 { color: var(--r); }
.endgame img { width: 260px; max-width: 80%; height: 150px; object-fit: contain; }
.endgame h2 { font-size: 1.3rem; margin: .3rem 0; }
.endgame .en-name { font-size: 1.05rem; font-weight: 700; }
.endgame .en-sub { color: var(--text-muted); font-size: .85rem; margin-bottom: .6rem; }
.share-grid { font-size: 1.1rem; letter-spacing: 2px; margin: .5rem 0; }
.btn { font: inherit; cursor: pointer; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); padding: .55rem 1.1rem; margin: .3rem; }
.btn.primary { background: var(--accent); color: #10131a; border-color: var(--accent); font-weight: 700; }
.btn:hover { border-color: var(--accent); }
.next-in { color: var(--text-muted); font-size: .8rem; margin-top: .4rem; }

footer { color: var(--text-muted); font-size: .78rem; padding: 1.5rem 1rem 2.5rem; text-align: center; }
footer a { color: var(--accent); text-decoration: none; }
footer a:hover { text-decoration: underline; }

@media (max-width: 560px) {
  .grow { grid-template-columns: 40px 1.4fr .9fr .8fr 1.2fr .7fr; }
  .gcell { font-size: .66rem; }
}
