/* AI DUO ARENA α — 静かだけど緊張感がある */
:root {
  --bg: #0b0c0f;
  --surface: #13151a;
  --surface-2: #1a1d24;
  --line: #262a33;
  --text: #eceef2;
  --muted: #8b909c;
  --blue: #4d8dff;
  --blue-dim: rgba(77, 141, 255, .14);
  --red: #ff4f5a;
  --red-dim: rgba(255, 79, 90, .14);
  --gold: #e3c068;
  --good: #5fd39a;
  --warn: #f0b44c;
  --bad: #ff6b6b;
  --display: "Avenir Next Condensed", "Arial Narrow", "Roboto Condensed", "sans-serif-condensed", "Helvetica Neue", Arial, sans-serif;
  --body: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", Meiryo, sans-serif;
  --radius: 10px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
[hidden] { display: none !important; }

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 16px calc(32px + env(safe-area-inset-bottom));
}

/* ---------- typography ---------- */
.eyebrow {
  font-family: var(--display);
  font-weight: 600;
  letter-spacing: .24em;
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 6px;
  text-transform: uppercase;
}
.eyebrow a { text-decoration: none; }
.center { text-align: center; }
.h-title {
  font-family: var(--display);
  font-weight: 800;
  font-size: 40px;
  letter-spacing: .04em;
  line-height: 1.05;
  margin: 0 0 12px;
}
.lead { color: var(--muted); margin: 0 0 20px; }
.hint { color: var(--muted); font-size: 14px; margin: 8px 0 0; }
.c-blue { color: var(--blue); }
.c-red { color: var(--red); }

/* ---------- buttons ---------- */
.btn {
  -webkit-appearance: none;
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  border-radius: var(--radius);
  padding: 12px 18px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: .12em;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s, border-color .15s, opacity .15s;
  touch-action: manipulation;
}
.btn:disabled { opacity: .35; cursor: default; }
.btn-xl { width: 100%; min-height: 58px; font-size: 20px; }
.btn-sm { padding: 8px 12px; font-size: 13px; letter-spacing: .06em; font-family: var(--body); font-weight: 600; }
.btn-blue { background: var(--blue); border-color: var(--blue); color: #06122b; }
.btn-red { background: var(--red); border-color: var(--red); color: #2b0609; }
.btn-ghost { background: transparent; }
.btn-gold { background: var(--gold); border-color: var(--gold); color: #1d1606; }
.btn-submit { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn-ready.is-on { background: var(--good); border-color: var(--good); color: #062014; }
.btn-start:not(:disabled) { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn-next { background: var(--text); color: var(--bg); border-color: var(--text); }
.linkish {
  background: none; border: 0; padding: 0; color: var(--muted);
  text-decoration: underline; font: inherit; font-size: 13px; cursor: pointer;
}

/* ---------- home ---------- */
.home { padding-top: 8vh; }
.hero { text-align: center; margin-bottom: 40px; }
.logo {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(54px, 17vw, 96px);
  line-height: .92;
  letter-spacing: .02em;
  margin: 0;
}
.logo span { display: block; }
.logo span:first-child { color: var(--blue); }
.logo span:last-child { color: var(--red); }
.tagline {
  font-family: var(--display);
  font-size: 22px;
  letter-spacing: .14em;
  margin: 18px 0 0;
}
.tagline-ja { color: var(--muted); margin: 4px 0 0; }
.home-actions { display: grid; gap: 12px; margin-bottom: 40px; }
.howto { list-style: none; counter-reset: s; padding: 0; margin: 0; border-top: 1px solid var(--line); }
.howto li { counter-increment: s; padding: 14px 0 14px 40px; border-bottom: 1px solid var(--line); position: relative; color: var(--muted); font-size: 15px; }
.howto li::before {
  content: counter(s, decimal-leading-zero);
  position: absolute; left: 0; top: 14px;
  font-family: var(--display); font-weight: 700; color: var(--text); letter-spacing: .08em;
}
.howto b { color: var(--text); display: block; }

/* ---------- forms ---------- */
.form-page { padding-top: 16px; }
.stack { display: grid; gap: 18px; }
.field { display: grid; gap: 6px; border: 0; padding: 0; margin: 0; min-width: 0; position: relative; }
.field-label {
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: .16em;
  font-size: 14px;
  padding: 0;
}
.field-label small { font-family: var(--body); letter-spacing: 0; color: var(--muted); font-weight: 400; margin-left: 6px; }
input[type=text], input[type=number], select, textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  font: inherit;
  font-size: 18px; /* iOSでズームしない大きさ */
  padding: 12px 14px;
}
textarea { resize: vertical; line-height: 1.6; min-height: 140px; }
select { -webkit-appearance: none; appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 36px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--text); outline-offset: 1px; border-color: transparent; }
.input-code { font-family: var(--display); font-size: 28px; letter-spacing: .3em; text-transform: uppercase; text-align: center; }
.counter { justify-self: end; font-size: 13px; color: var(--muted); }
.counter.over { color: var(--bad); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips-3 { display: grid; grid-template-columns: repeat(3, 1fr); }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
  display: block; text-align: center;
  padding: 10px 16px; border: 1px solid var(--line); border-radius: 999px;
  font-weight: 600; cursor: pointer; min-width: 64px;
}
.chip input:checked + span { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip-blue input:checked + span { background: var(--blue); border-color: var(--blue); color: #06122b; }
.chip-red input:checked + span { background: var(--red); border-color: var(--red); color: #2b0609; }
.chip input:focus-visible + span { outline: 2px solid var(--text); outline-offset: 2px; }

.venues { display: grid; gap: 8px; }
.venue-card { position: relative; display: block; }
.venue-card input { position: absolute; opacity: 0; }
.venue-card-body { display: block; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; cursor: pointer; }
.venue-card-name { display: block; font-family: var(--display); font-weight: 800; font-size: 22px; letter-spacing: .08em; }
.venue-card-sub { display: block; color: var(--muted); font-size: 14px; }
.venue-card input:checked + .venue-card-body { border-color: var(--text); background: var(--surface-2); box-shadow: inset 4px 0 0 var(--text); }
.venue-card input:focus-visible + .venue-card-body { outline: 2px solid var(--text); }

.alert { background: rgba(255, 107, 107, .1); border: 1px solid rgba(255, 107, 107, .4); color: #ffc9c9; border-radius: var(--radius); padding: 10px 14px; margin: 0 0 16px; font-size: 15px; }
.alert p { margin: 0; }
.notice { padding-top: 15vh; }
.invite-card { border: 1px solid var(--line); border-left: 4px solid var(--blue); border-radius: var(--radius); padding: 12px 16px; margin: 0 0 16px; }
.invite-venue { font-family: var(--display); font-weight: 800; letter-spacing: .1em; font-size: 20px; margin: 0; }
.invite-from { margin: 0; color: var(--muted); font-size: 15px; }
.check { display: flex; gap: 10px; align-items: center; font-size: 15px; color: var(--muted); }
.check input { width: 20px; height: 20px; }

/* ---------- top bar ---------- */
.topbar { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.brand { font-family: var(--display); font-weight: 800; letter-spacing: .14em; font-size: 14px; text-decoration: none; margin-right: auto; white-space: nowrap; }
.room-chip, .round-chip { white-space: nowrap; font-family: var(--display); font-size: 13px; letter-spacing: .14em; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; }
.room-chip b, .round-chip b { color: var(--text); }

/* ---------- lobby ---------- */
.venue-head { text-align: center; margin-bottom: 20px; }
.venue-name { font-family: var(--display); font-weight: 800; font-size: 44px; letter-spacing: .06em; line-height: 1; margin: 0; }
.venue-sub { color: var(--muted); margin: 6px 0 0; font-size: 14px; }
.invite { text-align: center; border: 1px dashed var(--line); border-radius: var(--radius); padding: 18px 16px; margin-bottom: 20px; }
.big-code { font-family: var(--display); font-weight: 800; font-size: 54px; letter-spacing: .22em; margin: 0; line-height: 1.1; padding-left: .22em; }
.share-url { font-size: 13px; color: var(--muted); word-break: break-all; margin: 6px 0 12px; }

.corners { display: grid; grid-template-columns: 1fr auto 1fr; align-items: stretch; gap: 8px; margin-bottom: 20px; }
.corner { border-radius: var(--radius); padding: 14px 12px; min-height: 140px; display: flex; flex-direction: column; }
.corner-blue { background: var(--blue-dim); border-top: 3px solid var(--blue); }
.corner-red { background: var(--red-dim); border-top: 3px solid var(--red); text-align: right; }
.corner-tag { font-family: var(--display); font-weight: 700; letter-spacing: .16em; font-size: 12px; margin: 0; }
.corner-blue .corner-tag { color: var(--blue); }
.corner-red .corner-tag { color: var(--red); }
.corner-name { font-weight: 800; font-size: 22px; line-height: 1.25; margin: 8px 0 0; word-break: break-all; }
.corner-ai { color: var(--muted); font-size: 14px; margin: 2px 0 0; word-break: break-all; }
.corner-ready { margin-top: auto; padding-top: 10px; font-family: var(--display); letter-spacing: .14em; font-size: 14px; color: var(--muted); }
.corner-ready.on { color: var(--good); }
.corner.empty .corner-name { color: var(--muted); font-weight: 400; font-size: 15px; }
.vs { align-self: center; font-family: var(--display); font-weight: 800; font-size: 22px; color: var(--muted); letter-spacing: .1em; }
.lobby-actions { display: grid; gap: 10px; margin: 20px 0; }
.lobby-actions .hint { text-align: center; }
.resume-line { margin-top: 28px; font-size: 12px; color: var(--muted); display: grid; gap: 2px; }

/* ---------- panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.panel-title { font-family: var(--display); font-weight: 700; letter-spacing: .2em; font-size: 13px; color: var(--muted); margin: 0 0 8px; }
.mission-text { margin: 0; font-weight: 600; }
.brief-list { margin: 10px 0 0; padding-left: 1.2em; color: var(--muted); font-size: 15px; }
.brief-list li { margin: 2px 0; }
.mission-panel summary { cursor: pointer; list-style: none; }
.mission-panel summary::-webkit-details-marker { display: none; }
.mission-panel summary .panel-title { display: block; }
.mission-panel summary::after { content: "詳細 ▾"; display: block; font-size: 12px; color: var(--muted); margin-top: 4px; }
.mission-panel[open] summary::after { content: "閉じる ▴"; }

/* ---------- scoreboard ---------- */
.scoreboard { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: stretch; margin-bottom: 6px; }
.sb-side { border-radius: var(--radius); padding: 10px 12px; min-width: 0; }
.sb-blue { background: var(--blue-dim); border-left: 3px solid var(--blue); }
.sb-red { background: var(--red-dim); border-right: 3px solid var(--red); text-align: right; }
.sb-tag { font-family: var(--display); font-weight: 800; letter-spacing: .18em; font-size: 12px; margin: 0; }
.sb-blue .sb-tag { color: var(--blue); }
.sb-red .sb-tag { color: var(--red); }
.sb-name { font-weight: 800; margin: 0; line-height: 1.3; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-ai { margin: 0; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-status { margin: 6px 0 0; font-family: var(--display); font-weight: 700; letter-spacing: .04em; font-size: 12px; white-space: nowrap; color: var(--muted); }
.sb-status.done { color: var(--good); }
.sb-status.thinking { animation: breathe 1.8s ease-in-out infinite; }
.sb-me .sb-name::after { content: " (YOU)"; font-size: 11px; color: var(--muted); font-weight: 600; }
.sb-mid { text-align: center; align-self: center; min-width: 88px; }
.sb-round { font-family: var(--display); font-weight: 800; font-size: 18px; letter-spacing: .1em; margin: 0; }
.sb-label { margin: 0; font-size: 12px; color: var(--muted); }
.sb-timer { font-family: var(--display); font-weight: 700; font-size: 26px; letter-spacing: .06em; margin: 2px 0 0; font-variant-numeric: tabular-nums; }
.sb-timer.low { color: var(--warn); }
.sb-timer.over { color: var(--bad); font-size: 16px; }
.timebar { height: 3px; background: var(--line); border-radius: 3px; overflow: hidden; margin-bottom: 14px; }
.timebar span { display: block; height: 100%; background: var(--text); width: 100%; transition: width 1s linear; }
@keyframes breathe { 50% { opacity: .35; } }

/* ---------- situation ---------- */
.sit-text { margin: 0 0 10px; color: var(--muted); font-size: 15px; }
.sit-speech { margin: 0 0 12px; }
.sit-speaker { font-size: 13px; color: var(--muted); margin: 0; }
.sit-line { font-size: 20px; font-weight: 700; line-height: 1.55; margin: 2px 0 0; white-space: pre-wrap; }
.sit-quote { border-left: 3px solid var(--line); padding: 4px 0 4px 12px; margin: 0 0 12px; }
.sit-quote.side-blue { border-color: var(--blue); }
.sit-quote.side-red { border-color: var(--red); }
.sit-quote p { margin: 0; white-space: pre-wrap; }
.sit-evidence { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin: 0 0 10px; font-size: 15px; }
.sit-evidence.new { border-color: var(--gold); }
.sit-evidence h3 { margin: 0 0 4px; font-size: 13px; letter-spacing: .08em; color: var(--muted); }
.sit-evidence.new h3 { color: var(--gold); }
.sit-evidence p { margin: 0; white-space: pre-wrap; }
.reaction { border-radius: 8px; padding: 10px 12px; margin: 0 0 12px; background: var(--surface-2); border-left: 3px solid var(--muted); }
.reaction p { margin: 0; white-space: pre-wrap; font-size: 15px; }
.badge { display: inline-block; font-size: 12px; font-weight: 700; border-radius: 4px; padding: 1px 8px; margin-bottom: 4px; background: var(--line); }
.tone-good { border-color: var(--good); } .tone-good .badge { background: var(--good); color: #062014; }
.tone-interest { border-color: var(--blue); } .tone-interest .badge { background: var(--blue); color: #06122b; }
.tone-wary { border-color: var(--warn); } .tone-wary .badge { background: var(--warn); color: #241703; }
.tone-price { border-color: #c98bff; } .tone-price .badge { background: #c98bff; color: #1d0730; }
.tone-distrust { border-color: var(--bad); } .tone-distrust .badge { background: var(--bad); color: #2b0609; }

/* ---------- answer ---------- */
.task { font-weight: 700; margin: 0 0 10px; }
.strategy { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; border: 1px dashed var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 14px; }
.strategy p { margin: 0; font-size: 14px; color: var(--muted); }
.strategy b { color: var(--text); font-family: var(--display); letter-spacing: .14em; }
.waiting-pane { text-align: center; padding: 28px 16px; }
.waiting-big { font-family: var(--display); font-weight: 800; font-size: 34px; letter-spacing: .1em; color: var(--good); margin: 0; }
.my-answer { text-align: left; margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; color: var(--muted); font-size: 15px; white-space: pre-wrap; }

/* ---------- open ---------- */
.open-title { font-family: var(--display); font-weight: 800; font-size: 46px; letter-spacing: .3em; text-align: center; margin: 4px 0 10px; padding-left: .3em; }
.open-pane.flash .open-title { animation: openin .6s ease-out; }
@keyframes openin { from { opacity: 0; letter-spacing: .8em; } to { opacity: 1; letter-spacing: .3em; } }
.open-grid { display: grid; gap: 12px; }
.open-card { border-radius: var(--radius); padding: 14px; background: var(--surface); border: 1px solid var(--line); }
.open-blue { border-top: 3px solid var(--blue); }
.open-red { border-top: 3px solid var(--red); }
.open-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; margin-bottom: 8px; }
.open-tag { font-family: var(--display); font-weight: 800; letter-spacing: .16em; font-size: 14px; }
.open-blue .open-tag { color: var(--blue); }
.open-red .open-tag { color: var(--red); }
.open-who { font-size: 13px; color: var(--muted); text-align: right; }
.open-text { margin: 0 0 10px; white-space: pre-wrap; font-size: 16px; }
.late { color: var(--warn); font-size: 12px; font-weight: 700; }
.next-area { margin-top: 16px; }
.next-area .hint { text-align: center; }
@media (min-width: 680px) { .open-grid { grid-template-columns: 1fr 1fr; } }

/* ---------- result ---------- */
.winner { text-align: center; padding: 28px 0 24px; }
.winner-label { font-family: var(--display); font-weight: 700; letter-spacing: .4em; color: var(--gold); margin: 0; padding-left: .4em; }
.winner-corner { font-family: var(--display); font-weight: 800; font-size: clamp(44px, 14vw, 72px); line-height: 1; margin: 6px 0 0; letter-spacing: .04em; }
.winner-corner.blue { color: var(--blue); }
.winner-corner.red { color: var(--red); }
.winner-names { font-size: 22px; font-weight: 800; margin: 10px 0 0; }
.winner-score { font-family: var(--display); font-size: 30px; font-weight: 700; letter-spacing: .08em; margin: 12px 0 0; }
.winner-score .b { color: var(--blue); } .winner-score .r { color: var(--red); }
.winner-judge { color: var(--muted); font-size: 14px; margin: 4px 0 0; }
.judge-comment { text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin: 18px 0 0; white-space: pre-wrap; font-size: 15px; }
.judge-steps { margin: 0 0 12px; padding-left: 1.3em; color: var(--muted); font-size: 15px; }
.judge-panel .btn-gold { margin: 12px 0 8px; }
.packet-preview summary { color: var(--muted); font-size: 14px; cursor: pointer; }
.packet-preview textarea { font-size: 13px; margin-top: 8px; }
.judge-form { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 18px; }
.score-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hist-round { border-top: 1px solid var(--line); padding: 14px 0; }
.hist-round:first-child { border-top: 0; padding-top: 0; }
.hist-title { font-family: var(--display); font-weight: 800; letter-spacing: .1em; margin: 0 0 4px; }
.hist-prompt { color: var(--muted); font-size: 14px; white-space: pre-wrap; margin: 0 0 10px; }
.hist-side { border-left: 3px solid var(--line); padding-left: 10px; margin: 0 0 10px; }
.hist-side.blue { border-color: var(--blue); }
.hist-side.red { border-color: var(--red); }
.hist-side p { margin: 0; white-space: pre-wrap; font-size: 15px; }
.hist-side .hist-tag { font-family: var(--display); font-weight: 700; letter-spacing: .14em; font-size: 12px; color: var(--muted); }
.hist-side .reaction { margin: 6px 0 0; }
.epi-line { margin: 0 0 8px; font-size: 15px; }
.result-actions { display: grid; gap: 10px; margin-top: 20px; }

/* ---------- misc ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translate(-50%, 20px); opacity: 0;
  background: var(--text); color: var(--bg); font-weight: 700; font-size: 15px;
  padding: 10px 18px; border-radius: 999px; transition: .2s; pointer-events: none; max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.foot { margin-top: 48px; text-align: center; font-family: var(--display); letter-spacing: .2em; font-size: 12px; color: var(--muted); }
.foot a { text-decoration: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- setup ---------- */
.setup-done { font-size: 22px; font-weight: 800; margin: 0 0 24px; }
input[type=password] { width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); font: inherit; font-size: 18px; padding: 12px 14px; }
