/*
 * 全站样式：首页 / 注册 / 个人主页 / 忘记密码 / 充值。
 *
 * 风格：现代、扁平、明亮。
 * 颜色、圆角、阴影都在 :root 里定好，五个页面共用这一份，
 * 看起来就是同一个站，不会一个页面一种脾气。
 */

:root {
    /* 主色：清爽的蓝 */
    --brand:      #2f7cf6;
    --brand-dark: #1c62d8;
    --brand-soft: #eaf2ff;
    /* 点缀：青绿 */
    --accent:      #10c39a;
    --accent-dark: #0aa585;
    --accent-soft: #e3f8f2;

    --bg:      #f4f8fd;   /* 页面底色 */
    --surface: #ffffff;   /* 卡片 */
    --line:    #e3ebf5;   /* 描边 */

    --text:   #1d2b3f;    /* 正文 */
    --text-2: #5d6b80;    /* 次要文字 */
    --text-3: #96a3b6;    /* 占位符、弱提示 */

    --danger:     #f0555f;
    --danger-soft: #ffeded;
    --ok:      #10a97c;
    --ok-soft: #e4f7f0;
    --warn:      #ef9b34;
    --warn-soft: #fff4e6;

    --radius:    14px;
    --radius-sm: 10px;
    --shadow:    0 2px 10px rgba(29, 43, 63, 0.06);
    --shadow-md: 0 6px 20px rgba(29, 43, 63, 0.10);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* 靠 hidden 属性藏起来的块（个人主页未登录时的那一整块），
   下面要是哪条规则写了 display，会把它顶出来，这里再压一道。 */
[hidden] {
    display: none !important;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
                 'Hiragino Sans GB', 'Microsoft YaHei', 'Noto Sans SC', 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.7;
    color: var(--text);
    max-width: 760px;
    margin: 0 auto;
    padding: 28px 20px 48px;
    min-height: 100vh;
    /* 顶部一抹很淡的蓝，算不上渐变，就是让页面亮一点 */
    background:
        radial-gradient(1100px 380px at 50% -8%, #e6f0ff 0%, rgba(230, 240, 255, 0) 70%),
        var(--bg);
    -webkit-font-smoothing: antialiased;
}

/* ========== 头部 ========== */
header {
    text-align: center;
    margin-bottom: 18px;
    padding: 10px 12px 4px;
}

.title {
    font-size: 2.1rem;
    font-weight: 800;
    color: var(--brand);
    letter-spacing: 4px;
    text-indent: 4px; /* 字间距补偿 */
}

.subtitle {
    color: var(--text-2);
    font-size: 0.86rem;
    letter-spacing: 2px;
    margin-top: 2px;
}

/* ========== 导航 ========== */
.nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
    width: fit-content;
    max-width: 100%;
    margin: 0 auto 24px;
    padding: 5px;
    background: var(--surface);
    border-radius: 999px;
    box-shadow: var(--shadow);
}

.nav a {
    color: var(--text-2);
    text-decoration: none;
    font-size: 0.88rem;
    padding: 8px 16px;
    border-radius: 999px;
    white-space: nowrap;
    transition: background 0.18s ease, color 0.18s ease;
}

.nav a:hover {
    background: var(--brand-soft);
    color: var(--brand-dark);
}

.nav a.on {
    background: var(--brand);
    color: #fff;
    font-weight: 600;
}

/* ========== 卡片 ========== */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 26px 26px 24px;
    margin-bottom: 18px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(227, 235, 245, 0.9);
}

.card h2 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* 标题前面那根小竖条 */
.card h2::before {
    content: '';
    width: 4px;
    height: 1em;
    border-radius: 2px;
    background: var(--brand);
    flex-shrink: 0;
}

.card > p {
    margin: 0.6em 0;
    color: var(--text-2);
    font-size: 0.95rem;
}

/* ========== 表单 ========== */
.field {
    margin-bottom: 16px;
}

.field label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-2);
    font-weight: 500;
    margin-bottom: 6px;
}

.field input {
    width: 100%;
    padding: 12px 14px;
    /* 字号不能小于 16px：iOS Safari 一聚焦小于 16px 的输入框就自动放大页面，
       放大之后用户得再缩回去，特别烦。这里写死 16px 挡住它。 */
    font-size: 16px;
    font-family: inherit;
    color: var(--text);
    background: #fbfdff;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    outline: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.field input:focus {
    border-color: var(--brand);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(47, 124, 246, 0.12);
}

.field input::placeholder {
    color: var(--text-3);
}

.field input[readonly] {
    background: #f4f8fc;
    color: var(--text-2);
}

/* 验证码那一行：输入框 + 图片 */
.captcha-row {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

.captcha-row input {
    flex: 1;
    width: auto;
    /* 窄屏上不让输入框把图片挤出屏幕 */
    min-width: 0;
}

/* 图片是按 260×86 画的，这里按一半显示。
 *
 * 手机屏幕的像素密度是电脑的两三倍，一个 CSS 像素对应两个以上的物理像素。
 * 按一半显示刚好 1:1，高分屏上一点不糊 —— 直接按原始尺寸显示反而会溢出。 */
.captcha-img {
    width: 130px;
    height: 43px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: #fbfdff;
    cursor: pointer;
    display: block;
    flex-shrink: 0;
    /* 点图片换一张：手机上别有那层灰灰的高亮 */
    -webkit-tap-highlight-color: transparent;
}

.captcha-img:hover {
    border-color: var(--brand);
}

/* 短信验证码那一行：输入框 + 「获取验证码」按钮 */
.code-row {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

.code-row input {
    flex: 1;
    width: auto;
    min-width: 0;
}

.code-row .btn {
    width: auto;
    padding: 12px 16px;
    font-size: 0.9rem;
    white-space: nowrap;
    flex-shrink: 0;
}

/* 输入框下面的一行小提示 */
.hint {
    margin-top: 6px;
    font-size: 0.78rem;
    color: var(--text-3);
}

/* ========== 按钮 ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 20px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--brand);
    color: #fff;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
    box-shadow: 0 3px 10px rgba(47, 124, 246, 0.22);
}

.btn:hover {
    background: var(--brand-dark);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(47, 124, 246, 0.26);
}

.btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(47, 124, 246, 0.2);
}

.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 鼠标点按钮不要那个黑色的默认焦点框，键盘操作时再给一圈品牌色的 */
.btn:focus {
    outline: none;
}

.btn:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

/* 次要按钮：白底描边 */
.btn-ghost {
    background: #fff;
    color: var(--brand);
    border: 1px solid var(--line);
    box-shadow: none;
}

.btn-ghost:hover {
    background: var(--brand-soft);
    color: var(--brand-dark);
    transform: none;
    box-shadow: none;
}

/* 占满整行的按钮（表单里的提交、退出登录这类） */
.btn-block {
    width: 100%;
}

/* 小一号的按钮（充值页那个「重填」） */
.btn-sm {
    padding: 8px 14px;
    font-size: 0.82rem;
    font-weight: 500;
}

/* ========== 提示 ========== */
.msg {
    min-height: 22px;
    margin: 12px 0 0;
    font-size: 0.88rem;
    text-align: center;
}

.msg.err {
    color: var(--danger);
}

.msg.ok {
    color: var(--ok);
}

/* 进行中：不用报错色，但也别抢眼 */
.msg.busy {
    color: var(--text-3);
}

/* 说明性的那一小块（只有确实需要说清楚的才留） */
.tip {
    font-size: 0.84rem;
    color: var(--text-2);
    margin-top: 14px;
    padding: 10px 14px;
    background: var(--brand-soft);
    border-radius: var(--radius-sm);
}

.tip b {
    color: var(--brand-dark);
}

/* ========== 个人主页 ========== */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.info-item {
    background: #f8fbff;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
}

.info-item .k {
    font-size: 0.78rem;
    color: var(--text-3);
}

.info-item .v {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text);
    margin-top: 2px;
    word-break: break-all;
}

.info-item .v.nick {
    color: var(--brand);
}

.info-item .v.score {
    color: var(--accent-dark);
}

/* 改昵称那一块 */
.nick-row {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

.nick-row .field {
    flex: 1;
    margin-bottom: 0;
}

.nick-row .btn {
    width: auto;
    padding: 12px 20px;
    white-space: nowrap;
}

/* ========== 对局历史 ========== */
/* 只在窄屏上显示的提示 */
.only-narrow {
    display: none;
}

.round-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 10px;
}

.round {
    background: #f8fbff;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
}

.round-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.round-time {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
}

.round-tag {
    font-size: 0.78rem;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--brand-soft);
    color: var(--brand-dark);
    white-space: nowrap;
    flex-shrink: 0;
}

.round-tag.win {
    background: var(--ok-soft);
    color: var(--ok);
}

.round-tag.lose {
    background: var(--danger-soft);
    color: var(--danger);
}

.round-tag.run {
    background: var(--warn-soft);
    color: var(--warn);
}

.round-tag.idle {
    background: #eef2f7;
    color: var(--text-3);
}

.round-meta {
    font-size: 0.8rem;
    color: var(--text-3);
    margin-top: 4px;
}

.round-seats {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.round-seat {
    font-size: 0.78rem;
    color: var(--text-2);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 2px 10px;
}

.round-seat.me {
    border-color: var(--brand);
    color: var(--brand-dark);
    font-weight: 700;
}

.round-report {
    font-size: 0.78rem;
    color: var(--danger);
    margin-top: 8px;
}

/* 每一局底下的那个「详情」按钮 */
.round-ops {
    margin-top: 10px;
}

.round-detail-btn {
    font: inherit;
    font-size: 0.8rem;
    color: var(--brand-dark);
    background: var(--brand-soft);
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 5px 16px;
    cursor: pointer;
}

.round-detail-btn:hover {
    border-color: var(--brand);
}

/* ========== 分页 ========== */
.pager {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    margin-top: 14px;
}

.pager-btn {
    font: inherit;
    font-size: 0.85rem;
    min-width: 38px;
    padding: 6px 10px;
    color: var(--text-2);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.pager-btn:hover:not(:disabled) {
    border-color: var(--brand);
    color: var(--brand-dark);
}

.pager-btn.on {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
    font-weight: 700;
}

.pager-btn:disabled {
    opacity: 0.45;
    cursor: default;
}

/*
 * 窄屏上把「对局回放只支持平板和电脑」那句提示显示出来。
 * 回放本身在窄屏上摆不开（见 replay.css），这里只是提前告诉用户一句。
 */
@media (max-width: 560px) {
    .only-narrow {
        display: block;
    }
}

/* ========== 首页 ========== */
/* 下载入口：四张白卡片 */
.download-links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}

.dl-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 18px 12px;
    background: #f8fbff;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    text-decoration: none;
    text-align: center;
    transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.dl-card:hover {
    border-color: var(--brand);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.dl-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}

.dl-sub {
    font-size: 0.78rem;
    color: var(--text-3);
}

/* 自助充值：首页上最显眼的一个动作 */
.charge-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 22px 20px;
    border-radius: var(--radius);
    background: var(--accent);
    color: #fff;
    text-decoration: none;
    box-shadow: 0 6px 18px rgba(16, 195, 154, 0.28);
    transition: background 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.charge-btn:hover {
    background: var(--accent-dark);
    transform: translateY(-2px);
    box-shadow: 0 10px 26px rgba(16, 195, 154, 0.32);
}

.charge-title {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: 3px;
    text-indent: 3px;
}

.charge-sub {
    font-size: 0.85rem;
    opacity: 0.92;
}

/* 客服二维码（图片还没进 static/，首页里那一段是注释掉的） */
.qr-code {
    text-align: center;
    margin: 6px 0 0;
    color: var(--text-2);
    font-size: 0.9rem;
}

.qr-code img {
    max-width: 180px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: #fff;
    padding: 6px;
}

/* 更新日志 */
.update-log p {
    display: flex;
    align-items: baseline;
    gap: 14px;
    padding: 11px 0;
    border-bottom: 1px solid var(--line);
    font-size: 0.93rem;
    color: var(--text-2);
}

.update-log p:last-child {
    border-bottom: none;
}

.update-log strong {
    color: var(--brand);
    font-weight: 600;
    min-width: 96px;
    flex-shrink: 0;
}

/* ========== 充值页 ========== */
.tiers {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.tier {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 18px 10px 14px;
    background: #f8fbff;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: inherit;
    cursor: pointer;
    text-align: center;
    transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease,
                transform 0.18s ease, box-shadow 0.18s ease;
}

.tier:hover {
    border-color: var(--brand);
    transform: translateY(-2px);
}

/* 选中的档位：翻成蓝底白字，一眼能看出来选了哪个 */
.tier[aria-pressed="true"] {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
    box-shadow: 0 6px 16px rgba(47, 124, 246, 0.28);
}

/* 颜色之外的第二重提示 */
.tier[aria-pressed="true"]::after {
    content: '✓';
    position: absolute;
    top: 6px;
    right: 9px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #fff;
}

.tier {
    position: relative;
}

.tier-price {
    font-size: 1.6rem;
    font-weight: 800;
    line-height: 1.25;
}

.tier-gain {
    font-size: 0.82rem;
    margin-top: 6px;
    color: var(--text-3);
}

.tier[aria-pressed="true"] .tier-gain {
    color: rgba(255, 255, 255, 0.88);
}

.tier-gain .gain {
    font-weight: 700;
}

/* 账号 + 按钮那一行 */
.row {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

.row input {
    flex: 1;
    min-width: 0;
    padding: 12px 14px;
    font-size: 16px;
    font-family: inherit;
    color: var(--text);
    background: #fbfdff;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    outline: none;
}

.row input:focus {
    border-color: var(--brand);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(47, 124, 246, 0.12);
}

/* 查出来的昵称 */
.confirm {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 14px;
    padding: 12px 16px;
    background: var(--ok-soft);
    border-radius: var(--radius-sm);
    font-size: 0.92rem;
    color: var(--ok);
}

.confirm.show {
    display: flex;
}

.confirm .nick {
    font-weight: 700;
}

/* 付钱之前的最后一句提醒，不能省 */
.warn {
    margin-top: 14px;
    padding: 12px 14px;
    background: var(--warn-soft);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    color: #b8770f;
}

.warn b {
    color: #8f5a06;
}

/* 确认充值的大按钮 */
.pay-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    margin-top: 6px;
    padding: 17px 20px;
    font-family: inherit;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 3px;
    text-indent: 3px;
    color: #fff;
    background: var(--brand);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 6px 18px rgba(47, 124, 246, 0.26);
    transition: background 0.18s ease, transform 0.18s ease;
}

.pay-btn:hover {
    background: var(--brand-dark);
    transform: translateY(-2px);
}

.pay-btn:disabled {
    background: #cfd9e6;
    color: #8d9aad;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.pay-btn .sub {
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 1px;
    opacity: 0.9;
}

/* ========== 确认弹框 ========== */
.modal-mask {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: rgba(29, 43, 63, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 100;
}

.modal {
    width: 100%;
    max-width: 380px;
    background: var(--surface);
    border-radius: var(--radius);
    padding: 22px 22px 18px;
    box-shadow: var(--shadow-md);
    animation: modal-in 0.16s ease;
}

.modal-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 10px;
}

.modal-text {
    font-size: 0.9rem;
    color: var(--text-2);
    line-height: 1.7;
}

.modal-text b {
    color: var(--brand);
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.modal-actions .btn {
    flex: 1;
}

@keyframes modal-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========== 页脚 ========== */
footer {
    text-align: center;
    margin-top: 26px;
    padding: 14px;
    font-size: 0.78rem;
    color: var(--text-3);
}

/* ========== 移动端 ========== */
@media (max-width: 600px) {
    body {
        padding: 20px 14px 34px;
    }
    header {
        padding: 6px 8px 0;
    }
    .title {
        font-size: 1.7rem;
        letter-spacing: 3px;
        text-indent: 3px;
    }
    .subtitle {
        font-size: 0.8rem;
    }
    .nav {
        margin-bottom: 18px;
        gap: 2px;
    }
    .nav a {
        padding: 7px 12px;
        font-size: 0.84rem;
    }
    .card,
    .section {
        padding: 20px 16px 18px;
        border-radius: 12px;
    }
    .captcha-img {
        width: 122px;
        height: 40px;
    }
    .nick-row {
        flex-direction: column;
    }
    .nick-row .btn {
        width: 100%;
    }
    .code-row .btn {
        padding: 12px;
        font-size: 0.86rem;
    }
    .info-grid {
        grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
        gap: 10px;
    }
    .info-item .v {
        font-size: 1.05rem;
    }
    .download-links {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    .dl-card {
        padding: 14px 8px;
    }
    .charge-btn {
        flex-direction: column;
        gap: 2px;
        padding: 18px 14px;
    }
    .charge-title {
        font-size: 1.2rem;
    }
    .update-log p {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
        padding: 9px 0;
    }
    .update-log strong {
        min-width: auto;
        font-size: 0.88rem;
    }
    .tiers {
        gap: 8px;
    }
    .tier {
        padding: 14px 6px 12px;
    }
    .tier-price {
        font-size: 1.25rem;
    }
    .tier-gain {
        font-size: 0.72rem;
    }
    .pay-btn {
        flex-direction: column;
        gap: 2px;
        padding: 15px 12px;
        font-size: 1.05rem;
    }
}

/* 特别窄的手机（iPhone SE 之类）：验证码图再收一点，别把输入框挤没了 */
@media (max-width: 380px) {
    .captcha-img {
        width: 108px;
        height: 36px;
    }
    .captcha-row {
        gap: 8px;
    }
}

/* 手机上按钮别有那层点一下的灰高亮 */
.btn, .nav a, .captcha-img, .dl-card, .tier {
    -webkit-tap-highlight-color: transparent;
    /* 去掉移动浏览器那 300ms 的点击延迟 */
    touch-action: manipulation;
}

@media (prefers-reduced-motion: reduce) {
    .btn:hover,
    .dl-card:hover,
    .charge-btn:hover,
    .pay-btn:hover,
    .tier:hover {
        transform: none;
    }
}
