:root {
  --ink: #18202a;
  --muted: #68727d;
  --paper: #f6f3ed;
  --white: #fff;
  --red: #e63b3b;
  --red-dark: #bb252d;
  --yellow: #f4ca45;
  --blue: #2674c8;
  --green: #2a9d67;
  --line: #d8d4cc;
  --shadow: 0 14px 30px rgba(35, 31, 25, .13);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--paper); }
body { margin: 0; color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
.hidden { display: none !important; }

.site-header { height: 76px; display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(20px, 5vw, 72px); border-bottom: 1px solid var(--line); background: rgba(246, 243, 237, .96); position: relative; z-index: 10; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-size: 20px; font-weight: 900; letter-spacing: 0; }
.brand strong { color: var(--red); }
.brand-ball { width: 29px; height: 29px; display: inline-block; border: 3px solid var(--ink); border-radius: 50%; background: linear-gradient(to bottom, var(--red) 0 43%, var(--ink) 43% 57%, var(--white) 57%); position: relative; flex: none; }
.brand-ball::after { content: ""; position: absolute; width: 7px; height: 7px; left: 8px; top: 8px; background: var(--white); border: 2px solid var(--ink); border-radius: 50%; }
.room-badge { font-size: 13px; font-weight: 800; background: var(--white); border: 1px solid var(--line); padding: 8px 12px; border-radius: 4px; }

.home-shell { min-height: calc(100vh - 160px); display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, .9fr); align-items: center; gap: 5vw; padding: 50px clamp(24px, 7vw, 110px) 36px; overflow: hidden; }
.home-copy { max-width: 660px; position: relative; z-index: 2; }
.eyebrow { margin: 0 0 14px; color: var(--red-dark); font-size: 12px; font-weight: 900; letter-spacing: 1.6px; }
.home-copy h1 { margin: 0; font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif; font-size: clamp(64px, 8vw, 118px); line-height: .86; font-weight: 900; text-transform: uppercase; letter-spacing: 0; }
.home-copy h1 span { color: var(--red); }
.intro { max-width: 560px; margin: 28px 0 34px; font-size: 18px; line-height: 1.6; color: #47515a; }
.create-form label, .stack-form label { display: block; margin-bottom: 8px; font-size: 12px; font-weight: 800; text-transform: uppercase; }
.create-grid { max-width: 680px; display: grid; grid-template-columns: minmax(150px, 1.15fr) minmax(170px, .9fr) 170px; align-items: end; gap: 9px; }
.form-field { min-width: 0; }
input, select { min-width: 0; height: 54px; padding: 0 16px; color: var(--ink); background: var(--white); border: 1px solid #c8c5be; border-radius: 4px; outline: none; }
select { width: 100%; cursor: pointer; }
.form-field input { width: 100%; }
input:focus, select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(38, 116, 200, .14); }
.button { min-height: 50px; display: inline-flex; align-items: center; justify-content: center; gap: 14px; padding: 0 20px; border: 0; border-radius: 4px; font-weight: 850; text-decoration: none; transition: transform .15s, background .15s; }
.button:hover { transform: translateY(-1px); }
.button-primary { color: var(--white); background: var(--red); box-shadow: 0 8px 18px rgba(190, 37, 45, .2); }
.button-primary:hover { background: var(--red-dark); }
.button-dark { color: var(--white); background: var(--ink); width: 100%; }
.create-grid .button { height: 54px; padding-inline: 14px; gap: 8px; white-space: nowrap; }
.no-login { color: var(--muted); font-size: 12px; margin: 12px 0 0; }

.hero-stage { min-height: 510px; position: relative; display: grid; place-items: center; }
.hero-stage::before { content: ""; position: absolute; width: 460px; height: 460px; border-radius: 50%; background: var(--yellow); border: 2px solid var(--ink); box-shadow: 18px 18px 0 var(--blue); }
.hero-card { width: 270px; height: 390px; border: 5px solid var(--ink); border-radius: 8px; position: absolute; box-shadow: var(--shadow); }
.hero-card-back { transform: rotate(-10deg) translate(-75px, 5px); background: var(--blue); }
.hero-card-front { transform: rotate(6deg) translate(38px, -8px); display: grid; place-items: center; overflow: hidden; background: var(--white); }
.hero-card-front::before { content: ""; position: absolute; inset: 12px; border: 3px solid var(--red); border-radius: 4px; }
.hero-card-front img { width: 250px; position: relative; z-index: 2; filter: drop-shadow(0 10px 5px rgba(0,0,0,.14)); }
.hero-card-front span { position: absolute; right: 10px; top: -22px; z-index: 3; color: var(--red); font: 900 92px Impact, sans-serif; transform: rotate(8deg); }
.hero-burst { position: absolute; inset: 56px 24px; border-radius: 50%; background: var(--yellow); }
.how-band { min-height: 84px; display: grid; grid-template-columns: repeat(3, 1fr); align-items: stretch; border-top: 1px solid var(--ink); background: var(--ink); color: var(--white); padding: 0 clamp(24px, 7vw, 110px); }
.how-band div { display: flex; align-items: center; gap: 15px; padding: 20px 3vw; border-right: 1px solid #404750; }
.how-band div:last-child { border: 0; }
.how-band b { color: var(--yellow); font-size: 13px; }
.how-band span { font-weight: 750; }

.center-panel { min-height: calc(100vh - 76px); max-width: 620px; margin: auto; padding: 80px 24px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.center-panel h1 { margin: 0 0 12px; font: 900 clamp(42px, 7vw, 70px)/.95 Impact, sans-serif; text-transform: uppercase; }
.center-panel > p:not(.eyebrow):not(.waiting-note) { color: var(--muted); margin: 0 0 30px; }
.join-mark { margin-bottom: 28px; transform: scale(2); }
.stack-form { width: 100%; max-width: 400px; text-align: left; }
.stack-form input, .stack-form .button { width: 100%; margin-bottom: 12px; }
.text-link { margin-top: 22px; color: var(--ink); font-size: 13px; font-weight: 750; }
.radar { width: 102px; height: 102px; border: 2px solid var(--ink); border-radius: 50%; position: relative; margin-bottom: 30px; background: repeating-radial-gradient(circle, transparent 0 15px, rgba(24,32,42,.08) 16px 17px); overflow: hidden; }
.radar::before, .radar::after { content: ""; position: absolute; background: var(--ink); opacity: .25; }
.radar::before { width: 1px; height: 100%; left: 50%; }.radar::after { height: 1px; width: 100%; top: 50%; }
.radar span { position: absolute; inset: 50% 0 0 50%; background: conic-gradient(from 270deg, rgba(230,59,59,.65), transparent 25%); transform-origin: 0 0; animation: scan 2s linear infinite; }
@keyframes scan { to { transform: rotate(360deg); } }
.share-box { display: flex; width: 100%; max-width: 530px; }
.share-box input { flex: 1; border-radius: 4px 0 0 4px; color: #3e4851; }
.icon-button { width: 54px; border: 0; border-radius: 0 4px 4px 0; color: var(--white); background: var(--ink); font-size: 24px; }
.waiting-note { margin-top: 16px; font-size: 12px; color: var(--muted); }
.waiting-note span { width: 7px; height: 7px; display: inline-block; margin-right: 6px; border-radius: 50%; background: var(--green); animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: .3; } }

.game-shell { min-height: calc(100vh - 76px); display: grid; grid-template-columns: 290px minmax(0, 1fr); }
.game-sidebar { padding: 26px 24px; background: var(--white); border-right: 1px solid var(--line); }
.secret-panel { border-bottom: 1px solid var(--line); padding-bottom: 24px; }
.secret-card { display: grid; grid-template-columns: 76px 1fr; align-items: center; gap: 12px; }
.secret-card img { width: 76px; height: 76px; object-fit: contain; background: var(--yellow); border: 2px solid var(--ink); border-radius: 4px; }
.secret-card strong { display: block; font-size: 20px; }
.secret-card span { color: var(--muted); font-size: 12px; }
.turn-panel { padding: 24px 0; border-bottom: 1px solid var(--line); }
.turn-heading { display: flex; align-items: center; gap: 8px; }
.turn-heading span { width: 9px; height: 9px; border-radius: 50%; background: var(--green); }
.turn-panel p { color: var(--muted); font-size: 13px; line-height: 1.5; margin: 8px 0 0; }
.question-panel { padding: 24px 0; }
.question-panel label { display: block; font-size: 12px; font-weight: 850; margin-bottom: 8px; }
.question-panel textarea { width: 100%; min-height: 90px; resize: vertical; padding: 12px; border: 1px solid var(--line); border-radius: 4px; font: inherit; }
.question-panel .button { width: 100%; margin-top: 8px; }
.question-card { border-left: 3px solid var(--red); padding: 4px 0 4px 14px; }
.question-card span { display: block; color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.question-card p { margin: 6px 0; line-height: 1.45; }
.answer-buttons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 14px; }
.answer-buttons button { min-height: 40px; border: 1px solid var(--line); border-radius: 4px; background: var(--paper); font-size: 12px; font-weight: 800; }
.answer-pill { display: inline-block; padding: 5px 9px; border-radius: 3px; color: var(--white); background: var(--blue); font-size: 12px; font-weight: 900; text-transform: uppercase; }
.history-panel { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.history-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; color: var(--muted); font-size: 11px; font-weight: 850; text-transform: uppercase; }
.history-heading strong { min-width: 22px; padding: 3px 6px; color: var(--white); background: var(--ink); border-radius: 3px; text-align: center; }
.history-list { max-height: 240px; overflow-y: auto; padding-right: 5px; scrollbar-width: thin; }
.history-entry { padding: 10px 0; border-bottom: 1px solid var(--line); }
.history-entry:first-child { padding-top: 0; }
.history-entry:last-child { border-bottom: 0; }
.history-entry p { margin: 0 0 7px; font-size: 12px; line-height: 1.4; }
.history-answer { display: inline-block; padding: 3px 7px; color: var(--white); background: var(--blue); border-radius: 3px; font-size: 10px; font-weight: 900; text-transform: uppercase; }
.history-answer-no { background: var(--red); }
.history-answer-unsure { color: var(--ink); background: var(--yellow); }
.board-area { min-width: 0; padding: 26px clamp(18px, 3vw, 44px) 50px; }
.board-header { display: flex; justify-content: space-between; align-items: end; margin-bottom: 22px; }
.board-header h1 { margin: 0; font: 900 36px/1 Impact, sans-serif; text-transform: uppercase; }
.remaining-count { font-size: 13px; color: var(--muted); font-weight: 700; }
.remaining-count strong { color: var(--ink); font-size: 24px; }
.pokemon-grid { display: grid; grid-template-columns: repeat(6, minmax(105px, 1fr)); gap: 12px; }
.pokemon-card { aspect-ratio: .78; min-width: 0; position: relative; padding: 6px; overflow: hidden; background: var(--white); border: 2px solid var(--ink); border-radius: 5px; box-shadow: 3px 3px 0 var(--ink); transition: transform .15s, opacity .2s; }
.pokemon-card:hover { transform: translateY(-3px); }
.pokemon-card img { width: 100%; height: calc(100% - 28px); object-fit: contain; background: #e9eef1; border-radius: 2px; }
.pokemon-card strong { display: block; overflow: hidden; padding: 5px 1px 0; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; text-align: left; }
.pokemon-card small { position: absolute; top: 9px; right: 9px; color: var(--muted); font-size: 9px; font-weight: 800; }
.pokemon-card.eliminated { opacity: .35; box-shadow: none; transform: scale(.97); }
.pokemon-card.eliminated::after { content: "×"; position: absolute; inset: 0; display: grid; place-items: center; color: var(--red); font: 900 76px/1 Impact, sans-serif; background: rgba(246,243,237,.35); }
.pokemon-card.guessable:not(.eliminated) { border-color: var(--red); box-shadow: 3px 3px 0 var(--red); }
.guess-hint { margin: 0 0 14px; color: var(--red-dark); font-size: 13px; font-weight: 800; }

.result-overlay { min-height: calc(100vh - 76px); display: grid; place-items: center; padding: 24px; background: var(--yellow); }
.result-card { width: min(520px, 100%); padding: 40px; text-align: center; background: var(--white); border: 3px solid var(--ink); border-radius: 6px; box-shadow: 12px 12px 0 var(--ink); }
.result-card h1 { margin: 0; font: 900 clamp(48px, 9vw, 82px)/.9 Impact, sans-serif; text-transform: uppercase; }
.result-pokemon { margin: 18px auto; }
.result-pokemon img { width: 190px; height: 190px; object-fit: contain; }
.result-pokemon strong { display: block; font-size: 24px; }
.result-card > p:not(.eyebrow) { color: var(--muted); margin-bottom: 24px; }
.result-history { margin: 0 auto 24px; max-width: 390px; text-align: left; }
.result-history .history-list { max-height: 180px; }

.toast { position: fixed; right: 20px; bottom: 20px; z-index: 100; padding: 12px 16px; color: var(--white); background: var(--ink); border-radius: 4px; box-shadow: var(--shadow); font-size: 13px; font-weight: 700; opacity: 0; transform: translateY(10px); pointer-events: none; transition: .2s; }
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 1050px) {
  .pokemon-grid { grid-template-columns: repeat(4, minmax(105px, 1fr)); }
  .home-shell { grid-template-columns: 1fr .7fr; }
  .hero-stage { transform: scale(.8); margin: 0 -70px; }
}

@media (max-width: 760px) {
  .site-header { height: 64px; padding: 0 16px; }
  .home-shell { min-height: auto; display: block; padding: 46px 20px 40px; }
  .home-copy h1 { font-size: clamp(60px, 20vw, 86px); }
  .intro { font-size: 16px; margin: 24px 0 28px; }
  .hero-stage { min-height: 380px; transform: scale(.72); margin: -30px 0 -40px; }
  .how-band { grid-template-columns: 1fr; padding: 0 20px; }
  .how-band div { border-right: 0; border-bottom: 1px solid #404750; padding: 17px 0; }
  .create-grid { grid-template-columns: 1fr; }
  .create-grid .button { width: 100%; margin-top: 3px; }
  .game-shell { display: block; }
  .game-sidebar { position: relative; padding: 18px; border-right: 0; border-bottom: 1px solid var(--line); }
  .secret-panel { padding: 0 0 16px; }
  .secret-card { grid-template-columns: 58px 1fr; }
  .secret-card img { width: 58px; height: 58px; }
  .turn-panel { padding: 16px 0; }
  .question-panel { padding: 16px 0; }
  .history-panel { margin-top: 18px; padding-top: 16px; }
  .history-list { max-height: 180px; }
  .board-area { padding: 22px 12px 40px; }
  .board-header h1 { font-size: 27px; }
  .pokemon-grid { grid-template-columns: repeat(3, minmax(82px, 1fr)); gap: 8px; }
  .pokemon-card { box-shadow: 2px 2px 0 var(--ink); }
  .pokemon-card strong { font-size: 10px; }
  .center-panel { min-height: calc(100vh - 64px); padding-top: 50px; }
  .result-overlay { min-height: calc(100vh - 64px); }
  .result-card { padding: 32px 20px; box-shadow: 7px 7px 0 var(--ink); }
}

@media (max-width: 380px) {
  .pokemon-grid { grid-template-columns: repeat(2, minmax(110px, 1fr)); }
  .room-badge { font-size: 11px; }
}
