:root {
    --bg: #efe9dc;
    --surface: rgba(250, 246, 235, 0.78);
    --surface-strong: #fbf6e8;
    --line: rgba(55, 70, 49, 0.2);
    --text: #1d2e20;
    --muted: #68705f;
    --soft: #9a937f;
    --primary: #315b47;
    --primary-strong: #132a1d;
    --accent: #b68a44;
    --accent-soft: #ead8b8;
    --danger: #be3f5b;
    --success: #2a9f72;
    --shadow: 0 24px 72px rgba(25, 31, 56, 0.18);
    --shadow-soft: 0 12px 30px rgba(25, 31, 56, 0.11);
    --radius: 8px;
    --font: Inter, "Noto Serif SC", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

body {
    margin: 0;
    width: 100%;
    height: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    font-family: var(--font);
    color: var(--text);
    background:
        radial-gradient(circle at 12% 8%, rgba(42, 48, 43, 0.16), transparent 23%),
        radial-gradient(circle at 86% 0%, rgba(72, 94, 68, 0.16), transparent 20%),
        linear-gradient(115deg, rgba(48, 85, 66, 0.08), transparent 35%),
        linear-gradient(245deg, rgba(182, 138, 68, 0.14), transparent 38%),
        var(--bg);
    overflow: hidden;
    overscroll-behavior: none;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
}

body::before,
body::after {
    content: "";
    position: fixed;
    pointer-events: none;
    z-index: -1;
}

body::before {
    inset: 0;
    background:
        linear-gradient(90deg, rgba(45, 45, 38, 0.08) 1px, transparent 1px) 0 0 / 42px 42px,
        linear-gradient(rgba(45, 45, 38, 0.04) 1px, transparent 1px) 0 0 / 42px 42px;
    mask-image: radial-gradient(circle at 50% 50%, transparent 0%, rgba(0,0,0,0.45) 55%, rgba(0,0,0,0.85) 100%);
}

body::after {
    right: 18px;
    top: 12px;
    width: 220px;
    height: 160px;
    background:
        linear-gradient(135deg, transparent 48%, rgba(42, 68, 45, 0.35) 49%, rgba(42, 68, 45, 0.35) 51%, transparent 52%),
        radial-gradient(ellipse at 78% 22%, rgba(42, 68, 45, 0.28), transparent 48%);
    opacity: 0.8;
    transform: rotate(-8deg);
}

body.is-playing::before {
    inset: 0;
    opacity: 1;
    mask-image: none;
    background:
        radial-gradient(circle at 50% 45%, rgba(255, 248, 218, 0.42), transparent 18%),
        radial-gradient(circle at 24% 18%, rgba(78, 122, 91, 0.34), transparent 24%),
        radial-gradient(circle at 84% 16%, rgba(214, 178, 101, 0.26), transparent 22%),
        linear-gradient(90deg, rgba(45, 45, 38, 0.075) 1px, transparent 1px) 0 0 / 38px 38px,
        linear-gradient(rgba(45, 45, 38, 0.045) 1px, transparent 1px) 0 0 / 38px 38px,
        linear-gradient(135deg, #d8d0b8, #f1ead9 45%, #d2cbb7);
}

body.is-playing::after {
    left: auto;
    right: -16vw;
    top: -18vh;
    width: 72vw;
    height: 92vh;
    opacity: 0.9;
    transform: rotate(9deg);
    mix-blend-mode: screen;
    background:
        linear-gradient(103deg, transparent 0 18%, rgba(255, 248, 196, 0.42) 24%, transparent 31%),
        linear-gradient(107deg, transparent 0 36%, rgba(255, 229, 146, 0.24) 43%, transparent 52%),
        radial-gradient(ellipse at 70% 28%, rgba(255, 246, 201, 0.38), transparent 44%);
}

button,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
}

.game-hidden,
.home-hidden {
    display: none !important;
}

.home-screen {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    padding: 28px;
    display: grid;
    align-items: start;
    justify-items: center;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    touch-action: pan-y;
}

.home-bg-card {
    width: min(1180px, 100%);
    min-height: calc(100vh - 56px);
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.95fr);
    gap: 42px;
    align-items: center;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(57, 70, 52, 0.22);
    border-radius: 10px;
    padding: clamp(28px, 5vw, 58px);
    background:
        linear-gradient(90deg, rgba(255,255,255,0.68), rgba(255,255,255,0.2)),
        radial-gradient(circle at 80% 12%, rgba(49, 91, 71, 0.16), transparent 28%),
        linear-gradient(135deg, rgba(250, 246, 235, 0.92), rgba(238, 230, 210, 0.82));
    box-shadow: 0 30px 90px rgba(33, 37, 31, 0.18);
}

.home-bg-card::before,
.home-bg-card::after {
    content: "";
    position: absolute;
    pointer-events: none;
}

.home-bg-card::before {
    inset: 14px;
    border: 1px solid rgba(57, 70, 52, 0.16);
    border-radius: 8px;
}

.home-bg-card::after {
    right: -70px;
    bottom: -90px;
    width: 340px;
    height: 260px;
    background:
        radial-gradient(ellipse at 62% 62%, rgba(49, 91, 71, 0.24), transparent 45%),
        linear-gradient(135deg, transparent 48%, rgba(37, 61, 42, 0.32) 49%, rgba(37, 61, 42, 0.32) 51%, transparent 52%);
    opacity: 0.72;
    transform: rotate(-12deg);
}

.home-content,
.home-preview {
    position: relative;
    z-index: 1;
    pointer-events: none;
}

.home-brand {
    grid-column: 1;
    grid-row: 1;
    display: flex;
    align-items: center;
    gap: 24px;
}

.home-logo {
    width: clamp(96px, 12vw, 138px);
    height: clamp(96px, 12vw, 138px);
    object-fit: cover;
    border-radius: 28px;
    border: 2px solid rgba(222, 183, 91, 0.95);
    box-shadow: 0 18px 34px rgba(47, 34, 21, 0.26);
}

.home-brand h1 {
    margin: 0;
    font-family: "Noto Serif SC", serif;
    font-size: clamp(2.7rem, 6.5vw, 5.4rem);
    line-height: 1;
    letter-spacing: 0;
    color: #20231d;
}

.home-brand p {
    margin: 14px 0 0;
    color: var(--muted);
    font-size: clamp(0.85rem, 1.5vw, 1.05rem);
    letter-spacing: 0.42em;
}

.home-copy {
    grid-column: 1;
    grid-row: 2;
    margin-top: clamp(28px, 5vw, 52px);
    max-width: 610px;
}

.home-copy span {
    color: #315b47;
    font-weight: 900;
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

.home-copy h2 {
    margin: 14px 0 16px;
    font-family: "Noto Serif SC", serif;
    font-size: clamp(2rem, 4.5vw, 4rem);
    line-height: 1.08;
    letter-spacing: 0;
}

.home-copy p {
    max-width: 540px;
    margin: 0;
    color: #4f584b;
    font-size: clamp(1rem, 1.8vw, 1.15rem);
    line-height: 1.85;
}

.home-actions {
    grid-column: 1;
    grid-row: 3;
    margin-top: 34px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.home-system-dock {
    grid-column: 1;
    grid-row: 4;
    position: relative;
    z-index: 12;
    display: grid;
    grid-template-columns: repeat(4, minmax(78px, 1fr));
    gap: 12px;
    max-width: 620px;
    margin-top: 10px;
}

.home-system-dock button {
    position: relative;
    min-height: 82px;
    display: grid;
    place-items: center;
    align-content: center;
    padding: 10px 10px 9px;
    text-align: center;
    isolation: isolate;
    overflow: hidden;
    border: 1px solid rgba(244, 217, 140, 0.22);
    border-radius: 24px;
    background:
        radial-gradient(circle at 50% -20%, rgba(255, 238, 173, 0.32), transparent 42%),
        linear-gradient(145deg, rgba(35, 47, 43, 0.86), rgba(16, 18, 23, 0.92));
    color: #f8efd8;
    backdrop-filter: blur(18px);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.18),
        inset 0 -18px 28px rgba(0, 0, 0, 0.18),
        0 22px 44px rgba(15, 21, 25, 0.28);
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.home-system-dock button::before,
.home-system-dock button::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
}

.home-system-dock button::before {
    z-index: -1;
    background:
        linear-gradient(115deg, transparent 0 32%, rgba(255,255,255,0.22) 48%, transparent 64%),
        radial-gradient(circle at 18% 16%, rgba(255,255,255,0.2), transparent 32%);
    opacity: 0.58;
}

.home-system-dock button::after {
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.2);
}

.home-system-dock button:hover,
.home-system-dock button:focus-visible {
    border-color: rgba(255, 224, 135, 0.58);
    transform: translateY(-3px);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.22),
        inset 0 -18px 28px rgba(0, 0, 0, 0.16),
        0 26px 54px rgba(15, 21, 25, 0.34),
        0 0 0 4px rgba(244, 217, 140, 0.12);
}

.home-system-dock button:active {
    transform: translateY(0) scale(0.985);
}

.home-system-dock button.active {
    border-color: rgba(255, 224, 135, 0.7);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.24),
        0 28px 62px rgba(15, 21, 25, 0.38),
        0 0 0 5px rgba(244, 217, 140, 0.12),
        0 0 34px rgba(244, 217, 140, 0.28);
}

.dock-card .dock-icon,
.dock-card strong,
.dock-card em {
    display: block;
}

.dock-card .dock-icon {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    margin: 0 auto 5px;
    border-radius: 12px;
    background:
        radial-gradient(circle at 34% 22%, rgba(255, 255, 255, 0.42), transparent 28%),
        linear-gradient(145deg, rgba(244, 217, 140, 0.26), rgba(244, 217, 140, 0.08));
    color: #f4d98c;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.22),
        0 12px 24px rgba(0, 0, 0, 0.2);
}

.dock-card .dock-icon svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.dock-card strong {
    color: #fff5d8;
    font-family: "Noto Serif SC", serif;
    font-size: 0.94rem;
    line-height: 1.1;
}

.dock-card em {
    margin-top: 3px;
    color: rgba(248, 239, 216, 0.56);
    font-size: 0.68rem;
    font-style: normal;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.dock-lobby {
    background:
        radial-gradient(circle at 50% -20%, rgba(255, 226, 143, 0.36), transparent 44%),
        linear-gradient(145deg, rgba(47, 63, 56, 0.92), rgba(16, 18, 23, 0.94)) !important;
}

.dock-levels {
    background:
        radial-gradient(circle at 50% -20%, rgba(116, 208, 169, 0.3), transparent 44%),
        linear-gradient(145deg, rgba(28, 70, 54, 0.9), rgba(14, 20, 20, 0.94)) !important;
}

.dock-ranked {
    background:
        radial-gradient(circle at 50% -20%, rgba(202, 164, 255, 0.28), transparent 44%),
        linear-gradient(145deg, rgba(50, 38, 69, 0.9), rgba(17, 18, 25, 0.94)) !important;
}

.dock-store {
    background:
        radial-gradient(circle at 50% -20%, rgba(255, 205, 104, 0.34), transparent 44%),
        linear-gradient(145deg, rgba(83, 58, 29, 0.9), rgba(18, 17, 19, 0.94)) !important;
}


.home-web3-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    right: auto;
    bottom: auto;
    z-index: 60;
    width: min(1080px, calc(100vw - 32px));
    height: auto;
    max-height: min(760px, calc(100dvh - 32px));
    display: none;
    grid-template-columns: 1fr;
    gap: 14px;
    margin: 0;
    padding: 18px;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    transform: translate(-50%, -50%);
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 28px;
    background:
        radial-gradient(circle at 18% 6%, rgba(244, 217, 140, 0.16), transparent 24%),
        linear-gradient(135deg, rgba(255,255,255,0.12), rgba(255,255,255,0.04)),
        rgba(13, 16, 23, 0.88);
    color: #f8efd8;
    backdrop-filter: blur(20px);
    box-shadow: 0 36px 120px rgba(0,0,0,0.46);
    touch-action: pan-y;
}

.home-web3-panel.open {
    display: grid;
}

.home-web3-panel::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background: rgba(0,0,0,0.42);
    pointer-events: none;
}

.home-panel-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.home-panel-toolbar span,
.home-panel-toolbar strong {
    display: block;
}

.home-panel-toolbar span {
    color: rgba(248, 239, 216, 0.56);
    font-size: 0.76rem;
    font-weight: 900;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.home-panel-toolbar strong {
    margin-top: 4px;
    font-family: "Noto Serif SC", serif;
    font-size: clamp(1.45rem, 3vw, 2.2rem);
}

.home-panel-close {
    width: 42px;
    height: 42px;
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
    color: #f8efd8;
    font-size: 1.35rem;
}

.home-web3-panel .home-module {
    display: none;
}

.home-web3-panel .home-module.active {
    display: block;
}

.home-module {
    min-height: 0;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 20px;
    padding: 16px;
    background:
        linear-gradient(135deg, rgba(255,255,255,0.12), rgba(255,255,255,0.04)),
        rgba(255,255,255,0.04);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.18);
    backdrop-filter: blur(12px);
}

.home-module-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    color: #f8efd8;
    font-weight: 900;
}

.home-module-head span {
    font-family: "Noto Serif SC", serif;
    font-size: 1.06rem;
}

.home-module-head strong {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(255,255,255,0.1);
    color: rgba(248, 239, 216, 0.66);
    font-size: 0.76rem;
}

.home-module-head strong.ok {
    background: rgba(42, 159, 114, 0.18);
    color: #9ff0d0;
}

.lobby-actions,
.private-room-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 9px;
}

.private-room-row {
    margin-top: 9px;
    grid-template-columns: minmax(0, 1fr) auto;
}

.private-room-row input {
    width: 100%;
    min-height: 40px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 0 12px;
    background: rgba(255, 255, 255, 0.08);
    color: #f8efd8;
    font: inherit;
    font-weight: 800;
    text-transform: uppercase;
    outline: none;
}

.private-room-row input:focus {
    border-color: rgba(182, 138, 68, 0.54);
    box-shadow: 0 0 0 3px rgba(182, 138, 68, 0.12);
}

.home-primary.small,
.home-secondary.small {
    min-height: 40px;
    min-width: 0;
    padding: 0 13px;
}

.lobby-status {
    min-height: 38px;
    margin-top: 12px;
    padding: 9px 10px;
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.07);
    color: rgba(248, 239, 216, 0.68);
    font-size: 0.86rem;
    line-height: 1.45;
}

.level-preview-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 8px;
    max-height: min(520px, 58dvh);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 2px;
}

.level-preview {
    min-height: 58px;
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-areas:
        "id title"
        "id state";
    gap: 2px 8px;
    align-items: center;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 14px;
    padding: 9px;
    background: linear-gradient(135deg, rgba(255,255,255,0.1), rgba(255,255,255,0.04));
    color: #f8efd8;
    text-align: left;
}

.level-preview span {
    grid-area: id;
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: rgba(244, 217, 140, 0.14);
    color: #f4d98c;
    font-weight: 900;
}

.level-preview strong {
    grid-area: title;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.9rem;
}

.level-preview em {
    grid-area: state;
    color: rgba(248, 239, 216, 0.6);
    font-size: 0.76rem;
    font-style: normal;
}

.level-preview.open {
    border-color: rgba(42, 159, 114, 0.24);
}

.level-preview.done {
    border-color: rgba(182, 138, 68, 0.38);
    background: rgba(242, 226, 184, 0.12);
}

.level-preview.locked {
    opacity: 0.58;
}

.level-preview.empty {
    display: block;
    color: rgba(248, 239, 216, 0.62);
    text-align: center;
}

.rank-home-card {
    min-height: 74px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 12px;
    border: 1px solid rgba(182, 138, 68, 0.28);
    border-radius: 8px;
    background:
        linear-gradient(135deg, rgba(79, 196, 155, 0.14), rgba(244, 217, 140, 0.1)),
        rgba(255, 255, 255, 0.05);
}

.season-switcher,
.store-category-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 12px;
}

.season-switcher button,
.store-category-tabs button {
    min-height: 38px;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 999px;
    padding: 0 12px;
    background: rgba(255,255,255,0.06);
    color: rgba(248, 239, 216, 0.72);
    font-weight: 900;
}

.season-switcher button {
    min-height: 54px;
    display: grid;
    align-content: center;
    min-width: 126px;
    border-radius: 16px;
    text-align: left;
}

.season-switcher strong,
.season-switcher span {
    display: block;
}

.season-switcher span {
    margin-top: 2px;
    font-size: 0.72rem;
    color: rgba(248, 239, 216, 0.56);
}

.season-switcher button.active,
.store-category-tabs button.active {
    border-color: rgba(244, 217, 140, 0.42);
    background:
        radial-gradient(circle at 20% 10%, rgba(244, 217, 140, 0.24), transparent 35%),
        rgba(244, 217, 140, 0.12);
    color: #f8efd8;
}

.rank-home-card img {
    width: 48px;
    height: 48px;
    object-fit: contain;
    filter: drop-shadow(0 10px 14px rgba(31, 43, 34, 0.18));
}

.rank-home-card strong,
.rank-home-card span,
.rank-home-card em {
    display: block;
}

.rank-home-card strong {
    font-family: "Noto Serif SC", serif;
    font-size: 1.05rem;
}

.rank-home-card span {
    margin-top: 3px;
    color: rgba(248, 239, 216, 0.62);
    font-size: 0.78rem;
}

.rank-home-card em {
    min-width: 62px;
    color: #f4d98c;
    font-style: normal;
    font-size: 1.35rem;
    font-weight: 900;
    text-align: right;
}

.rank-home-list {
    margin-top: 10px;
    display: grid;
    gap: 7px;
}

.rank-row-mini {
    display: grid;
    grid-template-columns: 24px 1fr auto;
    gap: 8px;
    align-items: center;
    min-height: 34px;
    padding: 7px 9px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(248, 239, 216, 0.62);
    font-size: 0.82rem;
}

.rank-row-mini strong {
    color: #f8efd8;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.store-preview-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 10px;
    max-height: min(540px, 58dvh);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 2px;
}

.store-preview {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr);
    grid-template-areas:
        "art name"
        "art meta"
        "art action";
    gap: 2px 9px;
    align-items: center;
    min-height: 104px;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    background:
        radial-gradient(circle at 16% 16%, rgba(244, 217, 140, 0.16), transparent 38%),
        linear-gradient(135deg, rgba(255,255,255,0.1), rgba(255,255,255,0.04));
}

.store-preview.equipped {
    border-color: rgba(244, 217, 140, 0.58);
    background:
        radial-gradient(circle at 16% 16%, rgba(244, 217, 140, 0.28), transparent 38%),
        linear-gradient(135deg, rgba(244, 217, 140, 0.13), rgba(255,255,255,0.05));
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.16),
        0 0 28px rgba(244, 217, 140, 0.13);
}

.store-preview img {
    grid-area: art;
    width: 64px;
    height: 64px;
    border-radius: 14px;
    object-fit: cover;
    box-shadow: 0 14px 26px rgba(0, 0, 0, 0.28);
}

.store-preview strong {
    grid-area: name;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #f8efd8;
    font-size: 0.9rem;
}

.store-preview span {
    grid-area: meta;
    color: rgba(248, 239, 216, 0.62);
    font-size: 0.76rem;
}

.store-buy-btn {
    grid-area: action;
    width: fit-content;
    min-height: 30px;
    border: 1px solid rgba(182, 138, 68, 0.32);
    border-radius: 10px;
    padding: 0 11px;
    background:
        linear-gradient(180deg, #e1bd70, #b57a34);
    color: #1f160b;
    font-size: 0.76rem;
    font-weight: 900;
}

.store-buy-btn.owned {
    border-color: rgba(42, 159, 114, 0.18);
    background: rgba(42, 159, 114, 0.12);
    color: #9ff0d0;
}

.store-buy-btn.equipped {
    border-color: rgba(244, 217, 140, 0.4);
    background:
        linear-gradient(180deg, rgba(244, 217, 140, 0.3), rgba(182, 138, 68, 0.18));
    color: #f8efd8;
}

.home-web3-panel .home-primary.small,
.home-web3-panel .home-secondary.small {
    border-radius: 12px;
}

.home-web3-panel .home-secondary.small {
    border-color: rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.08);
    color: #f8efd8;
}

.home-primary,
.home-secondary {
    min-height: 48px;
    border-radius: 6px;
    border: 1px solid rgba(92, 73, 38, 0.28);
    padding: 0 24px;
    color: #21170d;
    font-weight: 900;
    box-shadow: 0 10px 22px rgba(92, 73, 38, 0.16);
}

.home-primary {
    min-width: 150px;
    background:
        linear-gradient(90deg, rgba(91, 50, 16, 0.18), transparent 20%, transparent 80%, rgba(91, 50, 16, 0.16)),
        linear-gradient(180deg, #d3a75f, #a86f2f);
}

.home-secondary {
    background:
        linear-gradient(90deg, rgba(255,255,255,0), rgba(255,255,255,0.62), rgba(255,255,255,0)),
        rgba(252, 248, 238, 0.86);
}

.home-primary:hover,
.home-secondary:hover {
    transform: translateY(-1px);
    box-shadow: 0 16px 30px rgba(92, 73, 38, 0.2);
}

.home-preview {
    grid-column: 2;
    grid-row: 1 / span 3;
    align-self: center;
    display: grid;
    gap: 18px;
}

.home-board-mini {
    aspect-ratio: 1;
    width: min(100%, 520px);
    justify-self: end;
    position: relative;
    border-radius: 14px;
    border: 12px solid rgba(247, 241, 224, 0.92);
    background:
        radial-gradient(circle at 50% 50%, rgba(239, 210, 134, 0.72) 0 2px, transparent 3px),
        linear-gradient(90deg, rgba(28, 47, 35, 0.44) 1px, transparent 1px) 0 0 / 12.5% 12.5%,
        linear-gradient(rgba(28, 47, 35, 0.44) 1px, transparent 1px) 0 0 / 12.5% 12.5%,
        linear-gradient(145deg, #6b9b83, #285b43);
    box-shadow:
        0 24px 52px rgba(31, 43, 34, 0.26),
        inset 0 0 0 3px rgba(203, 170, 98, 0.58);
}

.home-board-mini::before,
.home-board-mini::after {
    content: "";
    position: absolute;
    width: 13%;
    height: 13%;
    border-radius: 50%;
    box-shadow: 0 10px 18px rgba(0, 0, 0, 0.26);
}

.home-board-mini::before {
    left: 38%;
    top: 39%;
    background: radial-gradient(circle at 35% 26%, #6e6e6e, #050505 64%);
}

.home-board-mini::after {
    right: 28%;
    top: 49%;
    background: radial-gradient(circle at 35% 25%, #ffffff, #dfd7c9 70%);
}

.home-stone {
    width: 82px;
    height: 82px;
    border-radius: 50%;
    box-shadow: 0 18px 24px rgba(0, 0, 0, 0.2);
}

.home-stone.black {
    justify-self: start;
    margin-left: 14%;
    background: radial-gradient(circle at 34% 26%, #5f5f5f, #050505 66%);
}

.home-stone.white {
    justify-self: end;
    margin-right: 12%;
    background: radial-gradient(circle at 32% 24%, #ffffff, #d7d0bf 72%);
}

.home-mode-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.home-mode-card {
    min-height: 86px;
    border: 1px solid rgba(49, 91, 71, 0.18);
    border-radius: 8px;
    padding: 14px;
    background: rgba(252, 248, 238, 0.76);
    box-shadow: 0 12px 24px rgba(31, 43, 34, 0.1);
}

.home-mode-card strong {
    display: block;
    font-family: "Noto Serif SC", serif;
    font-size: 1.05rem;
}

.home-mode-card span {
    display: block;
    margin-top: 8px;
    color: var(--muted);
    font-size: 0.86rem;
    line-height: 1.45;
}

.app-shell {
    width: min(1480px, calc(100vw - 48px));
    min-height: 100vh;
    margin: 0 auto;
    padding: 18px 0;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.app-header,
.bottom-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(52, 63, 47, 0.22);
    padding-bottom: 16px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 18px;
}

.brand-mark {
    width: 88px;
    height: 88px;
    border-radius: 22px;
    object-fit: cover;
    border: 2px solid rgba(223, 183, 93, 0.9);
    box-shadow: 0 12px 26px rgba(55, 43, 25, 0.24);
}

.brand-title {
    font-family: "Noto Serif SC", serif;
    font-size: clamp(2rem, 4vw, 3.4rem);
    font-weight: 900;
    letter-spacing: 0;
    color: #1e211c;
}

.brand-subtitle {
    margin-top: 8px;
    color: var(--muted);
    font-size: 0.95rem;
    letter-spacing: 0.4em;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pi-login-btn,
.btn,
.icon-button,
.pi-logout-btn,
.wager-btn {
    border: 1px solid var(--line);
    border-radius: 6px;
    min-height: 38px;
    padding: 0 14px;
    background:
        linear-gradient(90deg, rgba(255,255,255,0), rgba(255,255,255,0.52), rgba(255,255,255,0)),
        var(--surface-strong);
    color: var(--text);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset;
    transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.command-bar .btn,
.bottom-bar {
    font-family: "Noto Serif SC", serif;
}

.command-bar .btn:not(.btn-primary) {
    border: 0;
    background:
        radial-gradient(ellipse at 15% 50%, rgba(30, 31, 24, 0.14), transparent 48%),
        linear-gradient(90deg, rgba(44, 39, 30, 0.12), rgba(255,255,255,0.78), rgba(44, 39, 30, 0.1));
    box-shadow: none;
}

.command-bar .btn-primary {
    min-width: 118px;
    background:
        linear-gradient(90deg, rgba(91, 50, 16, 0.16), transparent 20%, transparent 80%, rgba(91, 50, 16, 0.14)),
        linear-gradient(180deg, #d1a35b, #a66f2d);
}

.pi-login-btn,
.btn-primary {
    background: linear-gradient(180deg, #caa15a, #9d6a2b);
    border-color: rgba(118, 78, 29, 0.36);
    color: #24180b;
    font-weight: 800;
    box-shadow: 0 10px 24px rgba(134, 91, 38, 0.26);
}

.btn:hover,
.pi-login-btn:hover,
.icon-button:hover,
.wager-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-soft);
}

.btn:active,
.pi-login-btn:active,
.icon-button:active,
.wager-btn:active {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.45;
    transform: none;
    box-shadow: none;
}

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

.btn.full {
    width: 100%;
    margin-top: 14px;
}

.icon-button {
    width: 38px;
    padding: 0;
    color: var(--muted);
}

#pi-user-info {
    display: none;
    align-items: center;
    gap: 8px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 4px 8px 4px 4px;
}

.pi-avatar {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    font-size: 0.72rem;
    font-weight: 800;
}

.pi-logout-btn {
    min-height: 28px;
    padding: 0 9px;
    color: var(--muted);
}

.game-layout {
    flex: 1;
    display: grid;
    grid-template-columns: minmax(240px, 280px) minmax(520px, 1fr) minmax(230px, 270px);
    gap: 18px;
    align-items: start;
}

.game-layout > *,
.board-stage,
.board-card,
#board {
    min-width: 0;
    max-width: 100%;
}

.left-rail,
.right-rail {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.panel {
    background: var(--surface);
    border: 1px solid rgba(69, 78, 54, 0.2);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.panel::before {
    content: "";
    position: absolute;
    inset: 8px;
    border: 1px solid rgba(139, 120, 81, 0.16);
    pointer-events: none;
}

.hero-panel {
    background:
        linear-gradient(180deg, rgba(253, 248, 235, 0.9), rgba(243, 234, 214, 0.72)),
        linear-gradient(135deg, rgba(44, 83, 62, 0.12), rgba(184, 139, 74, 0.12));
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.panel-kicker {
    color: #1d3b29;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.panel h2 {
    margin: 4px 0 0;
    font-size: 1rem;
}

.status-line {
    margin: 8px 0 14px;
    font-size: 1.42rem;
    font-weight: 800;
    color: var(--primary-strong);
    font-family: "Noto Serif SC", serif;
}

.turn-meter {
    display: grid;
    gap: 8px;
}

.turn-chip {
    min-height: 48px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 9px;
    padding: 8px 10px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    color: var(--muted);
    position: relative;
    overflow: hidden;
}

.turn-chip.active {
    border-color: rgba(182, 138, 68, 0.42);
    background:
        radial-gradient(circle at 12% 18%, rgba(255, 244, 202, 0.62), transparent 22%),
        rgba(224, 204, 158, 0.28);
    color: var(--text);
}

.turn-chip::after {
    content: "";
    position: absolute;
    right: 8px;
    bottom: -18px;
    width: 54px;
    height: 54px;
    border-radius: 44% 44% 50% 50%;
    opacity: 0.12;
    pointer-events: none;
    background:
        radial-gradient(circle at 36% 38%, #fff8df 0 5px, transparent 6px),
        radial-gradient(circle at 63% 38%, #fff8df 0 5px, transparent 6px),
        radial-gradient(circle at 50% 66%, rgba(24, 31, 26, 0.75) 0 7px, transparent 8px),
        linear-gradient(180deg, #315b47, #17291f);
    box-shadow: inset 0 2px 8px rgba(255,255,255,0.42), 0 8px 18px rgba(24, 30, 22, 0.2);
}

.turn-chip.active::after {
    opacity: 0.24;
}

.mobile-wager-status {
    display: none;
}

.stone-dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.22);
}

.stone-dot.black {
    background: radial-gradient(circle at 32% 28%, #6a6a70, #09090b 72%);
}

.stone-dot.white {
    background: radial-gradient(circle at 32% 28%, #fff, #d7cdbc 76%);
    border: 1px solid rgba(64, 42, 22, 0.12);
}

.mini-grid,
.insight-strip,
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.mini-grid {
    margin-top: 12px;
}

.mini-grid > div,
.insight-strip > div,
.stat-item {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 10px 8px;
    background: rgba(255, 255, 255, 0.48);
    text-align: center;
}

.mini-grid span,
.insight-strip span,
.stat-value {
    display: block;
    min-height: 24px;
    font-size: 1.12rem;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.mini-grid label,
.insight-strip label,
.stat-label {
    display: block;
    margin-top: 3px;
    color: var(--soft);
    font-size: 0.68rem;
}

.control-stack {
    display: grid;
    gap: 11px;
    margin-top: 12px;
}

.control-stack label {
    display: grid;
    gap: 5px;
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 700;
}

select {
    width: 100%;
    min-height: 38px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: var(--text);
    background: var(--surface-strong);
    outline: none;
}

select:focus {
    border-color: rgba(114, 83, 189, 0.54);
    box-shadow: 0 0 0 3px rgba(114, 83, 189, 0.1);
}

.move-list {
    list-style: none;
    display: grid;
    gap: 5px;
    max-height: 300px;
    overflow-y: auto;
    margin: 12px 0 0;
    padding: 0;
}

.move-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 30px;
    padding: 5px 8px;
    border-radius: 6px;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.42);
    font-size: 0.78rem;
}

.move-item strong {
    color: var(--text);
}

.empty-state {
    color: var(--soft);
    text-align: center;
    padding: 18px 0;
    font-size: 0.82rem;
}

.board-stage {
    display: grid;
    gap: 14px;
}

.command-bar {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.board-card {
    position: relative;
    display: grid;
    place-items: center;
    padding: 14px;
    border-radius: 10px;
    background:
        linear-gradient(180deg, rgba(250, 246, 235, 0.94), rgba(233, 222, 196, 0.72)),
        rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(115, 103, 76, 0.22);
    box-shadow: 0 24px 70px rgba(56, 48, 33, 0.2);
}

.board-card::before,
.board-card::after {
    content: "";
    position: absolute;
    pointer-events: none;
    border-radius: inherit;
}

.board-card::before {
    inset: 8px;
    border: 1px solid rgba(255, 235, 176, 0.42);
    box-shadow:
        inset 0 0 26px rgba(255, 244, 204, 0.26),
        0 0 34px rgba(184, 139, 74, 0.18);
    z-index: 1;
}

.board-card::after {
    inset: 0;
    z-index: 0;
    background:
        linear-gradient(124deg, rgba(255,255,255,0.32), transparent 22% 70%, rgba(41, 68, 49, 0.12)),
        radial-gradient(circle at 80% 10%, rgba(255, 231, 153, 0.18), transparent 28%);
}

#board {
    width: min(100%, 680px);
    aspect-ratio: 1;
    display: grid;
    place-items: center;
    position: relative;
    z-index: 2;
}

#board-canvas {
    width: 100%;
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 12px;
    cursor: pointer;
    touch-action: none;
    border: 3px solid rgba(167, 124, 51, 0.45);
    box-shadow:
        0 1px 0 rgba(255,255,255,0.55) inset,
        0 18px 34px rgba(52, 48, 38, 0.28);
}

.thinking-pill {
    position: absolute;
    top: 24px;
    left: 50%;
    transform: translate(-50%, -8px);
    opacity: 0;
    pointer-events: none;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(36, 21, 60, 0.88);
    color: white;
    font-size: 0.82rem;
    font-weight: 800;
    transition: opacity 0.18s ease, transform 0.18s ease;
    z-index: 6;
}

.thinking-pill.visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

.mobile-move-assist {
    --assist-x: 50%;
    --assist-y: 18%;
    display: none;
}

.assist-lens {
    position: absolute;
    left: var(--assist-x);
    top: var(--assist-y);
    width: 96px;
    height: 96px;
    transform: translate(-50%, -50%);
    z-index: 12;
    pointer-events: none;
    display: grid;
    place-items: center;
    border-radius: 50%;
    border: 3px solid rgba(223, 183, 91, 0.88);
    background:
        radial-gradient(circle at 50% 50%, rgba(255,255,255,0.5), rgba(236, 227, 203, 0.9)),
        linear-gradient(90deg, rgba(36, 54, 42, 0.26) 1px, transparent 1px) 0 0 / 24px 24px,
        linear-gradient(rgba(36, 54, 42, 0.26) 1px, transparent 1px) 0 0 / 24px 24px;
    box-shadow: 0 16px 34px rgba(24, 30, 23, 0.28);
}

.assist-lens span {
    position: absolute;
    bottom: 10px;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(31, 47, 37, 0.82);
    color: #fff8e8;
    font-size: 0.75rem;
    font-weight: 900;
}

.assist-lens i {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    box-shadow: 0 6px 12px rgba(0,0,0,0.28);
}

.assist-lens i.black {
    background: radial-gradient(circle at 32% 28%, #68686d, #08080a 72%);
}

.assist-lens i.white {
    background: radial-gradient(circle at 32% 28%, #fff, #d7cdbc 76%);
    border: 1px solid rgba(64, 42, 22, 0.18);
}

.assist-actions {
    position: absolute;
    left: 50%;
    bottom: 14px;
    z-index: 13;
    display: flex;
    gap: 8px;
    transform: translateX(-50%);
}

.mobile-tabbar {
    display: none;
}

.meta-drawer-close {
    display: none;
}

.insight-strip {
    background: rgba(255, 255, 255, 0.46);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 8px;
    box-shadow: var(--shadow-soft);
}

.wager-section {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 7px;
    margin-top: 12px;
}

.custom-wager {
    display: grid;
    gap: 6px;
    margin-top: 12px;
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 800;
}

.custom-wager input {
    width: 100%;
    min-height: 38px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 0 10px;
    color: var(--text);
    background: rgba(255, 255, 255, 0.78);
    outline: none;
}

.custom-wager input:focus {
    border-color: rgba(184, 139, 74, 0.58);
    box-shadow: 0 0 0 3px rgba(184, 139, 74, 0.14);
}

.wager-btn {
    min-height: 34px;
    padding: 0 8px;
    color: var(--muted);
    position: relative;
    overflow: hidden;
    font-weight: 900;
}

.wager-btn.active {
    border-color: rgba(182, 138, 68, 0.55);
    color: var(--primary-strong);
    background:
        radial-gradient(circle at 28% 22%, rgba(255, 238, 169, 0.9), transparent 28%),
        linear-gradient(180deg, #f0c876, #b87d33);
    box-shadow:
        0 7px 14px rgba(112, 75, 27, 0.22),
        inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.wager-btn::before {
    content: "π";
    display: inline-grid;
    place-items: center;
    width: 18px;
    height: 18px;
    margin-right: 4px;
    border-radius: 50%;
    background: linear-gradient(180deg, #ffe69a, #b87d33);
    color: #41250d;
    font-size: 0.72rem;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.7), 0 2px 5px rgba(80, 49, 14, 0.22);
}

.wager-btn[data-amount="0"]::before {
    content: "";
    display: none;
}

.network-badge {
    display: inline-flex;
    margin-top: 12px;
    padding: 5px 8px;
    border-radius: 6px;
    background: rgba(114, 83, 189, 0.12);
    color: var(--primary-strong);
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
}

.chain-list {
    display: grid;
    gap: 10px;
    margin-top: 12px;
}

.chain-list div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--muted);
}

.chain-list strong {
    color: var(--text);
}

.rules-panel p {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 0.84rem;
    line-height: 1.7;
}

.rank-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
    padding: 12px;
    border-radius: var(--radius);
    background:
        linear-gradient(135deg, rgba(49, 91, 71, 0.16), rgba(184, 139, 74, 0.18)),
        rgba(255, 255, 255, 0.6);
    border: 1px solid var(--line);
}

.rank-card span {
    display: block;
    font-size: 1rem;
    font-weight: 900;
    color: var(--primary-strong);
}

.rank-card label {
    display: block;
    margin-top: 2px;
    color: var(--soft);
    font-size: 0.7rem;
}

.rank-card strong {
    color: var(--accent);
    white-space: nowrap;
}

.progress-bar {
    height: 8px;
    margin: 12px 0;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(23, 25, 39, 0.09);
}

.progress-bar span {
    display: block;
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    transition: width 0.2s ease;
}

.achievement-list,
.task-list,
.theme-list,
.review-grid {
    display: grid;
    gap: 8px;
    margin-top: 12px;
}

.achievement,
.daily-task,
.theme-card,
.review-grid > div {
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.44);
}

.achievement,
.daily-task {
    opacity: 0.55;
}

.achievement.done,
.daily-task.done {
    opacity: 1;
    border-color: rgba(184, 139, 74, 0.34);
    background: linear-gradient(135deg, rgba(234, 216, 184, 0.52), rgba(255, 255, 255, 0.58));
}

.achievement strong,
.daily-task strong,
.theme-card strong,
.review-grid strong {
    display: block;
    font-size: 0.84rem;
}

.achievement span,
.daily-task span,
.theme-card span,
.review-grid span {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 0.72rem;
    line-height: 1.4;
}

.theme-card {
    width: 100%;
    text-align: left;
    min-height: 58px;
    background:
        linear-gradient(135deg, rgba(48, 83, 62, 0.1), rgba(184, 139, 74, 0.12)),
        rgba(255,255,255,0.5);
}

.theme-card.active {
    border-color: rgba(77, 63, 143, 0.42);
    background: linear-gradient(135deg, rgba(77, 63, 143, 0.12), rgba(255, 255, 255, 0.65));
}

.review-panel {
    background: rgba(255, 255, 255, 0.58);
}

body[data-theme="midnight"] {
    --bg: #e7e4db;
    --primary: #252f2b;
    --primary-strong: #121815;
    --accent: #a68a58;
}

body[data-theme="jade"] {
    --bg: #f1f0ea;
    --primary: #6d756f;
    --primary-strong: #39413c;
    --accent: #b8a076;
}

body[data-theme="champagne"] {
    --bg: #f2e8d6;
    --primary: #8c5a33;
    --primary-strong: #4a2b18;
    --accent: #c4944e;
}

.bottom-bar {
    border-top: 1px solid var(--line);
    border-bottom: 0;
    padding-top: 14px;
    padding-bottom: 0;
    color: var(--soft);
    font-size: 0.78rem;
}

.result-overlay {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: grid;
    place-items: center;
    background: rgba(22, 13, 38, 0.62);
    backdrop-filter: blur(10px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.result-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.result-content {
    width: min(360px, calc(100vw - 36px));
    padding: 28px;
    border: 1px solid rgba(255,255,255,0.48);
    border-radius: 12px;
    background: var(--surface-strong);
    box-shadow: var(--shadow);
    text-align: center;
    transform: translateY(12px) scale(0.96);
    transition: transform 0.2s ease;
}

.result-content.visible {
    transform: translateY(0) scale(1);
}

.result-text {
    font-size: 1.6rem;
    font-weight: 800;
}

.result-subtext {
    margin: 8px 0 20px;
    color: var(--muted);
}

.settings-panel {
    position: fixed;
    top: 0;
    right: -340px;
    z-index: 25;
    width: 320px;
    height: 100vh;
    padding: 22px;
    background: rgba(255, 255, 255, 0.9);
    border-left: 1px solid var(--line);
    box-shadow: -20px 0 50px rgba(37, 24, 59, 0.18);
    backdrop-filter: blur(18px);
    transition: right 0.2s ease;
}

.settings-panel.open {
    right: 0;
}

.settings-header,
.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.settings-header h3 {
    margin: 0;
}

.close-btn {
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 1.5rem;
}

.setting-row {
    min-height: 48px;
    border-bottom: 1px solid var(--line);
}

.setting-label {
    color: var(--muted);
    font-weight: 700;
}

.toggle {
    position: relative;
    width: 44px;
    height: 24px;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: #d7d0e4;
    transition: background 0.16s ease;
}

.toggle-slider::before {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
    transition: transform 0.16s ease;
}

.toggle input:checked + .toggle-slider {
    background: var(--primary);
}

.toggle input:checked + .toggle-slider::before {
    transform: translateX(20px);
}

.settings-note {
    margin-top: 18px;
    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1.7;
}

.reduce-motion *,
.reduce-motion *::before,
.reduce-motion *::after {
    animation: none !important;
    transition: none !important;
}

@media (max-width: 1360px) {
    .app-shell {
        width: min(100% - 28px, 980px);
    }

    .game-layout {
        grid-template-columns: 1fr;
    }

    .left-rail,
    .right-rail {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .board-stage {
        order: -1;
    }
}

@media (max-width: 980px) {
    .home-screen {
        padding: 16px;
    }

    .home-bg-card {
        min-height: calc(100vh - 32px);
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .home-brand,
    .home-copy,
    .home-actions,
    .home-preview {
        grid-column: 1;
        grid-row: auto;
    }

    .home-preview {
        justify-self: stretch;
    }

    .home-board-mini {
        width: min(100%, 460px);
        justify-self: center;
    }

    .home-mode-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 700px) {
    .home-bg-card {
        padding: 22px;
    }

    .home-brand {
        gap: 14px;
    }

    .home-brand p {
        letter-spacing: 0.24em;
    }

    .home-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .home-system-dock {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 8px;
        max-width: 100%;
    }

    .home-system-dock button {
        min-height: 82px;
        border-radius: 15px;
        padding: 10px 6px;
    }

    .dock-card .dock-icon {
        width: 34px;
        height: 34px;
        margin-bottom: 6px;
        border-radius: 12px;
    }

    .dock-card .dock-icon svg {
        width: 22px;
        height: 22px;
    }

    .dock-card strong {
        font-size: 0.76rem;
    }

    .dock-card em {
        display: none;
    }

    .home-web3-panel {
        grid-template-columns: 1fr;
        width: calc(100vw - 20px);
        max-height: calc(100dvh - 20px);
        padding: 12px;
        border-radius: 22px;
    }

    .home-module {
        min-height: 0;
    }

    .level-preview-list {
        grid-template-columns: 1fr;
    }

    .store-preview-list {
        grid-template-columns: 1fr;
    }

    .rank-home-card {
        grid-template-columns: auto 1fr;
    }

    .rank-home-card em {
        grid-column: 1 / -1;
        text-align: left;
        font-size: 1rem;
    }

    .home-primary,
    .home-secondary {
        min-width: 0;
        padding: 0 10px;
    }

    .home-stone {
        width: 54px;
        height: 54px;
    }

    .app-shell {
        width: min(100% - 18px, 640px);
        padding-top: 12px;
    }

    .app-header,
    .bottom-bar {
        align-items: flex-start;
        gap: 12px;
        flex-direction: column;
    }

    .header-actions,
    .command-bar {
        width: 100%;
    }

    .command-bar {
        justify-content: stretch;
    }

    .command-bar .btn {
        flex: 1 1 30%;
        padding-inline: 8px;
    }

    .left-rail,
    .right-rail {
        grid-template-columns: 1fr;
    }

    .board-card {
        padding: 8px;
    }

    .mini-grid,
    .insight-strip,
    .stats-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .settings-panel {
        width: 100%;
        right: -100%;
    }
}

/* Focus battle mode: a locked game viewport, not a scrolling dashboard. */
.home-screen {
    height: 100dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.app-shell {
    height: 100dvh;
    min-height: 100dvh;
    overflow: hidden;
}

body.is-playing {
    position: fixed;
    inset: 0;
    touch-action: none;
}

.app-shell.focus-mode {
    width: 100vw;
    max-width: none;
    height: 100dvh;
    min-height: 100dvh;
    padding: clamp(10px, 1.8vh, 18px) clamp(12px, 2vw, 22px);
    gap: 0;
}

.focus-mode .app-header {
    position: fixed;
    top: 12px;
    right: 16px;
    z-index: 25;
    width: auto;
    padding: 0;
    border: 0;
    background: transparent;
}

.focus-mode .brand,
.focus-mode #pi-auth,
.focus-mode #pi-user-info {
    display: none !important;
}

.focus-mode .header-actions {
    gap: 8px;
}

.focus-mode .nav-home-btn,
.focus-mode .icon-button {
    min-height: 36px;
    border-color: rgba(61, 72, 54, 0.22);
    background: rgba(252, 248, 238, 0.88);
    backdrop-filter: blur(12px);
    box-shadow: 0 10px 24px rgba(31, 43, 34, 0.12);
}

.focus-mode .game-layout {
    height: 100%;
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    gap: clamp(8px, 1.6vh, 14px);
    align-items: stretch;
    overflow: hidden;
}

.focus-mode .left-rail {
    display: block;
    min-height: 0;
    max-height: 116px;
    order: 0;
    overflow: visible;
}

.focus-mode .left-rail > .panel:not(.hero-panel):not(.drawer-panel),
.focus-mode .right-rail,
.focus-mode .bottom-bar,
.focus-mode .review-panel:not(.open) {
    display: none;
}

.focus-mode .hero-panel {
    width: min(760px, calc(100vw - 150px));
    min-height: 0;
    margin: 0 auto;
    padding: 10px 14px;
    border-radius: 8px;
    background:
        linear-gradient(90deg, rgba(252, 248, 238, 0.94), rgba(235, 226, 204, 0.84)),
        linear-gradient(135deg, rgba(49, 91, 71, 0.14), rgba(182, 138, 68, 0.12));
}

.focus-mode .hero-panel::before {
    inset: 6px;
}

.focus-mode .hero-panel .panel-kicker {
    display: none;
}

.focus-mode .status-line {
    margin: 0 0 8px;
    text-align: center;
    font-size: clamp(1.05rem, 2.4vh, 1.38rem);
}

.focus-mode .turn-meter {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.focus-mode .turn-chip {
    min-height: 38px;
    padding: 7px 10px;
}

.focus-mode .mini-grid {
    display: none;
}

.focus-mode .board-stage {
    order: 0;
    min-height: 0;
    height: 100%;
    display: grid;
    grid-template-rows: auto auto;
    align-content: start;
    align-items: center;
    justify-items: center;
    gap: clamp(8px, 1.3vh, 12px);
    overflow: hidden;
    touch-action: none;
}

.focus-mode .board-card {
    order: 1;
    width: fit-content;
    max-width: 100%;
    max-height: 100%;
    padding: clamp(7px, 1.2vmin, 12px);
    border-radius: 10px;
    align-self: center;
}

.focus-mode #board {
    width: min(calc(100vw - 64px), calc(100dvh - 250px), 760px);
    max-width: 100%;
    max-height: 100%;
}

.focus-mode .insight-strip {
    display: none;
}

.focus-mode .command-bar {
    order: 2;
    width: min(760px, calc(100vw - 32px));
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
}

.focus-mode .command-bar .btn {
    flex: 0 1 auto;
    min-width: 88px;
    min-height: 38px;
}

.focus-mode .info-drawer-btn {
    color: #315b47;
    border: 1px solid rgba(49, 91, 71, 0.24);
    background: rgba(252, 248, 238, 0.62);
}

.drawer-backdrop {
    position: fixed;
    inset: 0;
    z-index: 38;
    pointer-events: none;
    opacity: 0;
    background: rgba(28, 33, 27, 0.22);
    backdrop-filter: blur(2px);
    transition: opacity 0.18s ease;
}

.drawer-backdrop.open {
    pointer-events: auto;
    opacity: 1;
}

.drawer-panel-head {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.drawer-close {
    width: 30px;
    height: 30px;
    border: 1px solid rgba(69, 78, 54, 0.2);
    border-radius: 50%;
    background: rgba(252, 248, 238, 0.82);
    color: var(--text);
    font-size: 1.1rem;
    line-height: 1;
}

.focus-mode .drawer-panel {
    display: block;
    position: fixed;
    right: 16px;
    z-index: 40;
    width: min(420px, calc(100vw - 32px));
    margin: 0;
    overflow: hidden;
    transform: translateX(calc(100% + 32px));
    opacity: 0;
    pointer-events: none;
    transition: transform 0.22s ease, opacity 0.22s ease;
    touch-action: pan-y;
}

.focus-mode .drawer-panel.open {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
}

.focus-mode .move-drawer {
    top: 70px;
    bottom: calc(50dvh + 8px);
}

.focus-mode .review-drawer {
    top: calc(50dvh + 8px);
    bottom: 16px;
}

.focus-mode .move-drawer .move-list,
.focus-mode .review-drawer .review-grid {
    position: relative;
    z-index: 1;
    height: calc(100% - 42px);
    max-height: none;
    overflow-y: auto;
    overscroll-behavior: contain;
    touch-action: pan-y;
}

@media (max-width: 760px) {
    .app-shell.focus-mode {
        padding: 10px;
    }

    .focus-mode .app-header {
        top: 10px;
        right: 10px;
    }

    .focus-mode .hero-panel {
        width: calc(100vw - 110px);
        margin: 0 auto 0 0;
        padding: 8px;
    }

    .focus-mode .status-line {
        margin-bottom: 6px;
        font-size: 1rem;
    }

    .focus-mode .turn-chip {
        min-height: 34px;
        padding: 6px 7px;
        font-size: 0.82rem;
    }

    .focus-mode .turn-chip strong {
        font-size: 0.9rem;
    }

    .focus-mode #board {
        width: min(calc(100vw - 28px), calc(100dvh - 260px));
    }

    .focus-mode .insight-strip {
        width: calc(100vw - 20px);
    }

    .focus-mode .insight-strip div {
        min-height: 46px;
        padding: 7px;
    }

    .focus-mode .command-bar {
        width: calc(100vw - 20px);
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .focus-mode .command-bar .btn {
        min-width: 0;
        width: 100%;
        padding-inline: 6px;
    }

    .focus-mode .drawer-panel {
        right: 10px;
        width: calc(100vw - 20px);
    }

    .focus-mode .move-drawer {
        top: 64px;
    }
}

@media (max-height: 720px) {
    .focus-mode .hero-panel {
        padding: 7px 10px;
    }

    .focus-mode .status-line {
        display: none;
    }

    .focus-mode #board {
        width: min(calc(100vw - 48px), calc(100dvh - 190px), 700px);
    }

    .focus-mode .insight-strip div {
        min-height: 42px;
    }
}

@media (max-width: 768px) {
    .app-shell.focus-mode {
        padding: max(8px, env(safe-area-inset-top)) 10px calc(70px + env(safe-area-inset-bottom));
    }

    .focus-mode .app-header {
        display: none;
    }

    .focus-mode .game-layout {
        height: calc(100dvh - 72px - env(safe-area-inset-bottom));
        grid-template-rows: auto minmax(0, 1fr);
        gap: 8px;
    }

    .focus-mode .hero-panel {
        width: 100%;
        max-height: 112px;
        margin: 0;
        padding: 8px;
        display: grid;
        grid-template-columns: 1fr auto;
        gap: 7px 8px;
        align-items: center;
    }

    .focus-mode .hero-panel::before {
        inset: 5px;
    }

    .focus-mode .status-line,
    .focus-mode .mini-grid,
    .focus-mode .hero-panel .panel-kicker {
        display: none;
    }

    .focus-mode .turn-meter {
        grid-column: 1 / -1;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 7px;
    }

    .focus-mode .turn-chip {
        min-height: 46px;
        grid-template-columns: auto minmax(0, 1fr);
        grid-template-areas:
            "stone name"
            "stone time";
        gap: 1px 8px;
        padding: 7px 8px;
    }

    .focus-mode .turn-chip .stone-dot {
        grid-area: stone;
        width: 26px;
        height: 26px;
    }

    .focus-mode .turn-chip span:not(.stone-dot) {
        grid-area: name;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 0.82rem;
        font-weight: 900;
    }

    .focus-mode .turn-chip strong {
        grid-area: time;
        font-size: 1rem;
        line-height: 1;
    }

    .focus-mode .mobile-wager-status {
        grid-column: 1 / -1;
        display: inline-flex;
        justify-self: center;
        align-items: center;
        gap: 7px;
        min-height: 28px;
        padding: 4px 12px;
        border-radius: 999px;
        border: 1px solid rgba(180, 132, 51, 0.34);
        background:
            radial-gradient(circle at 20% 10%, rgba(255, 239, 170, 0.8), transparent 34%),
            rgba(252, 248, 238, 0.82);
        color: #4c3212;
        box-shadow: 0 8px 16px rgba(74, 53, 20, 0.12);
    }

    .focus-mode .mobile-wager-status span {
        display: inline-grid;
        place-items: center;
        width: 20px;
        height: 20px;
        border-radius: 50%;
        background: linear-gradient(180deg, #ffe796, #b9802f);
        font-weight: 900;
    }

    .focus-mode .mobile-wager-status strong {
        font-size: 0.86rem;
    }

    .focus-mode .mobile-wager-status.chip-pop {
        animation: chip-pop 0.24s ease;
    }

    .focus-mode .board-stage {
        height: 100%;
        min-height: 0;
        grid-template-rows: minmax(0, 1fr) auto;
        align-content: stretch;
        gap: 8px;
    }

    .focus-mode .board-card {
        width: 100%;
        align-self: center;
        padding: 8px;
    }

    .focus-mode #board {
        width: min(100%, calc(100dvh - 286px));
        min-width: min(100%, 330px);
    }

    .focus-mode .command-bar {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
    }

    .focus-mode #btn-new-game,
    .focus-mode #btn-redo,
    .focus-mode .info-drawer-btn {
        display: none;
    }

    .focus-mode .command-bar .btn {
        min-height: 46px;
        min-width: 0;
        width: 100%;
        padding-inline: 6px;
        font-size: 1.05rem;
    }

    .focus-mode .mobile-move-assist.visible {
        display: block;
    }

    .focus-mode .mobile-tabbar {
        position: fixed;
        left: 10px;
        right: 10px;
        bottom: max(8px, env(safe-area-inset-bottom));
        z-index: 28;
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 7px;
        padding: 7px;
        border: 1px solid rgba(69, 78, 54, 0.22);
        border-radius: 10px;
        background: rgba(252, 248, 238, 0.9);
        backdrop-filter: blur(14px);
        box-shadow: 0 16px 34px rgba(31, 43, 34, 0.18);
    }

    .focus-mode .mobile-tabbar button {
        min-height: 40px;
        border: 0;
        border-radius: 7px;
        background:
            linear-gradient(90deg, rgba(255,255,255,0), rgba(255,255,255,0.48), rgba(255,255,255,0)),
            rgba(238, 231, 211, 0.8);
        color: var(--primary-strong);
        font-weight: 900;
    }

    .focus-mode .right-rail {
        display: block;
        position: fixed;
        left: 10px;
        right: 10px;
        top: max(10px, env(safe-area-inset-top));
        bottom: calc(78px + env(safe-area-inset-bottom));
        z-index: 40;
        width: auto;
        padding: 46px 10px 10px;
        overflow-y: auto;
        overscroll-behavior: contain;
        border: 1px solid rgba(69, 78, 54, 0.22);
        border-radius: 10px;
        background: rgba(248, 244, 232, 0.94);
        backdrop-filter: blur(14px);
        box-shadow: 0 22px 48px rgba(24, 30, 23, 0.24);
        transform: translateY(110%);
        opacity: 0;
        pointer-events: none;
        transition: transform 0.22s ease, opacity 0.22s ease;
        touch-action: pan-y;
    }

    .focus-mode .right-rail.open {
        transform: translateY(0);
        opacity: 1;
        pointer-events: auto;
    }

    .focus-mode .right-rail .panel {
        box-shadow: none;
    }

    .focus-mode .right-rail .chain-status-panel {
        display: none;
    }

    .meta-drawer-close {
        display: grid;
        place-items: center;
        position: absolute;
        top: 10px;
        right: 10px;
        z-index: 2;
    }
}

/* Luxury flagship gameplay skin: dark glass HUD, enlarged board, thumb-first controls. */
:root {
    --game-bg-image: none;
    --game-void: #05070b;
    --game-ink: rgba(7, 9, 13, 0.74);
    --game-glass: rgba(16, 19, 27, 0.62);
    --game-glass-strong: rgba(18, 22, 31, 0.82);
    --game-glass-line: rgba(255, 255, 255, 0.12);
    --game-gold: #d7b166;
    --game-gold-hot: #f4d98c;
    --game-jade: #4fc49b;
    --game-crimson: #d95767;
    --game-text: #f8efd8;
    --game-muted: rgba(248, 239, 216, 0.64);
}

body.is-playing {
    color: var(--game-text);
    background:
        radial-gradient(circle at 50% 34%, rgba(244, 217, 140, 0.2), transparent 25%),
        radial-gradient(circle at 16% 15%, rgba(79, 196, 155, 0.18), transparent 30%),
        radial-gradient(circle at 86% 18%, rgba(91, 50, 156, 0.18), transparent 28%),
        linear-gradient(180deg, rgba(5, 7, 11, 0.58), rgba(5, 7, 11, 0.96)),
        var(--game-void);
}

body.is-playing::before {
    z-index: -3;
    opacity: 0.82;
    background-image:
        linear-gradient(rgba(5, 7, 11, 0.34), rgba(5, 7, 11, 0.88)),
        var(--game-bg-image);
    background-size: cover;
    background-position: center;
}

body.is-playing::after {
    inset: -22vh -16vw auto auto;
    width: 78vw;
    height: 108vh;
    opacity: 0.78;
    transform: rotate(10deg);
    mix-blend-mode: screen;
    background:
        linear-gradient(104deg, transparent 0 16%, rgba(255, 231, 157, 0.16) 21%, transparent 28%),
        linear-gradient(110deg, transparent 0 38%, rgba(79, 196, 155, 0.12) 44%, transparent 54%),
        radial-gradient(ellipse at 72% 28%, rgba(255, 239, 182, 0.22), transparent 45%);
}

.focus-mode.app-shell,
.app-shell.focus-mode {
    width: 100vw;
    max-width: none;
    height: 100dvh;
    min-height: 100dvh;
    padding: clamp(10px, 1.8vh, 18px) clamp(12px, 2vw, 22px);
    overflow: hidden;
}

.focus-mode .app-header {
    top: 14px;
    right: 18px;
}

.focus-mode .nav-home-btn,
.focus-mode .icon-button {
    min-height: 42px;
    border: 1px solid var(--game-glass-line);
    border-radius: 999px;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.14), rgba(255,255,255,0.04)),
        var(--game-glass);
    color: var(--game-text);
    backdrop-filter: blur(14px);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.16),
        0 18px 38px rgba(0,0,0,0.34);
}

.focus-mode .game-layout {
    height: 100%;
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    gap: clamp(10px, 1.8vh, 18px);
    align-items: stretch;
    overflow: hidden;
}

.focus-mode .left-rail {
    max-height: none;
}

.focus-mode .hero-panel {
    width: min(720px, calc(100vw - 168px));
    min-height: 0;
    padding: 10px 14px;
    border: 1px solid var(--game-glass-line);
    border-radius: 22px;
    background:
        linear-gradient(135deg, rgba(255,255,255,0.13), rgba(255,255,255,0.04)),
        var(--game-glass);
    color: var(--game-text);
    backdrop-filter: blur(16px);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.16),
        0 18px 46px rgba(0,0,0,0.42);
}

.focus-mode .hero-panel::before {
    inset: 1px;
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: inherit;
    box-shadow: none;
}

.focus-mode .status-line {
    color: var(--game-text);
    text-shadow: 0 0 18px rgba(244, 217, 140, 0.18);
}

.focus-mode .turn-chip {
    min-height: 44px;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 16px;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.09), rgba(255,255,255,0.03)),
        rgba(255,255,255,0.04);
    color: var(--game-muted);
}

.focus-mode .turn-chip.active {
    border-color: rgba(244, 217, 140, 0.34);
    color: var(--game-text);
    background:
        radial-gradient(circle at 20% 12%, rgba(244, 217, 140, 0.26), transparent 34%),
        linear-gradient(180deg, rgba(255,255,255,0.13), rgba(255,255,255,0.05)),
        rgba(255,255,255,0.06);
    box-shadow: 0 0 28px rgba(244, 217, 140, 0.12);
}

.focus-mode .board-stage {
    width: min(100%, 760px);
    height: 100%;
    margin: 0 auto;
    grid-template-rows: minmax(0, 1fr) auto;
    align-content: center;
    align-items: center;
    justify-items: center;
    gap: clamp(12px, 2vh, 20px);
    overflow: hidden;
}

.focus-mode .board-card {
    width: min(calc(100vw - 40px), calc(100dvh - 210px), 640px);
    max-width: 100%;
    aspect-ratio: 1;
    padding: clamp(10px, 1.7vmin, 16px);
    border-radius: clamp(18px, 3vmin, 28px);
    border: 1px solid rgba(255,255,255,0.18);
    background:
        linear-gradient(145deg, rgba(255,255,255,0.16), rgba(255,255,255,0.04)),
        linear-gradient(180deg, #1d4c3c, #0d241d);
    box-shadow:
        0 3px 0 #06120e,
        0 13px 0 #081a15,
        0 38px 96px rgba(0,0,0,0.62),
        0 0 92px rgba(244, 217, 140, 0.16),
        inset 0 1px 0 rgba(255,255,255,0.2),
        inset 0 -22px 42px rgba(0,0,0,0.24);
}

.focus-mode .board-card::before {
    inset: 7px;
    border: 1px solid rgba(244, 217, 140, 0.38);
    border-radius: calc(clamp(18px, 3vmin, 28px) - 6px);
    box-shadow:
        inset 0 0 28px rgba(244, 217, 140, 0.14),
        0 0 28px rgba(244, 217, 140, 0.1);
}

.focus-mode .board-card::after {
    background:
        linear-gradient(124deg, rgba(255,255,255,0.24), transparent 21% 70%, rgba(0,0,0,0.18)),
        radial-gradient(circle at 78% 12%, rgba(244, 217, 140, 0.18), transparent 29%);
}

.focus-mode #board {
    width: 100%;
    height: 100%;
}

.focus-mode #board-canvas {
    width: 100%;
    height: 100%;
    border-radius: clamp(12px, 2vmin, 18px);
    border: 2px solid rgba(244, 217, 140, 0.42);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.24),
        0 18px 40px rgba(0,0,0,0.34);
}

.focus-mode .command-bar {
    width: min(720px, calc(100vw - 40px));
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--game-glass-line);
    border-radius: 28px;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.03)),
        rgba(5, 7, 11, 0.72);
    backdrop-filter: blur(18px);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.12),
        0 22px 52px rgba(0,0,0,0.46);
}

.focus-mode .command-bar .btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 58px;
    width: 100%;
    padding: 0 10px;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 18px;
    color: var(--game-text);
    font-size: 0.95rem;
    font-weight: 900;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.12), rgba(255,255,255,0.04)),
        rgba(255,255,255,0.06);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.14),
        0 12px 26px rgba(0,0,0,0.3);
    text-shadow: 0 1px 0 rgba(0,0,0,0.2);
}

.focus-mode .command-bar .btn:hover {
    transform: translateY(-1px);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.18),
        0 18px 34px rgba(0,0,0,0.36);
}

.focus-mode .command-bar .btn-primary,
.focus-mode .command-bar #btn-new-game {
    border-color: rgba(244, 217, 140, 0.36);
    color: #201405;
    background:
        radial-gradient(circle at 24% 14%, rgba(255,255,255,0.62), transparent 30%),
        linear-gradient(180deg, #f4d98c, #b87931);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.48),
        0 14px 32px rgba(216, 177, 102, 0.34);
}

.focus-mode .command-bar .danger {
    border-color: rgba(255,255,255,0.1);
    color: #fff0f2;
    background:
        radial-gradient(circle at 20% 12%, rgba(255,255,255,0.24), transparent 30%),
        linear-gradient(180deg, rgba(216, 87, 103, 0.96), rgba(111, 26, 42, 0.96));
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.18),
        0 14px 30px rgba(146, 38, 55, 0.28);
}

.focus-mode .info-drawer-btn {
    color: var(--game-text);
    border: 1px solid rgba(79, 196, 155, 0.24);
    background:
        linear-gradient(180deg, rgba(79, 196, 155, 0.18), rgba(255,255,255,0.04)),
        rgba(255,255,255,0.06);
}

.focus-mode .drawer-panel,
.focus-mode .right-rail {
    border: 1px solid var(--game-glass-line);
    background:
        linear-gradient(135deg, rgba(255,255,255,0.12), rgba(255,255,255,0.04)),
        var(--game-glass-strong);
    color: var(--game-text);
    backdrop-filter: blur(18px);
    box-shadow: 0 26px 70px rgba(0,0,0,0.5);
}

.focus-mode .drawer-close {
    border-color: var(--game-glass-line);
    background: rgba(255,255,255,0.08);
    color: var(--game-text);
}

@media (max-width: 768px) {
    .focus-mode.app-shell,
    .app-shell.focus-mode {
        padding: max(8px, env(safe-area-inset-top)) 8px calc(94px + env(safe-area-inset-bottom));
    }

    .focus-mode .game-layout {
        height: calc(100dvh - 92px - env(safe-area-inset-bottom));
        gap: 8px;
    }

    .focus-mode .hero-panel {
        width: 100%;
        max-height: 112px;
        border-radius: 20px;
        padding: 8px;
    }

    .focus-mode .mobile-wager-status {
        border-color: rgba(244, 217, 140, 0.3);
        background:
            radial-gradient(circle at 20% 10%, rgba(244, 217, 140, 0.28), transparent 36%),
            rgba(255,255,255,0.08);
        color: var(--game-text);
        backdrop-filter: blur(12px);
    }

    .focus-mode .mobile-wager-status span {
        background: linear-gradient(180deg, var(--game-gold-hot), #b9802f);
        color: #241606;
    }

    .focus-mode .board-stage {
        width: 100%;
        grid-template-rows: minmax(0, 1fr);
        gap: 0;
    }

    .focus-mode .board-card {
        width: min(calc(100vw - 16px), calc(100dvh - 224px), 600px);
        align-self: center;
        padding: 9px;
        border-radius: 20px;
    }

    .focus-mode #board {
        width: 100%;
        min-width: 0;
    }

    .focus-mode .command-bar {
        position: fixed;
        left: 8px;
        right: 8px;
        bottom: max(8px, env(safe-area-inset-bottom));
        z-index: 32;
        width: auto;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 8px;
        padding: 10px;
        border-radius: 24px;
    }

    .focus-mode #btn-new-game,
    .focus-mode #btn-redo {
        display: none;
    }

    .focus-mode .info-drawer-btn {
        display: inline-flex;
    }

    .focus-mode .command-bar .btn {
        min-height: 60px;
        padding: 0 6px;
        border-radius: 17px;
        font-size: 0.86rem;
        line-height: 1.05;
    }

    .focus-mode .mobile-tabbar {
        display: none;
    }

    .focus-mode .right-rail {
        left: 10px;
        right: 10px;
        top: max(10px, env(safe-area-inset-top));
        bottom: calc(92px + env(safe-area-inset-bottom));
        border-radius: 22px;
        background:
            linear-gradient(135deg, rgba(255,255,255,0.12), rgba(255,255,255,0.04)),
            var(--game-glass-strong);
    }
}

@media (max-height: 720px) and (min-width: 769px) {
    .focus-mode .board-card {
        width: min(calc(100vw - 40px), calc(100dvh - 178px), 600px);
    }

    .focus-mode .command-bar .btn {
        min-height: 50px;
    }
}

@keyframes chip-pop {
    0% { transform: scale(1); }
    45% { transform: scale(1.08); }
    100% { transform: scale(1); }
}
