:root {
    color-scheme: dark;
    font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
    --room: #0c1310;
    --panel: #141e19;
    --raised: #1e2a24;
    --line: #35433b;
    --text: #eef1ea;
    --muted: #a9b6ae;
    --gold: #e6b54f;
    --rail: #241810;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--room); color: var(--text); color-scheme: dark; }
main {
    width: min(100%, 760px);
    margin-inline: auto;
    padding: calc(20px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
        calc(24px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
header, .room-heading, .controls, .identity { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
header, .room-heading { justify-content: space-between; }
header { padding-bottom: 18px; }
h1, h2, p { margin: 0; }
.wordmark {
    display: grid;
    justify-items: start;
    gap: 4px;
    max-width: 100%;
    font-family: "Arial Narrow", system-ui, sans-serif;
    line-height: 1;
}
.wordmark-main { display: inline-flex; align-items: baseline; gap: .15em; font-size: clamp(36px, 8vw, 52px); font-weight: 800; letter-spacing: -.055em; }
.wordmark-suit { color: var(--gold); font-size: .42em; letter-spacing: 0; }
.wordmark-subtitle { color: var(--muted); font-size: clamp(11px, 2.4vw, 14px); font-weight: 650; letter-spacing: .12em; }
#room-code { color: var(--gold); }
h2 { font-size: 19px; line-height: 1.25; }
p, label, .identity { line-height: 1.45; }
.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 12px;
}
.felt {
    background: linear-gradient(155deg, #185c3b, #0c3a25);
    border: 4px solid var(--rail);
}
#login { max-width: 360px; margin: 14px auto 0; }
#login form { display: grid; gap: 8px; margin-top: 12px; }
#login label { margin-top: 5px; }
#login button { margin-top: 8px; }
label, .identity, .hint, #room-host { color: var(--muted); font-size: 14px; }
input, select, button, .button {
    font: inherit;
    min-height: 44px;
    border: 1px solid var(--line);
    padding: 8px 12px;
    border-radius: 8px;
    background: var(--raised);
    color: var(--text);
}
input { width: 100%; }
input, select { font-size: 16px; }
button, .button { cursor: pointer; }
.button { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
button:disabled { opacity: .55; cursor: default; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
button:hover:enabled, .button:hover { border-color: var(--gold); }
.primary { background: var(--gold); color: var(--room); border-color: var(--gold); font-weight: 700; min-height: 46px; }
.quiet { background: transparent; }
.profile-trigger { max-width: 100%; overflow-wrap: anywhere; color: var(--text); }
.profile-trigger:disabled { opacity: 1; border-color: transparent; }
.controls { margin-top: 12px; }
.hint { margin-top: 8px; color: #d0ddd5; }
#room-host { margin-top: 4px; color: #d0ddd5; }
.rooms, .seats { list-style: none; padding: 0; margin: 12px 0 0; }
.rooms li, .seats li { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.rooms li > div { min-width: 0; overflow-wrap: anywhere; }
.rooms li > button { flex: none; }
.rooms li + li { margin-top: 8px; }
.seats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.seats li { background: var(--raised); border: 1px solid var(--line); border-radius: 12px; padding: 5px 8px 5px 10px; min-height: 56px; }
.seat-label { display: flex; align-items: center; gap: 8px; min-width: 0; }
.seat-details { min-width: 0; }
.seat-career-tag { display: block; overflow: hidden; text-overflow: ellipsis; font-size: 11px; line-height: 1.3; white-space: nowrap; }
.career-mark {
    --tag-ink: #c9d2cd;
    --tag-lit: #eef3ef;
    --tag-halo: rgb(204 223 211 / 28%);
    color: var(--tag-ink);
}
.career-mark.positive { --tag-ink: #e6b54f; --tag-lit: #ffda72; --tag-halo: rgb(255 190 55 / 36%); color: var(--tag-ink); }
.career-mark.negative { --tag-ink: #8cdb6a; --tag-lit: #b0ff80; --tag-halo: rgb(111 225 61 / 36%); color: var(--tag-ink); }
.career-mark.is-lit { color: var(--tag-lit); text-shadow: 0 0 7px var(--tag-halo); }
.seat-icon {
    display: inline-grid;
    place-items: center;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 50%;
    background: var(--panel);
    color: var(--gold);
    font-weight: 700;
}
.seats .empty { background: transparent; border-style: dashed; }
.room-meta, .seat-meta { display: block; color: var(--muted); font-size: 12px; }
.seat-name { overflow-wrap: anywhere; }
.message { color: #efaa9f; min-height: 24px; margin: 8px 0 0; }
.message.success { color: #83d7a9; }
#login:not([hidden]) ~ .message { max-width: 360px; margin-inline: auto; }
#record-pages { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 12px; }
#page-number { color: var(--muted); font-size: 14px; }
.record-entry { min-width: 0; }
.record-total { font-variant-numeric: tabular-nums; white-space: nowrap; }
.positive { color: #83d7a9; }
.negative { color: #efaa9f; }
.room-dialog {
    position: fixed;
    inset: max(12px, env(safe-area-inset-top)) auto auto 12px;
    margin: 0;
    width: min(650px, calc(100% - 24px));
    max-height: calc(100% - 24px);
    padding: 16px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--panel);
    color: var(--text);
}
.room-dialog[open] { display: flex; flex-direction: column; }
.room-dialog:not([open]) { display: none; }
.room-dialog::backdrop { background: rgb(0 0 0 / 68%); }
#seat-kick { color: #efaa9f; }
.settlement-heading { align-items: flex-start; }
#settlement-details { margin-top: 6px; }
.settlement-body { flex: 1; min-height: 0; overflow: auto; margin-top: 12px; }
.settlement-table { overflow-x: auto; }
.settlement-table table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.settlement-table th, .settlement-table td { border-bottom: 1px solid var(--line); padding: 8px 4px; text-align: right; white-space: nowrap; }
.settlement-table th:first-child, .settlement-table td:first-child { text-align: left; }
.settlement-table th { color: var(--muted); font-size: 13px; }
.settlement-review { margin-top: 12px; border: 1px solid var(--line); border-radius: 10px; }
.settlement-review > summary { min-height: 44px; padding: 10px; cursor: pointer; font-weight: 650; }
.settlement-review > summary .room-meta { display: inline; margin-inline-start: 6px; font-weight: 400; }
@media (max-width: 510px) {
    .seats { grid-template-columns: 1fr; }
    .identity button { padding-inline: 8px; }
}
@media (max-height: 520px) {
    main { padding-block: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-bottom)); }
    header { padding-bottom: 8px; }
    .wordmark-main { font-size: 36px; }
    .records-panel { padding: 12px; }
}
