/* 信任對決：手機玩家頁專用樣式。手機直式 360~430px 為主，桌機置中最大 480px。 */

html, body { height: 100%; overflow-x: hidden; }

body {
  display: flex;
  justify-content: center;
}

.app {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  padding: 16px 16px 32px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.conn-banner {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  background: var(--defect);
  color: #2a0505;
  font-weight: 700;
  font-size: 13px;
  text-align: center;
  padding: 6px 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,.35);
}

/* ---- 共用元件 ---- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}

.card + .card { margin-top: 0; }

.title { font-size: 20px; font-weight: 800; margin: 0 0 4px; }
.subtitle { font-size: 14px; color: var(--muted); margin: 0 0 8px; }
.center { text-align: center; }

.stack { display: flex; flex-direction: column; gap: 12px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; color: var(--muted); }
.field input[type="text"] {
  width: 100%;
  height: 52px;
  font-size: 18px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card-2);
  color: var(--text);
  text-align: center;
  letter-spacing: 0.02em;
}
.field input[type="text"]:focus { outline: 2px solid var(--accent); }

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 56px;
  font-size: 18px;
  font-weight: 700;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card-2);
  color: var(--text);
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}
.btn-primary { background: var(--accent); border-color: var(--accent); color: #0b1020; }
.btn-primary:active { filter: brightness(0.9); }
.btn:disabled { opacity: 0.5; }

.error-text { color: var(--defect); font-size: 14px; min-height: 1.2em; }
.hint-text { color: var(--muted); font-size: 13px; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}
.badge-coop { background: var(--coop-soft); color: var(--coop); }
.badge-defect { background: var(--defect-soft); color: var(--defect); }
.badge-idle { background: rgba(148,163,184,0.16); color: var(--idle); }

/* ---- 規則卡 2x2 表 ---- */
.payoff-table { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 14px; }
.payoff-table th, .payoff-table td {
  border: 1px solid var(--line);
  padding: 8px 6px;
  text-align: center;
}
.payoff-table th { color: var(--muted); font-weight: 600; background: var(--bg-2); }
.payoff-table td.cell-coop { background: var(--coop-soft); color: var(--coop); font-weight: 800; font-size: 16px; }
.payoff-table td.cell-defect { background: var(--defect-soft); color: var(--defect); font-weight: 800; font-size: 16px; }

.rule-notes { margin: 8px 0 0; padding-left: 18px; font-size: 13px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.rule-notes li { list-style: disc; }

/* ---- choosing ---- */
.round-head { display: flex; align-items: baseline; justify-content: space-between; }
.round-head .round-no { font-size: 15px; color: var(--muted); }

.countdown-wrap { text-align: center; padding: 6px 0 2px; }
.countdown-num { font-size: 52px; font-weight: 800; line-height: 1; }
.countdown-track {
  height: 8px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
  margin-top: 10px;
}
.countdown-fill { height: 100%; background: var(--accent); transition: width 0.1s linear; }
.countdown-fill.urgent { background: var(--defect); }

.opp-card { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.opp-name { font-size: 20px; font-weight: 800; }
.opp-sub { font-size: 13px; color: var(--muted); }

.choose-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.choose-btn {
  position: relative;
  min-height: max(160px, 30vh);
  border-radius: var(--radius);
  border: 2px solid var(--line);
  background: var(--card-2);
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 22px;
  font-weight: 800;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}
.choose-btn .emoji { font-size: 48px; }
.choose-btn .label { font-size: 22px; font-weight: 800; }
.choose-btn.coop { border-color: var(--coop); background: var(--coop-soft); color: var(--coop); }
.choose-btn.defect { border-color: var(--defect); background: var(--defect-soft); color: var(--defect); }
.choose-btn.coop.selected { background: var(--coop); color: #04210d; }
.choose-btn.defect.selected { background: var(--defect); color: #2a0505; }
.choose-btn .check-badge {
  position: absolute; top: 8px; right: 10px; font-size: 22px; font-weight: 900;
  opacity: 0; transform: scale(0.6); transition: opacity 0.15s, transform 0.15s;
}
.choose-btn.selected .check-badge { opacity: 1; transform: none; }
.choose-btn:active { filter: brightness(0.92); }

.selected-hint { text-align: center; font-size: 14px; font-weight: 700; }
.selected-hint.coop { color: var(--coop); }
.selected-hint.defect { color: var(--defect); }

/* ---- reveal ---- */
.result-line { font-size: 19px; font-weight: 800; text-align: center; margin: 4px 0 8px; }
.result-story { font-size: 15px; text-align: center; color: var(--text); margin: 0 0 10px; }
.score-row { display: flex; justify-content: space-around; text-align: center; margin-top: 6px; }
.score-row .num { font-size: 26px; font-weight: 800; }
.score-row .lbl { font-size: 12px; color: var(--muted); }

/* ---- away / kicked ---- */
.status-icon { font-size: 44px; text-align: center; }

/* ---- final ---- */
.rank-big { font-size: 44px; font-weight: 900; text-align: center; }
.rank-gold { color: var(--gold); }
.rank-silver { color: var(--silver); }
.rank-bronze { color: var(--bronze); }
.final-stats { display: flex; justify-content: space-around; text-align: center; }
.final-stats .num { font-size: 22px; font-weight: 800; }
.final-stats .lbl { font-size: 12px; color: var(--muted); }
.style-tag { text-align: center; font-size: 18px; font-weight: 800; color: var(--accent); margin-top: 4px; }
.style-desc { text-align: center; font-size: 13px; color: var(--muted); margin-top: 2px; }
.awards-list { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.award-chip { background: var(--bg-2); border-radius: 10px; padding: 8px 10px; font-size: 14px; text-align: center; }

.history-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.history-chip {
  flex: 0 0 auto;
  min-width: 52px;
  border-radius: 10px;
  border: 1px solid var(--line);
  padding: 6px 4px;
  text-align: center;
  font-size: 11px;
}
.history-chip .round { color: var(--muted); }
.history-chip .icon { font-size: 18px; margin: 2px 0; }
.history-chip .pts { font-weight: 700; font-size: 13px; }
.history-chip.coop { border-color: var(--coop); }
.history-chip.defect { border-color: var(--defect); }
.history-chip.idle { border-color: var(--line); opacity: 0.7; }

@media (min-width: 481px) {
  .app { padding-top: 28px; }
}
