/* ============================================================
   UNO 无障碍卡牌游戏 — 样式
   经典 UNO 配色 + 无障碍高对比 / 大按钮主题
   ============================================================ */
:root {
  --uno-red: #e3001b;
  --uno-yellow: #ffd400;
  --uno-green: #00a650;
  --uno-blue: #0066b3;
  --uno-black: #1a1a1a;

  --bg: #eef1f7;
  --panel: #ffffff;
  --text: #1a1a1a;
  --muted: #6b7280;
  --border: #d6dbe5;
  --accent: #e3001b;

  --radius: 14px;
  --card-w: 64px;
  --card-h: 96px;
  --btn-pad: 12px 18px;
  --font: 16px;
}

/* 无障碍模式：高对比 + 放大 */
body.accessible {
  --bg: #000000;
  --panel: #0a0a0a;
  --text: #ffffff;
  --muted: #ffd400;
  --border: #ffffff;
  --accent: #ffd400;
  --font: 20px;
  --card-w: 84px;
  --card-h: 124px;
  --btn-pad: 18px 24px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}
body.accessible .card,
body.accessible button,
body.accessible .panel { font-weight: 700; }

#app { max-width: 720px; margin: 0 auto; padding: 16px; min-height: 100%; }

.screen { display: none; }
.screen.active { display: block; }

/* ---------- 菜单 ---------- */
.title {
  text-align: center;
  font-size: 34px;
  font-weight: 800;
  margin: 18px 0 4px;
  letter-spacing: 2px;
}
.title .u { color: var(--uno-red); }
.subtitle { text-align: center; color: var(--muted); margin-bottom: 22px; }

.panel {
  background: var(--panel);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
}
.panel h2 { margin: 0 0 12px; font-size: 18px; }

.opt-row { display: flex; gap: 10px; flex-wrap: wrap; }
.opt {
  flex: 1 1 30%;
  min-width: 120px;
  border: 2px solid var(--border);
  background: var(--panel);
  color: var(--text);
  border-radius: var(--radius);
  padding: 14px;
  cursor: pointer;
  text-align: center;
  font-size: 16px;
  transition: transform .08s ease, border-color .15s;
}
.opt:hover { transform: translateY(-2px); }
.opt.selected {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}
.opt .name { font-weight: 800; font-size: 18px; }
.opt .desc { font-size: 13px; opacity: .9; margin-top: 4px; }

/* 开关 */
.switch-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
}
.switch {
  position: relative; width: 58px; height: 32px; flex: 0 0 auto;
  background: #cbd2dd; border-radius: 999px; cursor: pointer; transition: background .2s;
}
body.accessible .switch { width: 72px; height: 40px; }
.switch.on { background: var(--uno-green); }
.switch .knob {
  position: absolute; top: 3px; left: 3px; width: 26px; height: 26px;
  background: #fff; border-radius: 50%; transition: left .2s;
}
body.accessible .switch .knob { width: 34px; height: 34px; top: 3px; }
.switch.on .knob { left: 29px; }
body.accessible .switch.on .knob { left: 35px; }

/* 无障碍模式开关：整块按钮，文字直接显示开/关状态，盲人一听就懂 */
.switch-btn {
  width: 100%;
  display: flex; align-items: center; justify-content: space-between;
  background: var(--panel); color: var(--text);
  border: 2px solid var(--border); border-radius: var(--radius);
  padding: var(--btn-pad); font-weight: 700; font-size: 16px; cursor: pointer;
}
.switch-btn[aria-checked="true"] {
  background: var(--uno-green); border-color: var(--uno-green); color: #fff;
}
.switch-btn .switch-state {
  font-weight: 800; padding: 2px 14px; border-radius: 999px;
  background: rgba(0,0,0,.08);
}
.switch-btn[aria-checked="true"] .switch-state { background: rgba(255,255,255,.28); }
body.accessible .switch-btn { font-size: 20px; }

/* 按钮 */
button {
  font-family: inherit;
  font-size: 16px;
  border: 2px solid var(--border);
  background: var(--panel);
  color: var(--text);
  border-radius: var(--radius);
  padding: var(--btn-pad);
  cursor: pointer;
}
button.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-weight: 800;
  width: 100%;
  font-size: 18px;
}
button.ghost { background: transparent; }
button:disabled { opacity: .45; cursor: not-allowed; }
button:active { transform: scale(.97); }
button:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.help-text { color: var(--muted); font-size: 13px; margin-top: 10px; }

/* ---------- 游戏 ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px; gap: 8px;
}
.topbar .left { font-weight: 800; }
.icon-btn {
  border-radius: 10px; padding: 8px 12px; font-size: 14px;
}

#opponents { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.opp {
  flex: 1 1 30%;
  min-width: 110px;
  border: 2px solid var(--border);
  background: var(--panel);
  border-radius: var(--radius);
  padding: 10px;
  text-align: center;
  position: relative;
}
.opp.active { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(227,0,27,.18); }
.opp .avatar { font-size: 26px; }
.opp .pname { font-weight: 700; }
.opp .pcount { font-size: 13px; color: var(--muted); }
.opp .badge {
  position: absolute; top: -8px; right: -8px;
  background: var(--accent); color:#fff; border-radius: 999px;
  font-size: 12px; padding: 2px 8px;
}

#center {
  display: flex; align-items: center; justify-content: center;
  gap: 18px; margin: 10px 0; flex-wrap: wrap;
}
.pile { text-align: center; }
.pile .label { font-size: 12px; color: var(--muted); margin-bottom: 4px; }

#statusbar {
  text-align: center; font-size: 14px; color: var(--muted);
  margin: 6px 0 12px; min-height: 20px;
}
#statusbar b { color: var(--text); }

/* 手牌区 */
#hand-area { margin-top: 10px; }
#hand {
  display: flex; gap: 8px; overflow-x: auto; padding: 6px 2px 12px;
  min-height: calc(var(--card-h) + 20px);
}
#hand .card { cursor: pointer; transition: transform .1s; }
#hand .card.legal:hover { transform: translateY(-8px); }
#hand .card.illegal { opacity: .4; filter: grayscale(.5); cursor: not-allowed; }
#hand .card.legal { box-shadow: 0 0 0 3px rgba(0,166,80,.5); }

.actions { display: flex; gap: 10px; margin-top: 8px; }
.actions .draw-btn { flex: 1; }
.actions .pass-hint { flex: 2; text-align: center; align-self: center; color: var(--muted); font-size: 14px; }

/* 抽牌堆 */
.draw-pile {
  width: var(--card-w); height: var(--card-h);
  border-radius: 10px; border: 3px dashed #cbd2dd;
  background: repeating-linear-gradient(45deg,#fff,#fff 6px,#eef1f7 6px,#eef1f7 12px);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--muted); font-size: 12px; text-align: center;
}
body.accessible .draw-pile { border-color: #fff; }

/* ---------- 弹窗 ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.55);
  display: none; align-items: center; justify-content: center; padding: 20px; z-index: 50;
}
.overlay.active { display: flex; }
.dialog {
  background: var(--panel); color: var(--text);
  border: 2px solid var(--border); border-radius: 18px;
  padding: 22px; max-width: 360px; width: 100%; text-align: center;
}
.dialog h3 { margin: 0 0 14px; font-size: 22px; }
.color-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.color-btn {
  height: 64px; border-radius: 12px; border: 3px solid #000; color: #fff; font-weight: 800; font-size: 18px;
}
.color-btn.red { background: var(--uno-red); }
.color-btn.yellow { background: var(--uno-yellow); color:#1a1a1a; }
.color-btn.green { background: var(--uno-green); }
.color-btn.blue { background: var(--uno-blue); }

.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%);
  background: #1a1a1a; color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: 14px; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 60;
}
.toast.show { opacity: .95; }

/* 结果 */
.result-emoji { font-size: 48px; margin-bottom: 6px; }

@media (max-width: 480px) {
  .title { font-size: 26px; }
  :root { --card-w: 56px; --card-h: 84px; }
  body.accessible { --card-w: 72px; --card-h: 108px; }
}
