:root {
    --green: #196f5a;
    --green-dark: #155f4e;
    --green-soft: #e4f3ec;
    --bg: #f5f7f4;
    --card: #ffffff;
    --text: #1b2621;
    --muted: #7b8983;
    --line: #e9eeeb;
    --line-soft: #eef2ef;
    --amber: #a9671f;
    --amber-soft: #fdf0df;
    --red: #a33b31;
    --red-soft: #fdecea;
    --radius: 14px;
    --shadow: 0 1px 2px rgba(24, 51, 42, 0.04), 0 8px 24px rgba(24, 51, 42, 0.05);
}

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

html,
body {
    margin: 0;
    padding: 0;
    background: #eceeeb;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: 15px;
    line-height: 1.5;
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

.app {
    max-width: 480px;
    min-height: 100vh;
    margin: 0 auto;
    padding: 16px 16px calc(84px + env(safe-area-inset-bottom));
    background: var(--bg);
}

.app.no-tabbar {
    padding-bottom: 32px;
}

/* ---------- 顶部条 ---------- */

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 2px 14px;
}

.topbar-brand {
    display: flex;
    flex-direction: column;
}

.topbar-title {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.topbar-sub {
    font-size: 12px;
    color: var(--muted);
    margin-top: 2px;
}

.account-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 45%;
    padding: 7px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    font-size: 12px;
    color: var(--green);
    font-weight: 600;
    cursor: pointer;
}

.account-chip span {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* ---------- 卡片 ---------- */

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.hero {
    padding: 20px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, #155f4e 0%, #227f66 100%);
    color: #fff;
}

.hero-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.hero-tag {
    display: inline-block;
    padding: 2px 8px;
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 999px;
    font-size: 11px;
    letter-spacing: 1px;
}

.hero-title {
    margin: 10px 0 0;
    font-size: 22px;
    font-weight: 700;
}

.hero-sub {
    margin: 6px 0 0;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.82);
}

.hero-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

/* ---------- 按钮 ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 44px;
    padding: 0 18px;
    border: none;
    border-radius: 11px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
}

.btn:disabled {
    opacity: 0.55;
    cursor: default;
}

.btn-primary {
    background: var(--green);
    color: #fff;
}

.btn-ghost {
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
}

.btn-line {
    background: #fff;
    color: var(--green);
    border: 1px solid var(--line);
}

.btn-soft {
    background: var(--green-soft);
    color: var(--green);
}

.btn-danger {
    background: var(--red-soft);
    color: var(--red);
}

.btn-block {
    width: 100%;
}

.btn-sm {
    height: 34px;
    padding: 0 14px;
    border-radius: 999px;
    font-size: 13px;
}

/* ---------- 版块标题 ---------- */

.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin: 22px 2px 12px;
}

.section-title {
    font-size: 16px;
    font-weight: 700;
}

.section-more {
    font-size: 12px;
    color: var(--muted);
}

/* ---------- 牌局卡片 ---------- */

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

.game {
    padding: 16px;
    cursor: pointer;
}

.game-head {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mode-block {
    display: flex;
    flex: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 54px;
    height: 54px;
    border-radius: 12px;
    font-weight: 700;
    line-height: 1.1;
}

.mode-13 {
    background: var(--green-soft);
    color: var(--green);
}

.mode-16 {
    background: var(--amber-soft);
    color: var(--amber);
}

.mode-num {
    font-size: 21px;
}

.mode-unit {
    font-size: 10px;
    margin-top: 2px;
}

.game-head-text {
    flex: 1;
    min-width: 0;
}

.game-title {
    font-size: 16px;
    font-weight: 700;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.game-time {
    margin-top: 3px;
    font-size: 12px;
    color: var(--muted);
}

.badge {
    display: inline-flex;
    align-items: center;
    flex: none;
    height: 20px;
    padding: 0 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
}

.badge-open {
    background: var(--green-soft);
    color: var(--green);
}

.badge-full {
    background: #f0f1f0;
    color: var(--muted);
}

.badge-joined {
    background: var(--amber-soft);
    color: var(--amber);
}

.game-info {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 13px;
    color: #60706a;
}

.game-info-line {
    display: flex;
    gap: 7px;
    align-items: baseline;
    overflow: hidden;
}

.game-info-line b {
    flex: none;
    font-weight: 600;
    color: var(--green);
    font-size: 13px;
}

.game-info-line span {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.game-foot {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--line-soft);
    font-size: 12px;
    color: var(--green);
    font-weight: 600;
}

.progress {
    flex: 1;
    height: 5px;
    border-radius: 3px;
    background: #ecf1ed;
    overflow: hidden;
}

.progress-inner {
    height: 100%;
    border-radius: 3px;
    background: var(--green);
}

/* ---------- 详情 ---------- */

.detail-hero {
    padding: 20px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, #155f4e 0%, #227f66 100%);
    color: #fff;
}

.detail-mode {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-top: 14px;
}

.detail-mode strong {
    font-size: 44px;
    line-height: 1;
}

.detail-mode em {
    font-style: normal;
    font-size: 15px;
}

.detail-title {
    margin: 12px 0 0;
    font-size: 19px;
    font-weight: 700;
    line-height: 1.4;
}

.detail-date {
    display: block;
    margin-top: 6px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.88);
}

.info-list {
    margin-top: 12px;
    padding: 4px 18px;
}

.info-row {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 46px;
    border-bottom: 1px solid var(--line-soft);
    font-size: 14px;
}

.info-row:last-child {
    border-bottom: none;
}

.info-row .k {
    flex: none;
    width: 46px;
    color: var(--muted);
    font-size: 13px;
}

.info-row .v {
    flex: 1;
    text-align: right;
    font-weight: 600;
    word-break: break-all;
}

.seats-block {
    padding: 4px 18px 18px;
}

.seats-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 14px;
    font-weight: 700;
    color: var(--green);
}

.seats-head em {
    font-style: normal;
    font-size: 12px;
    font-weight: 400;
    color: var(--muted);
}

.seats-block .progress {
    margin-top: 10px;
    height: 7px;
}

/* ---------- 名单 / 锁态 ---------- */

.roster {
    margin-top: 12px;
    padding: 18px;
}

.roster-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
}

.roster-head strong {
    font-size: 16px;
}

.roster-head span {
    font-size: 12px;
    color: var(--muted);
}

.person {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 50px;
    border-bottom: 1px solid var(--line-soft);
}

.person:last-of-type {
    border-bottom: none;
}

.avatar {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--green-soft);
    color: var(--green);
    font-size: 13px;
    font-weight: 700;
}

.person-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.person-name {
    font-size: 14px;
    font-weight: 600;
}

.person-time {
    font-size: 11px;
    color: var(--muted);
}

.locked {
    margin-top: 12px;
    padding: 28px 20px;
    text-align: center;
}

.locked-mark {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    margin: 0 auto;
    border-radius: 50%;
    background: var(--green-soft);
    font-size: 20px;
}

.locked strong {
    display: block;
    margin-top: 12px;
    font-size: 16px;
}

.locked p {
    margin: 8px 0 0;
    font-size: 13px;
    color: var(--muted);
    line-height: 1.7;
}

/* 待确认的申请行：发起人在这里逐条通过或驳回 */
.person-pending {
    height: auto;
    min-height: 56px;
    padding: 9px 0;
}

.person-acts {
    display: flex;
    flex: none;
    gap: 6px;
    margin-left: auto;
}

.person-acts .btn {
    min-width: 54px;
    padding: 0 12px;
}

.roster-pending {
    border: 1px solid rgba(25, 111, 90, 0.24);
    background: linear-gradient(180deg, rgba(25, 111, 90, 0.06), rgba(255, 255, 255, 0) 62%);
}

.locked-pending .locked-mark {
    background: #fbf1d9;
    color: #a0701b;
}

/* ---------- 表单 ---------- */

.form {
    margin-top: 12px;
    padding: 6px 18px;
}

.field {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 50px;
    border-bottom: 1px solid var(--line-soft);
}

.field:last-of-type {
    border-bottom: none;
}

.field label {
    flex: none;
    width: 76px;
    font-size: 14px;
    color: #4a5a53;
}

.field input,
.field select,
.field textarea {
    flex: 1;
    min-width: 0;
    padding: 8px 0;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 15px;
    color: var(--text);
    text-align: right;
    outline: none;
}

.field textarea {
    min-height: 64px;
    text-align: left;
    resize: none;
}

.field select {
    direction: rtl;
}

.field select option {
    direction: ltr;
}

.field input::placeholder,
.field textarea::placeholder {
    color: #a4b0aa;
    font-size: 14px;
}

.hint {
    margin: 8px 2px 0;
    font-size: 12px;
    color: var(--muted);
    line-height: 1.6;
}

.stepper {
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: flex-end;
    gap: 14px;
}

.step-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 50%;
    background: var(--green-soft);
    color: var(--green);
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
}

.step-btn:disabled {
    background: #f0f2f0;
    color: #b8c1bc;
}

.step-value {
    min-width: 22px;
    text-align: center;
    font-weight: 700;
}

.switch-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 0;
    border-top: 1px solid var(--line-soft);
    font-size: 13px;
}

.switch-row input {
    width: 20px;
    height: 20px;
    accent-color: var(--green);
}

.mode-pick {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

.mode-option {
    flex: 1;
    padding: 14px;
    border: 2px solid var(--line);
    border-radius: 12px;
    background: #fff;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
}

.mode-option strong {
    display: block;
    font-size: 26px;
    color: var(--green);
    line-height: 1.1;
}

.mode-option span {
    font-size: 12px;
    color: var(--muted);
}

.mode-option.active {
    border-color: var(--green);
    background: var(--green-soft);
}

/* ---------- 状态页 ---------- */

.state {
    padding: 48px 24px;
    text-align: center;
}

.state strong {
    display: block;
    margin-top: 10px;
    font-size: 15px;
}

.state p {
    margin: 8px 0 0;
    font-size: 13px;
    color: var(--muted);
    line-height: 1.6;
}

.state .btn {
    margin-top: 16px;
}

.spinner {
    width: 26px;
    height: 26px;
    margin: 0 auto;
    border: 3px solid #dcece5;
    border-top-color: var(--green);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.error-box {
    margin-top: 12px;
    padding: 12px 14px;
    border-radius: 10px;
    background: var(--red-soft);
    color: var(--red);
    font-size: 13px;
    line-height: 1.5;
}

/* ---------- 底部导航 ---------- */

.tabbar {
    position: fixed;
    left: 50%;
    bottom: 0;
    z-index: 20;
    display: flex;
    width: 100%;
    max-width: 480px;
    transform: translateX(-50%);
    padding-bottom: env(safe-area-inset-bottom);
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(8px);
}

.tab {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    height: 58px;
    border: none;
    background: none;
    color: var(--muted);
    font-size: 11px;
    font-family: inherit;
    cursor: pointer;
}

.tab.active {
    color: var(--green);
    font-weight: 700;
}

.tab-icon {
    font-size: 17px;
    line-height: 1;
}

/* ---------- 浮动操作 ---------- */

.fab {
    position: fixed;
    left: 50%;
    bottom: calc(74px + env(safe-area-inset-bottom));
    z-index: 21;
    display: flex;
    align-items: center;
    gap: 6px;
    height: 46px;
    padding: 0 20px;
    border: none;
    border-radius: 999px;
    background: var(--green);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    box-shadow: 0 8px 20px rgba(21, 95, 78, 0.28);
    transform: translateX(-50%);
    cursor: pointer;
}

/* ---------- 记录 ---------- */

.record {
    padding: 15px 16px;
    cursor: pointer;
}

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

.record-title {
    font-size: 15px;
    font-weight: 700;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.record-line {
    margin-top: 5px;
    font-size: 12px;
    color: var(--muted);
}

.record-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--line-soft);
    font-size: 11px;
    color: var(--muted);
}

/* ---------- 管理 ---------- */

.queue {
    padding: 16px;
}

.queue-head {
    display: flex;
    align-items: center;
    gap: 10px;
}

.queue-name {
    flex: 1;
    min-width: 0;
    font-size: 15px;
    font-weight: 700;
}

.queue-line {
    margin: 6px 0 0 26px;
    font-size: 12px;
    color: var(--muted);
    line-height: 1.6;
}

.queue-time {
    margin: 8px 0 0 26px;
    font-size: 11px;
    color: #9aa6a0;
}

.queue-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--line-soft);
}

.venue-item {
    padding: 14px 16px;
}

.venue-item strong {
    font-size: 14px;
}

.venue-item p {
    margin: 4px 0 0;
    font-size: 12px;
    color: var(--muted);
}

/* ---------- 提示条 ---------- */

.toast {
    position: fixed;
    left: 50%;
    bottom: 96px;
    z-index: 50;
    max-width: 80%;
    padding: 10px 18px;
    border-radius: 999px;
    background: rgba(27, 38, 33, 0.9);
    color: #fff;
    font-size: 13px;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 8px);
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.toast-show {
    opacity: 1;
    transform: translate(-50%, 0);
}

.footnote {
    margin: 16px 2px 0;
    font-size: 11px;
    color: #9aa6a0;
    text-align: center;
    line-height: 1.6;
}

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

.pad {
    padding: 18px;
}

.pad p {
    margin: 0 0 4px;
}

.login-title {
    margin: 0 0 6px;
    font-size: 19px;
    font-weight: 700;
}

a.btn {
    text-decoration: none;
}

.tab-icon svg {
    display: block;
    width: 20px;
    height: 20px;
}

.hidden {
    display: none !important;
}

.login-switch {
    margin-top: 10px;
}

.text-link {
    padding: 0;
    border: 0;
    background: none;
    color: var(--green);
    font-size: 12px;
    font-family: inherit;
    text-decoration: underline;
    cursor: pointer;
}

/* ---------- 记录页备忘 ---------- */

.memo {
    margin-top: 12px;
    padding: 12px;
    border-radius: 12px;
    background: var(--green-soft);
    cursor: default;
}

.memo-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}

.memo-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--green);
}

.memo-privacy {
    font-size: 11px;
    color: var(--muted);
}

.memo-text {
    margin: 7px 0 0;
    font-size: 13px;
    line-height: 1.65;
    color: var(--text);
    white-space: pre-wrap;
    word-break: break-word;
}

.memo-text.memo-empty {
    color: var(--muted);
}

.memo .text-link {
    margin-top: 6px;
}

.memo-form {
    margin-top: 8px;
}

.memo-input {
    width: 100%;
    min-height: 92px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--card);
    color: var(--text);
    font-size: 13px;
    line-height: 1.65;
    font-family: inherit;
    resize: vertical;
}

.memo-input:focus {
    outline: none;
    border-color: var(--green);
}

.memo-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 8px;
}

.memo-count {
    margin-right: auto;
    font-size: 11px;
    color: var(--muted);
}
