/* ============================================================
   羽毛球团体赛 · 出场名单填写（运动员端 H5）
   ============================================================ */
:root {
    --brand: #0f766e;
    --brand-2: #14b8a6;
    --brand-soft: #e6f7f4;
    --ink: #0f172a;
    --ink-2: #334155;
    --muted: #64748b;
    --line: #e2e8f0;
    --bg: #eef2f6;
    --card: #ffffff;
    --danger: #dc2626;
    --danger-soft: #fef2f2;
    --warn: #b45309;
    --warn-soft: #fffbeb;
    --ok: #047857;
    --ok-soft: #ecfdf5;
    --radius: 14px;
    --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 6px 18px -8px rgba(15, 23, 42, .12);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; }
button { font-family: inherit; }

#app { max-width: 560px; margin: 0 auto; padding-bottom: 96px; }

/* ---------------- 加载 / 占位 ---------------- */
.loading { padding: 80px 20px; text-align: center; color: var(--muted); }
.spinner {
    width: 26px; height: 26px; margin: 0 auto 14px;
    border: 3px solid var(--line); border-top-color: var(--brand);
    border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty { padding: 60px 24px; text-align: center; color: var(--muted); }
.empty .big { font-size: 40px; margin-bottom: 8px; }
.empty h3 { color: var(--ink); margin: 0 0 8px; font-size: 17px; }

/* ---------------- 顶部 ---------------- */
.hero {
    background: linear-gradient(135deg, #0f766e 0%, #0e7490 55%, #155e75 100%);
    color: #fff;
    padding: 18px 18px 22px;
    border-radius: 0 0 20px 20px;
}
.hero-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.hero-event { font-size: 12px; opacity: .85; letter-spacing: .3px; }
.hero-title { margin: 8px 0 2px; font-size: 21px; font-weight: 700; letter-spacing: .5px; }
.hero-sub { font-size: 13px; opacity: .88; }
.tag {
    display: inline-block; padding: 3px 9px; border-radius: 999px;
    font-size: 11px; font-weight: 600; white-space: nowrap;
    background: rgba(255, 255, 255, .18); color: #fff; border: 1px solid rgba(255, 255, 255, .35);
}
.tag-open { background: #facc15; color: #78350f; border-color: #facc15; }
.tag-end { background: rgba(255, 255, 255, .2); }

/* ---------------- 卡片 ---------------- */
.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin: 12px;
    padding: 14px 15px;
}
.card-hd { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.card-hd h2 { margin: 0; font-size: 15px; font-weight: 700; }
.card-hd .sub { margin-left: auto; font-size: 12px; color: var(--muted); }

.notice-card { background: #f8fafc; border: 1px solid var(--line); box-shadow: none; }
.notice-body { font-size: 13px; color: var(--ink-2); white-space: pre-wrap; }

/* ---------------- 兼项规则 ---------------- */
.rules-card { background: #f7fbfa; border: 1px solid #d3ece7; box-shadow: none; }
.rule-ol { margin: 0; padding-left: 18px; font-size: 13px; color: var(--ink-2); }
.rule-ol li { margin-bottom: 5px; line-height: 1.5; }
.rule-ol li:last-child { margin-bottom: 0; }
.flag-no {
    font-style: normal; font-size: 10px; font-weight: 700; color: var(--warn);
    background: var(--warn-soft); border: 1px solid #fde68a; border-radius: 999px;
    padding: 1px 7px; white-space: nowrap;
}
.flag-flex {
    font-style: normal; font-size: 10px; font-weight: 700; color: #0f766e;
    background: #ccfbf1; border: 1px solid #99f6e4; border-radius: 999px;
    padding: 1px 6px; margin-left: 5px; white-space: nowrap;
}
.tip-rule { color: var(--brand); }

/* ---------------- 对阵 ---------------- */
.versus {
    display: grid; grid-template-columns: 1fr 40px 1fr; align-items: center; gap: 4px;
    margin-bottom: 12px;
}
.vs-team { text-align: center; padding: 8px 4px; border-radius: 10px; }
.vs-team.is-mine { background: var(--brand-soft); }
.vs-name { font-size: 15px; font-weight: 700; word-break: break-all; }
.vs-name em {
    font-style: normal; font-size: 10px; font-weight: 700; color: var(--brand);
    background: #fff; border: 1px solid var(--brand-2); border-radius: 999px; padding: 0 5px; margin-left: 3px;
    vertical-align: 2px;
}
.vs-count { font-size: 11px; color: var(--muted); margin-top: 2px; }
.vs-vs { text-align: center; font-size: 13px; font-weight: 800; color: var(--muted); }

.rosters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.roster { background: #f8fafc; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.roster-hd { font-size: 12px; font-weight: 700; color: var(--ink-2); margin-bottom: 6px; display: flex; justify-content: space-between; }
.roster-hd span { color: var(--muted); font-weight: 400; }
.roster ul { list-style: none; margin: 0; padding: 0; }
.roster li { display: flex; justify-content: space-between; align-items: center; padding: 2px 0; font-size: 13px; }
.g { font-style: normal; font-size: 10px; padding: 0 5px; border-radius: 999px; line-height: 16px; }
.g-m { background: #e0efff; color: #1d4ed8; }
.g-f { background: #ffe4ef; color: #be185d; }

/* ---------------- 状态 ---------------- */
.stat-row { display: grid; gap: 8px; }
.stat {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; font-size: 13px;
}
.stat b { font-weight: 700; }
.stat .time { margin-left: auto; font-size: 11px; color: var(--muted); }
.stat-done { background: var(--ok-soft); border-color: #a7f3d0; color: var(--ok); }
.stat-wait { background: var(--warn-soft); border-color: #fde68a; color: var(--warn); }
.stat-me { border-left: 3px solid var(--brand); }

.tip { margin: 10px 0 0; font-size: 12px; color: var(--muted); }
.tip-strong { color: var(--warn); font-weight: 600; }

/* ---------------- 选边 ---------------- */
.side-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.side-btn {
    border: 1.5px solid var(--line); background: #fff; border-radius: 12px; padding: 14px 8px;
    font-size: 15px; font-weight: 700; color: var(--ink); cursor: pointer;
}
.side-btn:active { background: var(--brand-soft); border-color: var(--brand); }
.code-row { display: flex; gap: 8px; margin-top: 10px; }
.code-row input {
    flex: 1; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
    font-size: 15px; letter-spacing: 2px; text-transform: uppercase; background: #fff; color: var(--ink);
}
.err-text { color: var(--danger); font-size: 12px; margin-top: 6px; }

/* ---------------- 填写区 ---------------- */
.item-list { display: grid; gap: 10px; }
.item-card { border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; background: #fff; }
.item-card.is-done { border-color: #a7f3d0; background: #fbfefd; }
.item-card.is-missing { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(20, 184, 166, .12); }
.item-top { display: flex; align-items: center; gap: 8px; }
.item-idx {
    width: 20px; height: 20px; border-radius: 50%; background: var(--brand-soft); color: var(--brand);
    font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex: none;
}
.item-name { font-weight: 700; font-size: 15px; }
.item-rule { margin-left: auto; font-size: 11px; color: var(--muted); background: #f1f5f9; padding: 2px 8px; border-radius: 999px; }
.item-picked { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.chip {
    display: inline-flex; align-items: center; gap: 4px;
    background: var(--brand-soft); color: var(--brand); border: 1px solid #99f6e4;
    border-radius: 999px; padding: 3px 10px; font-size: 13px; font-weight: 600;
}
.chip-empty { color: var(--muted); background: #f8fafc; border-color: var(--line); font-weight: 400; }
.item-btn {
    margin-top: 10px; width: 100%; border: 1px dashed var(--line); background: #f8fafc;
    border-radius: 10px; padding: 8px; font-size: 13px; color: var(--brand); font-weight: 600; cursor: pointer;
}
.item-btn:active { background: var(--brand-soft); }

/* ---------------- 底部提交栏 ---------------- */
.submit-bar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    max-width: 560px; margin: 0 auto;
    background: rgba(255, 255, 255, .96);
    backdrop-filter: blur(8px);
    border-top: 1px solid var(--line);
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
    display: flex; align-items: center; gap: 12px;
}
.submit-progress { font-size: 12px; color: var(--muted); line-height: 1.3; }
.submit-progress b { display: block; font-size: 15px; color: var(--ink); }
.btn-primary, .btn-ghost, .btn-danger {
    border: 0; border-radius: 11px; font-size: 15px; font-weight: 700; cursor: pointer;
}
.btn-primary { background: var(--brand); color: #fff; padding: 12px 22px; flex: 1; }
.btn-primary:disabled { background: #cbd5e1; color: #f8fafc; }
.btn-ghost { background: #f1f5f9; color: var(--ink-2); padding: 12px 16px; }
.btn-danger { background: var(--danger-soft); color: var(--danger); padding: 12px 16px; }

/* ---------------- 双方名单 ---------------- */
.reveal-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 9px 0; border-top: 1px dashed var(--line); }
.reveal-row:first-child { border-top: 0; }
.reveal-item { grid-column: 1 / -1; font-size: 13px; font-weight: 700; color: var(--ink-2); display: flex; justify-content: space-between; }
.reveal-item span { font-weight: 400; color: var(--muted); font-size: 11px; }
.reveal-cell { font-size: 14px; }
.reveal-cell .lbl { display: block; font-size: 11px; color: var(--muted); }
.reveal-cell.is-empty { color: var(--muted); }
.reveal-cell.is-mine { background: var(--brand-soft); border-radius: 8px; padding: 4px 8px; }
.reveal-cell.is-other { background: #f8fafc; border-radius: 8px; padding: 4px 8px; }

/* ---------------- 历史名单 ---------------- */
details.hist { border-bottom: 1px dashed var(--line); padding: 6px 0; }
details.hist:last-child { border-bottom: 0; }
details.hist > summary {
    cursor: pointer; font-size: 13px; font-weight: 600; color: var(--ink-2);
    list-style: none; display: flex; align-items: center; gap: 6px; padding: 4px 0;
}
details.hist > summary::-webkit-details-marker { display: none; }
details.hist > summary::before {
    content: "▸"; color: var(--muted); font-size: 11px; transition: transform .15s;
}
details.hist[open] > summary::before { transform: rotate(90deg); }
details.hist > summary .muted { margin-left: auto; font-weight: 400; font-size: 11px; color: var(--muted); }
.hist-body { padding: 4px 0 8px 14px; }
.hist-line { font-size: 13px; color: var(--ink-2); padding: 3px 0; display: flex; gap: 8px; }
.hist-line .k { color: var(--muted); min-width: 76px; flex: none; }
.hist-empty { font-size: 12px; color: var(--muted); }

.team-block { margin-bottom: 10px; }
.team-block:last-child { margin-bottom: 0; }
.team-block > h3 { margin: 0 0 2px; font-size: 13px; font-weight: 700; color: var(--brand); }

/* ---------------- 抽屉 ---------------- */
.sheet-mask {
    position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 50;
    opacity: 0; pointer-events: none; transition: opacity .2s;
}
.sheet-mask.show { opacity: 1; pointer-events: auto; }
.sheet {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 51;
    max-width: 560px; margin: 0 auto;
    background: #fff; border-radius: 18px 18px 0 0;
    transform: translateY(102%); transition: transform .24s ease;
    display: flex; flex-direction: column; max-height: 78vh;
}
.sheet.show { transform: translateY(0); }
.sheet-hd { display: flex; align-items: center; padding: 14px 16px 10px; border-bottom: 1px solid var(--line); }
.sheet-hd b { font-size: 16px; }
.sheet-hd span { display: block; font-size: 12px; color: var(--muted); font-weight: 400; }
.sheet-close { margin-left: auto; border: 0; background: #f1f5f9; color: var(--muted); width: 30px; height: 30px; border-radius: 50%; font-size: 15px; cursor: pointer; }
.sheet-body { overflow-y: auto; padding: 6px 12px 12px; }
.p-row {
    display: flex; align-items: center; gap: 10px; padding: 11px 10px;
    border-bottom: 1px solid #f1f5f9; cursor: pointer; border-radius: 8px;
}
.p-row:last-child { border-bottom: 0; }
.p-row .p-name { font-size: 15px; font-weight: 600; }
.p-row .p-note { font-size: 11px; color: var(--muted); margin-left: auto; margin-right: 6px; }
.p-row .p-check {
    width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--line); flex: none;
    display: flex; align-items: center; justify-content: center; font-size: 12px; color: transparent;
}
.p-row.is-sel { background: var(--brand-soft); }
.p-row.is-sel .p-check { background: var(--brand); border-color: var(--brand); color: #fff; }
.p-row.is-disabled { opacity: .42; }
.sheet-ft { display: flex; gap: 10px; padding: 10px 14px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }

/* ---------------- Toast ---------------- */
.toast {
    position: fixed; left: 50%; top: 46%; transform: translate(-50%, -50%) scale(.94);
    background: rgba(15, 23, 42, .9); color: #fff; font-size: 14px; line-height: 1.5;
    padding: 11px 18px; border-radius: 12px; max-width: 76vw; text-align: center;
    opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; z-index: 99;
}
.toast.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }

/* ---------------- 成功态 ---------------- */
.done-hero { text-align: center; padding: 6px 0 2px; }
.done-hero .big { font-size: 34px; }
.done-hero h3 { margin: 4px 0 2px; font-size: 17px; color: var(--ok); }
.done-hero p { margin: 0; font-size: 12px; color: var(--muted); }

.foot-note { text-align: center; font-size: 11px; color: #94a3b8; padding: 8px 20px 20px; }

.link-btn { color: var(--brand); font-size: 12px; text-decoration: none; border-bottom: 1px dashed var(--brand-2); }

@media (max-width: 340px) {
    .rosters { grid-template-columns: 1fr; }
}
