/* 超究極ヨット1000 — 朱塗りの巨大おぼん × 遊び盤のスコア表 */
:root {
    --bg: #1d1410;
    --panel: #fffaf0;
    --ink: #23232e;
    --muted: #6f6a60;
    --line: #e2d8c4;
    --red: #c8352a;
    --red-d: #8f1d16;
    --gold: #e8b04a;
    --gold-d: #a8771c;
    --basic: #2f9e5b;
    --mid: #2f6fd6;
    --hard: #c43a6b;
    --special: #c88a12;
    --ok: #1f9a55;
    --can: #2f6fd6;
    --no: #9b958a;
    --f1: #e8443a;
    --f2: #3a7be0;
    --f3: #38a852;
    --f4: #e0a02a;
    --f5: #8a4fd0;
    --f6: #3c3c3c;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    height: 100%;
    background: var(--bg) radial-gradient(ellipse at 40% 0%, #3a2418, #140d0a 70%);
    color: var(--ink);
    font-family: "Hiragino Maru Gothic ProN", "BIZ UDPGothic", "Yu Gothic UI", "Meiryo", "Noto Sans CJK JP", sans-serif;
}

body {
    overflow-x: hidden;
}

.hidden {
    display: none !important;
}

button {
    font-family: inherit;
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
}

:focus-visible {
    outline: 3px solid var(--gold);
    outline-offset: 2px;
}

/* ---------- ヘッダー ---------- */
.top {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    color: #fbeedd;
    background: linear-gradient(#2b1a12, #20140e);
    border-bottom: 2px solid #4a2c1b;
    flex-wrap: wrap;
}

.logo {
    font-weight: 900;
    font-size: 18px;
    letter-spacing: .03em;
    white-space: nowrap;
}

.logo b {
    color: var(--gold);
    font-family: "Arial Black", sans-serif;
    margin-left: 2px;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .15);
    font-size: 13px;
    white-space: nowrap;
}

.chip b {
    font-size: 17px;
    font-variant-numeric: tabular-nums;
}

.chip.score b {
    color: var(--gold);
    font-size: 22px;
}

.spacer {
    flex: 1;
}

.iconbtn {
    background: rgba(255, 255, 255, .08);
    color: #fbeedd;
    border: 1px solid rgba(255, 255, 255, .25);
    border-radius: 8px;
    padding: 4px 10px;
    font-size: 13px;
}

.iconbtn:hover {
    background: rgba(255, 255, 255, .18);
}

/* ---------- レイアウト ---------- */
.layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 430px;
    gap: 12px;
    padding: 10px 12px 14px;
    height: calc(100vh - 46px);
    min-height: 640px;
}

.stagecol {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
    min-height: 0;
}

.sidecol {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
}

@media (max-width: 1080px) {
    .layout {
        grid-template-columns: 1fr;
        height: auto;
    }

    .sidecol {
        min-height: auto;
    }

    #stage {
        height: 58vh !important;
        min-height: 340px;
        flex: none !important;
    }
}

/* ---------- ステージ（おぼん） ---------- */
#stage {
    position: relative;
    flex: 1;
    min-height: 300px;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .5), inset 0 0 0 1px rgba(255, 255, 255, .06);
    touch-action: none;
    cursor: grab;
}

#stage.dragging {
    cursor: grabbing;
}

#gl {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
}

.hud {
    position: absolute;
    pointer-events: none;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, .7);
}

.hud-tl {
    left: 12px;
    top: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.hud-tr {
    right: 12px;
    top: 10px;
    text-align: right;
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-end;
}

.roundbox {
    background: rgba(20, 12, 8, .72);
    border: 2px solid var(--gold);
    border-radius: 12px;
    padding: 4px 12px;
    font-weight: 900;
}

.roundbox .big {
    font-size: 26px;
    font-family: "Arial Black", sans-serif;
}

.windbox {
    background: rgba(20, 12, 8, .72);
    border-radius: 12px;
    padding: 4px 10px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
    border: 2px solid #7fd3ff;
}

.windbox .flag {
    font-size: 18px;
}

.throws {
    background: rgba(20, 12, 8, .72);
    border-radius: 12px;
    padding: 5px 12px;
    font-size: 13px;
}

.pips {
    display: inline-flex;
    gap: 4px;
    margin-left: 6px;
    vertical-align: middle;
}

.pips i {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    border: 2px solid #fff;
    display: inline-block;
}

.pips i.on {
    background: var(--gold);
    border-color: var(--gold);
}

.pips i.extra {
    border-style: dashed;
}

.combo {
    background: linear-gradient(90deg, #ff7a2f, #ffcf3f);
    color: #3a1600;
    text-shadow: none;
    padding: 3px 12px;
    border-radius: 12px;
    font-weight: 900;
    font-size: 15px;
    transform-origin: right center;
}

.combo.bump {
    animation: bump .4s;
}

@keyframes bump {
    30% {
        transform: scale(1.35);
    }
}

#coach {
    position: absolute;
    left: 50%;
    bottom: 12px;
    transform: translateX(-50%);
    background: rgba(255, 250, 240, .95);
    color: var(--ink);
    border-radius: 999px;
    padding: 7px 18px;
    font-weight: 700;
    font-size: 15px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .35);
    white-space: nowrap;
    max-width: 94%;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
}

#coach .k {
    display: inline-block;
    border: 1px solid #999;
    border-bottom-width: 3px;
    border-radius: 5px;
    padding: 0 6px;
    font-size: 12px;
    margin: 0 2px;
    background: #fff;
}

#say {
    position: absolute;
    left: 12px;
    bottom: 56px;
    max-width: 46%;
    background: rgba(20, 12, 8, .78);
    color: #ffe9c8;
    border-left: 4px solid var(--gold);
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 13px;
    opacity: 0;
    transition: opacity .25s;
    pointer-events: none;
}

#say.show {
    opacity: 1;
}

#rolling-tag {
    position: absolute;
    right: 12px;
    bottom: 56px;
    pointer-events: auto;
}

#rolling-tag button {
    background: rgba(20, 12, 8, .8);
    color: #fff;
    border: 1px solid #fff8;
    border-radius: 999px;
    padding: 5px 12px;
    font-size: 13px;
}

/* 結果バナー */
#banner {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

#banner .card {
    pointer-events: auto;
    cursor: pointer;
    text-align: center;
    padding: 16px 34px 18px;
    border-radius: 18px;
    background: rgba(255, 250, 240, .96);
    box-shadow: 0 12px 40px rgba(0, 0, 0, .55);
    border: 5px solid var(--gold);
    animation: bannerIn .35s cubic-bezier(.2, 1.6, .4, 1);
    min-width: 300px;
}

#banner .card.t-hard, #banner .card.t-special {
    border-color: #ff4f8b;
    background: linear-gradient(#fffaf0, #fff0d0);
}

#banner .card.zero {
    border-color: #999;
}

#banner .tierline {
    font-size: 13px;
    font-weight: 700;
    color: var(--muted);
    letter-spacing: .1em;
}

#banner .rname {
    font-size: 40px;
    font-weight: 900;
    line-height: 1.15;
}

#banner .pts {
    font-size: 54px;
    font-weight: 900;
    font-family: "Arial Black", sans-serif;
    color: var(--red);
    font-variant-numeric: tabular-nums;
}

#banner .mods {
    display: flex;
    gap: 6px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 4px;
}

#banner .mods span {
    font-size: 13px;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 999px;
    background: #f1e7d2;
}

#banner .mods .w {
    background: #d9f1ff;
    color: #0c5a86;
}

#banner .mods .c {
    background: #ffe1c4;
    color: #8a3a00;
}

#banner .mods .t {
    background: #fff0b0;
    color: #6a4b00;
}

#banner .skip {
    font-size: 11px;
    color: var(--muted);
    margin-top: 6px;
}

@keyframes bannerIn {
    from {
        transform: scale(.4) rotate(-6deg);
        opacity: 0;
    }
}

#flash {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(circle, rgba(255, 240, 180, .9), rgba(255, 200, 80, 0) 70%);
    opacity: 0;
}

#flash.go {
    animation: flash .9s ease-out;
}

@keyframes flash {
    0% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

/* ---------- 操作バー ---------- */
.controls {
    display: grid;
    grid-template-columns: minmax(220px, 1.1fr) minmax(0, 2fr);
    gap: 8px;
}

@media (max-width: 760px) {
    .controls {
        grid-template-columns: 1fr;
    }
}

.actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

#shake {
    position: relative;
    font-size: 22px;
    font-weight: 900;
    padding: 14px 10px 12px;
    border: 0;
    border-radius: 14px;
    color: #fff;
    background: linear-gradient(#e2473a, #b82519);
    box-shadow: 0 6px 0 var(--red-d), 0 10px 18px rgba(0, 0, 0, .35);
    letter-spacing: .04em;
    transition: transform .06s;
}

#shake small {
    display: block;
    font-size: 12px;
    font-weight: 700;
    opacity: .9;
    letter-spacing: 0;
}

#shake:hover:not(:disabled) {
    filter: brightness(1.08);
}

#shake:active:not(:disabled) {
    transform: translateY(5px);
    box-shadow: 0 1px 0 var(--red-d);
}

#shake:disabled {
    background: #6b5a52;
    box-shadow: 0 6px 0 #3e322c;
    color: #e6dcd5;
}

#shake.ready {
    animation: glow 1.6s infinite;
}

@keyframes glow {
    50% {
        box-shadow: 0 6px 0 var(--red-d), 0 0 26px 4px rgba(255, 200, 90, .65);
    }
}

.subactions {
    display: flex;
    gap: 6px;
}

.subactions button {
    flex: 1;
    padding: 8px 6px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 13px;
    border: 2px solid var(--gold-d);
    background: #fff4d6;
    color: #4a3200;
}

.subactions button:disabled {
    opacity: .45;
    border-color: #8a7a5a;
}

.why {
    font-size: 12px;
    color: #e9d9c4;
    min-height: 16px;
}

.holds {
    background: var(--panel);
    border-radius: 14px;
    padding: 8px 10px;
}

.holds-head {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-weight: 900;
    font-size: 14px;
    flex-wrap: wrap;
}

.holds-head .sum {
    margin-left: auto;
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
}

.holds-head .sum b {
    color: var(--gold-d);
    font-size: 14px;
}

.hgrid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 6px;
    margin-top: 6px;
}

@media (max-width: 520px) {
    .hgrid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.hcell {
    position: relative;
    border: 2px solid var(--line);
    border-radius: 10px;
    padding: 4px 4px 5px;
    text-align: center;
    background: #fff;
}

.hcell.held {
    border-color: var(--gold);
    background: #fff7df;
    box-shadow: 0 0 0 2px rgba(232, 176, 74, .35);
}

.hcell.wind::after {
    content: "追い風";
    position: absolute;
    top: -9px;
    right: -4px;
    font-size: 10px;
    background: #7fd3ff;
    color: #063a57;
    padding: 0 5px;
    border-radius: 6px;
    font-weight: 900;
}

.die {
    display: inline-grid;
    width: 30px;
    height: 30px;
    border-radius: 7px;
    background: #fff;
    border: 2px solid var(--fc, #333);
    grid-template: repeat(3, 1fr) / repeat(3, 1fr);
    padding: 3px;
    vertical-align: middle;
    box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .08);
}

.die i {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--fc, #222);
    align-self: center;
    justify-self: center;
}

.die.sm {
    width: 20px;
    height: 20px;
    border-radius: 5px;
    padding: 2px;
    border-width: 1.5px;
}

.die.sm i {
    width: 4px;
    height: 4px;
}

.hcell .cnt {
    font-size: 20px;
    font-weight: 900;
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}

.hcell .meter {
    height: 6px;
    border-radius: 3px;
    background: #eee6d2;
    position: relative;
    overflow: hidden;
    margin: 2px 0 3px;
}

.hcell .meter i {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    background: var(--fc);
    opacity: .55;
}

.hcell .meter i.h {
    background: var(--gold);
    opacity: 1;
    top: 1px;
    bottom: 1px;
}

.hcell .keep {
    font-size: 11px;
    color: var(--muted);
}

.hcell .keep b {
    color: var(--gold-d);
    font-size: 14px;
}

.hcell .row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px;
    margin-top: 3px;
}

.hcell .row button {
    min-width: 0;
    padding: 2px 0;
    font-size: 11px;
    border: 1px solid #c9bc9b;
    background: #fff;
    border-radius: 5px;
    font-variant-numeric: tabular-nums;
}

.hcell .toggle {
    width: 100%;
    margin-top: 3px;
    padding: 4px 0;
    font-size: 12px;
    font-weight: 900;
    border-radius: 6px;
    border: 2px solid var(--gold-d);
    background: #fff;
    color: #5a3d00;
}

.hcell.held .toggle {
    background: var(--gold);
    color: #3a2500;
}

.hcell button:disabled {
    opacity: .4;
}

/* ---------- スコアシート ---------- */
.sheet {
    background: var(--panel);
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1;
    overflow: hidden;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .35);
}

.sheet-top {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #2a1c14;
    color: #fbeedd;
}

.sheet-top .t {
    font-weight: 900;
    font-size: 16px;
}

.sheet-top .tot {
    margin-left: auto;
    font-size: 13px;
}

.sheet-top .tot b {
    font-size: 26px;
    color: var(--gold);
    font-family: "Arial Black", sans-serif;
    font-variant-numeric: tabular-nums;
}

.sheet-scroll {
    overflow: auto;
    flex: 1;
}

table.roles {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.roles thead th {
    position: sticky;
    top: 0;
    background: #f3e8d2;
    font-size: 11px;
    color: var(--muted);
    font-weight: 700;
    padding: 4px 6px;
    text-align: right;
    z-index: 1;
}

.roles thead th:first-child {
    text-align: left;
}

.roles tr.grp td {
    background: #efe2c8;
    font-weight: 900;
    font-size: 12px;
    padding: 3px 8px;
    color: #5a4a30;
}

.roles tr.role {
    border-bottom: 1px solid var(--line);
    cursor: pointer;
}

.roles tr.role:hover {
    background: #fff1c9;
}

.roles tr.role.sel {
    background: #ffe9a6;
    box-shadow: inset 4px 0 0 var(--red);
}

.roles tr.role.done {
    cursor: default;
    background: #f1ece3;
    color: #8b857a;
}

.roles td {
    padding: 5px 6px;
    vertical-align: middle;
}

.roles td.name {
    line-height: 1.2;
}

.roles td.name b {
    font-size: 15px;
}

.roles td.name small {
    display: block;
    font-size: 10.5px;
    color: var(--muted);
    font-weight: 400;
}

.tierb {
    display: inline-block;
    font-size: 9.5px;
    font-weight: 900;
    color: #fff;
    padding: 1px 5px;
    border-radius: 5px;
    margin-right: 4px;
    vertical-align: 2px;
    letter-spacing: -.02em;
}

.t-basic .tierb, .tierb.t-basic {
    background: var(--basic);
}

.t-mid .tierb, .tierb.t-mid {
    background: var(--mid);
}

.t-hard .tierb, .tierb.t-hard {
    background: var(--hard);
}

.t-special .tierb, .tierb.t-special {
    background: var(--special);
}

.st {
    display: inline-block;
    font-size: 11px;
    font-weight: 900;
    padding: 2px 6px;
    border-radius: 6px;
    white-space: nowrap;
    border: 2px solid;
}

.st.ok {
    color: #fff;
    background: var(--ok);
    border-color: var(--ok);
}

.st.can {
    color: var(--can);
    border-color: var(--can);
    background: #eaf1ff;
}

.st.part {
    color: #8a6400;
    border-color: #d9b45a;
    background: #fff7dc;
}

.st.no {
    color: var(--no);
    border-color: #cfc8ba;
    border-style: dashed;
    background: #fff;
}

.st.done {
    color: #6c675f;
    border-color: #bdb6a8;
    background: #e8e2d6;
}

.roles td.now {
    text-align: right;
    font-weight: 900;
    font-size: 15px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.roles td.now .w {
    font-size: 10px;
    color: #0c5a86;
    display: block;
    font-weight: 700;
}

.roles td.p {
    text-align: right;
    font-size: 12px;
    color: #33507e;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.roles td.p .rec {
    display: block;
    color: var(--red);
    font-weight: 900;
    font-size: 10.5px;
}

.roles td.fin {
    text-align: right;
    width: 76px;
}

.roles td.fin .v {
    font-weight: 900;
    font-size: 15px;
    color: #1d3c8f;
    font-variant-numeric: tabular-nums;
}

.roles td.fin .v small {
    display: block;
    font-size: 9.5px;
    color: var(--muted);
    font-weight: 400;
}

.commit {
    border: 0;
    background: var(--red);
    color: #fff;
    font-weight: 900;
    padding: 6px 8px;
    border-radius: 8px;
    font-size: 12px;
    box-shadow: 0 3px 0 var(--red-d);
    white-space: nowrap;
}

.commit.zero {
    background: #8f8a80;
    box-shadow: 0 3px 0 #5e5a53;
}

.roles tr.sub td {
    background: #f6efdc;
    font-size: 12px;
    padding: 5px 8px;
}

.bonusbar {
    height: 8px;
    background: #e7dcc4;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 3px;
}

.bonusbar i {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--gold), #ff9b3d);
}

@media (max-width: 560px) {
    table.roles {
        font-size: 12px;
    }

    .roles td {
        padding: 4px 3px;
    }

    .roles td.name {
        min-width: 104px;
    }

    .roles td.name b {
        font-size: 13px;
        white-space: nowrap;
    }

    .roles td.name small {
        font-size: 9.5px;
    }

    .st {
        font-size: 9.5px;
        padding: 1px 3px;
        border-width: 1.5px;
    }

    .roles td.now {
        font-size: 13px;
    }

    .roles td.fin {
        width: auto;
    }

    .commit {
        padding: 5px 5px;
        font-size: 11px;
    }

    .hcell .row button {
        font-size: 10px;
    }
}

/* 選択中の役 */
#detail {
    background: var(--panel);
    border-radius: 14px;
    padding: 10px 12px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .35);
}

#detail .dh {
    display: flex;
    align-items: center;
    gap: 8px;
}

#detail .dn {
    font-size: 20px;
    font-weight: 900;
}

#detail .cond {
    font-size: 12.5px;
    margin: 4px 0;
}

#detail .meta {
    font-size: 12px;
    color: var(--muted);
}

#detail .prog {
    height: 10px;
    background: #eee3cb;
    border-radius: 5px;
    overflow: hidden;
    margin: 6px 0 2px;
}

#detail .prog i {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #6fcf97, var(--ok));
    transition: width .3s;
}

#detail .prog.full i {
    background: linear-gradient(90deg, var(--gold), #ff9b3d);
}

#detail .ptext {
    font-size: 12.5px;
    font-weight: 700;
}

#detail .plan {
    margin-top: 6px;
    font-size: 12.5px;
    background: #fff3d6;
    border: 1px dashed var(--gold-d);
    border-radius: 8px;
    padding: 5px 8px;
}

#detail .btns {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}

#detail .btns button {
    flex: 1;
    padding: 9px 4px;
    border-radius: 10px;
    font-weight: 900;
    font-size: 14px;
}

#aim {
    border: 2px solid var(--mid);
    background: #eaf1ff;
    color: #123c88;
}

#aim.on {
    background: var(--mid);
    color: #fff;
}

#commitSel {
    border: 0;
    background: var(--red);
    color: #fff;
    box-shadow: 0 4px 0 var(--red-d);
}

#detail button:disabled {
    opacity: .45;
}

#detail .empty {
    font-size: 13px;
    color: var(--muted);
}

/* ---------- 画面（タイトル・結果・ヘルプ・設定） ---------- */
.screen {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow: auto;
    padding: 24px 12px;
    background: rgba(10, 6, 4, .78);
}

.screen.solid {
    background: radial-gradient(ellipse at 50% 20%, #4a2a1a, #120a07 75%);
}

.card {
    width: min(760px, 100%);
    background: var(--panel);
    border-radius: 18px;
    padding: 22px 26px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .6);
    position: relative;
}

.title-hero {
    text-align: center;
}

.title-hero .tray-art {
    width: 220px;
    height: 120px;
    margin: 0 auto -6px;
}

.title-hero h1 {
    margin: 6px 0 0;
    font-size: clamp(34px, 7vw, 58px);
    line-height: 1;
    font-weight: 900;
}

.title-hero h1 span {
    display: block;
    color: var(--red);
    font-family: "Arial Black", sans-serif;
    font-size: 1.5em;
    letter-spacing: .02em;
    text-shadow: 0 4px 0 #f0c76a;
}

.title-hero .sub {
    font-size: 16px;
    letter-spacing: .25em;
    color: var(--muted);
    margin: 8px 0 14px;
}

.bigbtn {
    font-size: 22px;
    font-weight: 900;
    padding: 14px 44px;
    border: 0;
    border-radius: 14px;
    color: #fff;
    background: linear-gradient(#e2473a, #b82519);
    box-shadow: 0 6px 0 var(--red-d);
}

.bigbtn:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0 var(--red-d);
}

.ghost {
    font-size: 14px;
    font-weight: 700;
    padding: 9px 18px;
    border-radius: 10px;
    border: 2px solid #8a7a5a;
    background: #fff;
    color: #4a3a20;
}

.steps {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin: 16px 0 8px;
}

@media (max-width: 640px) {
    .steps {
        grid-template-columns: repeat(2, 1fr);
    }
}

.steps div {
    background: #fff;
    border: 2px solid var(--line);
    border-radius: 12px;
    padding: 8px;
    font-size: 12.5px;
    text-align: left;
}

.steps b {
    display: block;
    font-size: 14px;
    margin-bottom: 2px;
}

.steps .n {
    display: inline-block;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--red);
    color: #fff;
    text-align: center;
    line-height: 22px;
    font-weight: 900;
    margin-right: 4px;
}

.stats {
    font-size: 13px;
    text-align: center;
    color: #4d463a;
}

.stats b {
    font-size: 16px;
}

.card h3 {
    font-size: 14px;
    margin: 16px 0 6px;
    padding-bottom: 3px;
    border-bottom: 2px solid var(--line);
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.chips span, .chips button {
    font-size: 12px;
    border: 1px solid #cfc3a6;
    padding: 3px 9px;
    border-radius: 999px;
    color: #a59c8a;
    background: #fff;
}

.chips span.got {
    color: var(--ink);
    border-color: var(--ink);
    font-weight: 700;
}

.chips button {
    color: var(--ink);
}

.chips button.sel {
    background: var(--ink);
    color: #fff;
}

.chips button:disabled {
    color: #b9b1a1;
}

.rtable {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.rtable td {
    padding: 5px 6px;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}

.rtable td:first-child {
    white-space: nowrap;
    font-weight: 900;
}

.cert-score {
    font-size: 64px;
    font-weight: 900;
    text-align: center;
    color: var(--red);
    font-family: "Arial Black", sans-serif;
    line-height: 1.1;
}

.cert-score small {
    font-size: 20px;
}

.rank {
    text-align: center;
    font-size: 18px;
    font-weight: 900;
}

.newrec {
    text-align: center;
    color: #fff;
    background: var(--red);
    border-radius: 999px;
    display: table;
    margin: 6px auto;
    padding: 3px 16px;
    font-weight: 900;
    animation: bump .6s 2;
}

.btnrow {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 16px;
    flex-wrap: wrap;
}

.setrow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
    font-size: 14px;
}

.setrow small {
    display: block;
    color: var(--muted);
    font-size: 12px;
}

.seg {
    display: inline-flex;
    border: 2px solid var(--ink);
    border-radius: 10px;
    overflow: hidden;
}

.seg button {
    border: 0;
    background: #fff;
    padding: 6px 12px;
    font-weight: 700;
    font-size: 13px;
}

.seg button.on {
    background: var(--ink);
    color: #fff;
}

.close-x {
    position: absolute;
    right: 12px;
    top: 10px;
    border: 0;
    background: none;
    font-size: 24px;
    color: var(--muted);
}

#toast {
    position: fixed;
    left: 50%;
    top: 58px;
    transform: translateX(-50%) translateY(-30px);
    opacity: 0;
    background: #2a1c14;
    color: var(--gold);
    padding: 9px 18px;
    border-radius: 999px;
    font-weight: 900;
    transition: all .25s;
    z-index: 60;
    border: 2px solid var(--gold);
    pointer-events: none;
}

#toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
