/* === 文字の森 / Mojinomori - Frontend Theme ===
 * Mint-green design adapted from the Mojinomori prototype.
 * Vanilla CSS, no preprocessor, no framework.
 */

@import url('https://fonts.googleapis.com/css2?family=Zen+Maru+Gothic:wght@400;500;700;900&family=M+PLUS+Rounded+1c:wght@400;500;700;800&family=Kosugi+Maru&family=Inter:wght@400;500;600&display=swap');

:root {
    --bg: #E8F4EC;
    --bg-soft: #F2F8F4;
    --bg-card: #FFFFFF;
    --rail: #FFFFFF;
    --ink: #1F3A2A;
    --ink-soft: #4A6B58;
    --ink-mute: #88A595;

    --green-900: #1B4A2E;
    --green-700: #2D7A4F;
    --green-600: #3F9560;
    --green-500: #4FAE73;
    --green-400: #7BC79A;
    --green-300: #A6DCBC;
    --green-200: #CDEAD8;
    --green-100: #E1F2E7;
    --green-50:  #EFF8F2;

    --accent: #2D7A4F;
    --accent-soft: #B8E0C7;
    --link: #2D7A4F;

    --warn: #D9924A;
    --bad: #C45A4A;

    --radius-sm: 8px;
    --radius: 14px;
    --radius-lg: 20px;
    --radius-pill: 999px;

    --shadow-sm: 0 1px 2px rgba(31,58,42,.04), 0 2px 6px rgba(31,58,42,.04);
    --shadow: 0 2px 6px rgba(31,58,42,.05), 0 8px 24px rgba(31,58,42,.06);
    --shadow-lg: 0 8px 24px rgba(31,58,42,.08), 0 24px 60px rgba(31,58,42,.1);

    --rail-w: 132px;
    --content-max: 880px;

    --rail-bg: #FFFFFF;
    --rail-border-color: rgba(31,58,42,0.1);
    --rail-divider-bg: rgba(31,58,42,0.08);
    --rail-item-color: #4A6B58;
    --rail-item-hover-bg: rgba(31,58,42,0.05);
    --rail-item-hover-color: #1F3A2A;
    --rail-item-active-bg: #E1F2E7;
    --rail-item-active-color: #2D7A4F;
    --rail-item-active-bar: #2D7A4F;
    --rail-item-active-shadow: rgba(45,122,79,0.4);
}

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

html, body {
    background: var(--bg);
    color: var(--ink);
    font-family: 'Zen Maru Gothic', 'M PLUS Rounded 1c', system-ui, -apple-system, sans-serif;
    font-size: 15px;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a { color: var(--link); text-decoration: none; border-bottom: 1px solid transparent; transition: border-color .15s; }
a:hover { border-bottom-color: var(--link); }

button { font-family: inherit; cursor: pointer; }

::selection { background: var(--accent-soft); color: var(--ink); }

/* === Layout === */

.app {
    display: grid;
    grid-template-columns: var(--rail-w) 1fr;
    min-height: 100vh;
}

/* === Left rail nav === */

.rail {
    background: var(--rail-bg);
    border-right: 1px solid var(--rail-border-color);
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 28px 14px 24px;
    overflow-y: auto;
    scrollbar-width: thin;
}
.rail::-webkit-scrollbar { width: 4px; }
.rail::-webkit-scrollbar-thumb { background: rgba(45,122,79,0.2); border-radius: 4px; }

.rail-logo {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    margin-bottom: 18px;
    cursor: pointer;
    border: none;
    background: transparent;
    padding: 0;
}
.rail-logo svg { width: 44px; height: 44px; }

.rail-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    padding: 0;
}
.rail-divider {
    width: 60%;
    height: 1px;
    background: var(--rail-divider-bg);
    margin: 14px auto;
}

.rail-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 18px 6px 16px;
    border-radius: 18px;
    border: none;
    background: transparent;
    color: var(--rail-item-color);
    cursor: pointer;
    transition: background 160ms ease, color 160ms ease;
    position: relative;
    text-decoration: none;
    width: 100%;
}
.rail-item:hover {
    background: var(--rail-item-hover-bg);
    color: var(--rail-item-hover-color);
    border-bottom-color: transparent;
}
.rail-item:hover .ic { transform: translateY(-1px); }
.rail-item.active {
    background: var(--rail-item-active-bg);
    color: var(--rail-item-active-color);
}
.rail-item.active::before {
    content: "";
    position: absolute;
    left: -14px;
    top: 18px;
    bottom: 18px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--rail-item-active-bar);
    box-shadow: 0 0 12px var(--rail-item-active-shadow);
}
.rail-item .ic {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 200ms ease;
}
.rail-item .ic svg { width: 28px; height: 28px; }
.rail-item .ic-emoji { font-size: 26px; line-height: 1; }
.rail-item .lbl {
    font-size: 13px;
    line-height: 1.25;
    font-weight: 500;
    font-family: 'Inter', system-ui, sans-serif;
    text-align: center;
    letter-spacing: 0.005em;
    max-width: 100px;
}

.rail-spacer { flex: 1; }

/* === Main column === */

.main {
    min-width: 0;
    padding: 36px 56px 80px;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.crumbs {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}
.crumb {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: var(--green-100);
    color: var(--green-700);
    border-radius: var(--radius-pill);
    font-weight: 500;
    border: none;
    cursor: pointer;
    text-decoration: none;
}
.crumb:hover { border-bottom-color: transparent; }
.crumb-sep { color: var(--ink-mute); }

.page {
    width: 100%;
    max-width: var(--content-max);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.page-title {
    font-size: 38px;
    font-weight: 700;
    color: var(--green-700);
    letter-spacing: -0.01em;
    line-height: 1.2;
    margin: 6px 0 0;
}

.page-rule {
    border: none;
    height: 1px;
    background: var(--green-200);
    margin: 4px 0 8px;
}

.page-lead {
    font-size: 15px;
    color: var(--ink);
    line-height: 1.85;
    margin: 0;
    text-wrap: pretty;
}

.source-list {
    list-style: none;
    padding: 16px 22px;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 14px;
    background: white;
    border: 1px solid rgba(45,122,79,0.08);
    border-left: 4px solid var(--green-500);
    border-radius: var(--radius);
}
.source-list a {
    color: var(--green-700);
    text-decoration: none;
    word-break: break-all;
}
.source-list a:hover { text-decoration: underline; }

/* === Section headers === */

.h2-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    background: transparent;
    padding: 0 0 10px;
    border: none;
    border-radius: 0;
    margin: 28px 0 14px;
    position: relative;
}
.h2-bar::after {
    content: "";
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: 1px;
    background: linear-gradient(90deg, var(--green-600) 0, var(--green-600) 36px, var(--green-100) 36px, var(--green-100) 100%);
}
.h2-bar h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--green-900);
    letter-spacing: 0.01em;
}

.h2-bar.no-rule { margin: 12px 0 6px; padding-bottom: 0; }
.h2-bar.no-rule::after { display: none; }

.h3-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0 8px 14px;
    border-left: 4px solid var(--green-500);
    margin: 14px 0 6px;
}
.h3-bar h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--green-700);
}

/* === Cards === */

.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 22px 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(45,122,79,0.06);
}
.card.flat {
    background: var(--green-50);
    box-shadow: none;
}

/* === Buttons === */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-pill);
    font-weight: 600;
    font-size: 14px;
    border: none;
    cursor: pointer;
    transition: transform .1s, box-shadow .15s, background .15s;
    text-decoration: none;
    color: inherit;
    font-family: inherit;
}
.btn-primary {
    background: var(--green-600);
    color: white;
    box-shadow: 0 4px 0 var(--green-700);
}
.btn-primary:hover { background: var(--green-700); transform: translateY(1px); box-shadow: 0 3px 0 var(--green-900); border-bottom-color: transparent; }
.btn-primary:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--green-900); }

.btn-soft {
    background: var(--green-100);
    color: var(--green-700);
}
.btn-soft:hover { background: var(--green-200); border-bottom-color: transparent; }

.btn-ghost {
    background: transparent;
    color: var(--green-700);
    border: 1px solid var(--green-300);
}
.btn-ghost:hover { background: var(--green-50); border-bottom-color: var(--green-300); }

/* === Hero === */

.hero {
    background:
        linear-gradient(180deg, rgba(20,30,40,0.55), rgba(20,30,40,0.78)),
        url("/assets/hero-bg.jpg") center/cover no-repeat,
        linear-gradient(180deg, var(--green-50), white);
    border-radius: 28px;
    padding: 44px 44px 36px;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(45,122,79,0.08);
    color: #fff;
}
.hero .hero-title { color: #fff; }
.hero .hero-sub { color: rgba(255,255,255,0.85); }
.hero .hero-eyebrow {
    background: rgba(255,255,255,0.12);
    border-color: rgba(255,255,255,0.25);
    color: rgba(255,255,255,0.95);
    backdrop-filter: blur(4px);
}
.hero .ip-card {
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(4px);
}
.hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    background: white;
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 600;
    color: var(--green-700);
    border: 1px solid var(--green-200);
}
.hero-title {
    font-size: 52px;
    font-weight: 800;
    line-height: 1.1;
    margin: 14px 0 8px;
    color: var(--green-900);
    letter-spacing: -0.02em;
}
.hero-title .ja { font-family: 'Zen Maru Gothic', serif; }
.hero-sub {
    font-size: 16px;
    color: var(--ink-soft);
    max-width: 540px;
    margin: 0 0 22px;
    line-height: 1.7;
}
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* IP card */
.ip-card {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: white;
    padding: 6px 8px 6px 16px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--green-200);
    font-family: 'Kosugi Maru', monospace;
    font-size: 14px;
    color: var(--ink);
}
.ip-card code {
    font-family: inherit;
    color: var(--green-700);
    font-weight: 600;
}
.ip-copy {
    background: var(--green-600);
    color: white;
    border: none;
    border-radius: var(--radius-pill);
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.ip-copy:hover { background: var(--green-700); }
.ip-copy.copied { background: var(--green-700); }

/* === Stat tiles === */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}
.stat-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.stat-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.stat {
    background: white;
    border-radius: var(--radius);
    padding: 14px 16px;
    border: 1px solid rgba(45,122,79,0.08);
}
.stat .num { font-size: 22px; font-weight: 800; color: var(--green-700); line-height: 1.1; }
.stat .num.stat-name { font-size: 18px; overflow-wrap: anywhere; }
.stat .lbl { font-size: 12px; color: var(--ink-mute); margin-top: 2px; }

/* === Leaderboard === */

.lb {
    background: white;
    border-radius: var(--radius-lg);
    padding: 0;
    overflow: hidden;
    border: 1px solid rgba(45,122,79,0.08);
}
.lb-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 22px;
    background: linear-gradient(180deg, var(--green-100), var(--green-50));
    border-bottom: 1px solid var(--green-200);
    flex-wrap: wrap;
    gap: 10px;
}
.lb-head h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--green-900);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.lb-info {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px; height: 18px;
    border-radius: 50%;
    background: var(--green-100);
    color: var(--green-700);
    font-size: 11px;
    font-weight: 700;
    cursor: help;
    position: relative;
    border: 1px solid var(--green-200);
    user-select: none;
    outline: none;
    transition: background .15s, color .15s;
}
.lb-info:hover, .lb-info:focus-visible {
    background: var(--green-600);
    color: white;
    border-color: var(--green-700);
}
.lb-info::after {
    content: attr(data-tooltip);
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(-4px);
    background: var(--green-900);
    color: white;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.45;
    padding: 9px 12px;
    border-radius: 8px;
    width: max-content;
    max-width: 260px;
    white-space: normal;
    text-align: left;
    pointer-events: none;
    opacity: 0;
    transition: opacity .15s ease, transform .15s ease;
    box-shadow: 0 8px 24px rgba(27,74,46,0.18);
    z-index: 30;
}
.lb-info::before {
    content: "";
    position: absolute;
    top: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-bottom-color: var(--green-900);
    pointer-events: none;
    opacity: 0;
    transition: opacity .15s ease;
    z-index: 31;
}
.lb-info:hover::after,
.lb-info:focus-visible::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.lb-info:hover::before,
.lb-info:focus-visible::before {
    opacity: 1;
}
.lb-tabs { display: flex; gap: 4px; background: white; padding: 3px; border-radius: var(--radius-pill); border: 1px solid var(--green-200); }
.lb-tab { border: none; background: transparent; padding: 5px 14px; border-radius: var(--radius-pill); font-size: 12px; font-weight: 600; color: var(--ink-soft); cursor: pointer; font-family: inherit; }
.lb-tab.active { background: var(--green-600); color: white; }

.lb-row {
    display: grid;
    grid-template-columns: 50px 40px 1fr auto;
    gap: 14px;
    align-items: center;
    padding: 12px 22px;
    border-top: 1px solid var(--green-50);
    transition: background .12s;
    color: inherit;
    text-decoration: none;
}
.lb-row:hover { background: var(--green-50); border-bottom-color: transparent; }
.lb-rank {
    font-weight: 800;
    color: var(--ink-mute);
    font-size: 14px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}
.lb-rank.gold { color: #C9A227; font-size: 18px; }
.lb-rank.silver { color: #909AA8; font-size: 17px; }
.lb-rank.bronze { color: #B07748; font-size: 16px; }

.lb-avatar {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: grid;
    place-items: center;
    font-weight: 700;
    color: white;
    font-size: 14px;
    image-rendering: pixelated;
    background: var(--green-200);
    object-fit: cover;
}

.lb-name { font-weight: 600; color: var(--ink); font-size: 14px; }
.lb-meta { font-size: 11px; color: var(--ink-mute); }

.lb-score {
    font-size: 16px;
    font-weight: 800;
    color: var(--green-700);
    font-variant-numeric: tabular-nums;
    text-align: right;
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 2px;
}
.lb-score .unit { font-size: 11px; color: var(--ink-mute); font-weight: 500; margin-left: 2px; }
.lb-score .coin { width: 22px; height: 22px; image-rendering: pixelated; vertical-align: -5px; }

.lb-foot {
    padding: 14px 22px;
    text-align: center;
    border-top: 1px solid var(--green-50);
    background: var(--green-50);
}
.lb-foot a { font-size: 13px; font-weight: 600; }
.lb-more-btn {
    background: none;
    border: none;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--green-700);
    cursor: pointer;
    padding: 0;
}
.lb-more-btn:hover { text-decoration: underline; }
.lb-modal-tabs { margin: 10px 0 14px; }

/* === Two-col home grid === */

.home-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 16px;
}
@media (max-width: 980px) {
    .home-grid { grid-template-columns: 1fr; }
}

/* === Feature tiles === */

.feature-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}
.feature {
    background: white;
    border-radius: var(--radius);
    padding: 18px;
    border: 1px solid rgba(45,122,79,0.08);
    display: flex;
    flex-direction: column;
    gap: 8px;
    cursor: pointer;
    transition: transform .15s, box-shadow .15s;
    text-decoration: none;
    color: inherit;
}
.feature:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-bottom-color: rgba(45,122,79,0.08); }
.feature-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: var(--green-100);
    color: var(--green-700);
}
.feature-title { font-weight: 700; color: var(--green-900); font-size: 15px; }
.feature-desc { font-size: 13px; color: var(--ink-soft); line-height: 1.55; }

/* === Rules === */

.rule {
    background: white;
    border-radius: var(--radius);
    padding: 18px 22px;
    border: 1px solid rgba(45,122,79,0.08);
    border-left: 4px solid var(--green-500);
}
.rule + .rule { margin-top: 10px; }
.rule h4 {
    margin: 0 0 6px;
    font-size: 16px;
    color: var(--green-700);
    font-weight: 700;
}
.rule p { margin: 0; color: var(--ink); font-size: 14px; line-height: 1.7; }

/* === Step list === */

.steps {
    counter-reset: step;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.step {
    display: grid;
    grid-template-columns: 44px 1fr;
    gap: 18px;
    align-items: start;
    background: white;
    border-radius: var(--radius);
    padding: 18px 22px;
    border: 1px solid rgba(45,122,79,0.08);
}
.step-num {
    counter-increment: step;
    width: 38px; height: 38px;
    border-radius: 50%;
    background: var(--green-100);
    color: var(--green-700);
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: 16px;
}
.step-num::before { content: counter(step); }
.step h4 { margin: 0 0 6px; font-size: 15px; color: var(--green-900); }
.step p { margin: 0; font-size: 14px; color: var(--ink-soft); line-height: 1.6; }
.step code {
    background: var(--green-50);
    padding: 1px 6px;
    border-radius: 4px;
    font-family: 'Kosugi Maru', monospace;
    color: var(--green-700);
    font-size: 12px;
}

/* === Get Started notes === */
.start-label { font-size: 12px; color: var(--ink-mute); margin-bottom: 4px; }
.start-note {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 0 0;
    margin-top: 14px;
    border-top: 1px solid var(--green-100);
}
.start-note-icon { flex-shrink: 0; margin-top: 2px; color: var(--green-600); }
.start-note-body strong { display: block; font-weight: 700; color: var(--green-900); margin-bottom: 3px; }
.start-note-body p { margin: 0; font-size: 0.875rem; color: var(--ink-soft); line-height: 1.5; }

/* === FAQ === */

.faq {
    background: white;
    border-radius: var(--radius);
    border: 1px solid rgba(45,122,79,0.08);
    overflow: hidden;
}
.faq + .faq { margin-top: 10px; }
.faq-q {
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    padding: 16px 22px;
    font-weight: 600;
    color: var(--ink);
    font-size: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    font-family: inherit;
}
.faq-q .ic { color: var(--green-600); transition: transform .2s; display: inline-flex; }
.faq.open .faq-q .ic { transform: rotate(45deg); }
.faq-a {
    padding: 0 22px;
    max-height: 0;
    overflow: hidden;
    transition: max-height .25s ease, padding .25s ease;
    color: var(--ink-soft);
    font-size: 14px;
    line-height: 1.7;
}
.faq.open .faq-a { max-height: 400px; padding: 0 22px 18px; }

/* === Map === */

.page-map {
    height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
    max-width: none;
}
.map-fullbleed {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
}
.map-frame {
    background: white;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(45,122,79,0.08);
    overflow: hidden;
}
.map-frame iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: var(--radius-lg);
}
.map-open-link {
    position: absolute;
    right: 12px;
    bottom: 12px;
    background: rgba(27,74,46,.78);
    color: white;
    padding: 6px 12px;
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    backdrop-filter: blur(6px);
}
.map-open-link:hover { border-bottom-color: transparent; }

/* === Footer === */

.foot {
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid var(--green-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    color: var(--ink-mute);
    font-size: 12px;
}
.foot-links { display: flex; gap: 16px; }
.foot a { color: var(--ink-soft); }

/* === Top bar (lang + theme + crumbs) === */

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}
.topbar-actions { display: flex; gap: 8px; align-items: center; }
.theme-toggle {
    background: var(--green-100);
    color: var(--green-700);
    border: none;
    border-radius: var(--radius-pill);
    padding: 6px 10px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.theme-toggle:hover { background: var(--green-200); }
.lang-switch {
    display: inline-flex;
    background: white;
    border-radius: var(--radius-pill);
    padding: 3px;
    border: 1px solid var(--green-200);
    gap: 2px;
}
.lang-switch button {
    background: transparent;
    border: none;
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-soft);
    cursor: pointer;
    font-family: inherit;
}
.lang-switch button.active {
    background: var(--green-600);
    color: white;
}

/* === Profile === */

.profile-head {
    display: grid;
    grid-template-columns: 84px 1fr auto;
    gap: 18px;
    align-items: center;
    background: white;
    border-radius: var(--radius-lg);
    padding: 22px;
    border: 1px solid rgba(45,122,79,0.08);
}
.profile-avatar {
    width: 84px; height: 84px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    color: white;
    font-weight: 800;
    font-size: 30px;
    image-rendering: pixelated;
    background: var(--green-200);
    object-fit: cover;
}
.profile-name { font-size: 22px; font-weight: 800; color: var(--green-900); }
.profile-meta { color: var(--ink-mute); font-size: 13px; margin-top: 2px; }

.profile-view-switch {
    display: grid;
    grid-template-columns: repeat(2, minmax(112px, 1fr));
    gap: 4px;
    padding: 4px;
    background: var(--green-50);
    border: 1px solid var(--green-200);
    border-radius: 14px;
    min-width: 300px;
}
.profile-view-btn {
    min-height: 56px;
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    align-items: center;
    gap: 9px;
    padding: 8px 10px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: var(--ink-soft);
    text-align: left;
    font-family: inherit;
    transition: background 140ms ease, border-color 140ms ease, color 140ms ease, transform 140ms ease;
}
.profile-view-btn:hover {
    background: rgba(255,255,255,0.72);
    color: var(--green-700);
}
.profile-view-btn.active {
    background: white;
    border-color: var(--green-200);
    color: var(--green-900);
    box-shadow: var(--shadow-sm);
}
.profile-view-btn[data-view="minecraft"].active {
    border-color: rgba(146, 102, 55, 0.34);
    color: #6F4A25;
}
.profile-view-kanji-icon,
.profile-view-mc-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    flex-shrink: 0;
}
.profile-view-kanji-icon {
    display: grid;
    place-items: center;
    background: var(--green-100);
    color: var(--green-700);
    font-size: 1.28rem;
    font-weight: 900;
    line-height: 1;
}
.profile-view-mc-icon {
    object-fit: contain;
    filter: drop-shadow(0 2px 3px rgba(77, 48, 23, 0.28));
}
.profile-view-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
    line-height: 1.2;
}
.profile-view-copy > span {
    font-size: 0.9rem;
    font-weight: 800;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.profile-view-copy small {
    color: var(--ink-mute);
    font-size: 0.72rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-view-panel {
    display: flex;
    flex-direction: column;
    gap: 24px;
}
.profile-view-panel[hidden] { display: none !important; }

.back-link {
    display: inline-flex;
    align-items: center;
    color: var(--green-700);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    gap: 6px;
}
.back-link:hover { border-bottom-color: var(--green-700); }

/* === Player profile: level selector & details === */

.level-btn-grid {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.level-btn {
    flex: 1 1 auto;
    min-width: 100px;
    padding: 10px 14px;
    border: 1px solid var(--green-200);
    border-radius: var(--radius);
    background: white;
    color: var(--ink);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
    font-family: inherit;
}
.level-btn:hover:not(:disabled) {
    background: var(--green-50);
    transform: translateY(-1px);
}
.level-btn.selected {
    border-color: var(--level-color-border, var(--green-600));
    background: var(--level-color-bg, var(--green-100));
    color: var(--level-color, var(--green-700));
}
.level-btn:disabled { opacity: 0.4; cursor: default; }

.level-tag {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    margin-left: 8px;
    vertical-align: middle;
    line-height: 1.6;
}

.stats-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}
/* === Level detail footer (H - two-col + accuracy donut) === */
.lvl-stats {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--green-100);
    display: grid;
    grid-template-columns: 1fr 1px 1fr;
    align-items: center;
}
.lvl-stats__col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 2px 4px;
}
.lvl-stats__rule {
    background: var(--green-100);
    height: 100%;
}
.lvl-stats__num {
    font-weight: 800;
    font-size: 1.7rem;
    line-height: 1;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}
.lvl-stats__lbl {
    font-size: 0.62rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--ink-mute);
    font-weight: 600;
}
.lvl-stats__donut-wrap {
    position: relative;
    width: 64px;
    height: 64px;
}
.lvl-stats__donut-pct {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.1rem;
    line-height: 1;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}
.lvl-stats__donut-track {
    stroke: var(--green-100);
}

.progress-bar {
    height: 8px;
    background: var(--green-100);
    border-radius: 4px;
    overflow: hidden;
    margin: 14px 0;
}
.progress-bar .progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
    background: linear-gradient(90deg, var(--green-500), var(--green-700));
}

/* === Answer-speed chart === */
.atime-card { padding-bottom: 14px; }
.atime-summary {
    font-size: 13px;
    color: var(--ink-soft);
    font-weight: 600;
    margin: 2px 0 10px;
    font-variant-numeric: tabular-nums;
}
.atime-chart {
    width: 100%;
    overflow: hidden;
}
.atime-svg {
    width: 100%;
    height: auto;
    display: block;
}
.atime-grid-line {
    stroke: var(--green-100);
    stroke-width: 1;
}
.atime-grid-label {
    fill: var(--ink-mute);
    font-size: 10px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.atime-dot--ok { fill: var(--green-600); fill-opacity: 0.55; }
.atime-dot--bad { fill: var(--bad); fill-opacity: 0.7; }
.atime-median { stroke: var(--ink-mute); stroke-width: 1; opacity: 0.45; }
.atime-trend { opacity: 0.92; }
.atime-legend-label {
    fill: var(--ink-mute);
    font-size: 10px;
    font-weight: 600;
}

:is(html,body).dark .atime-grid-line { stroke: rgba(255,255,255,0.06); }
:is(html,body).dark .atime-dot--ok { fill-opacity: 0.7; }

/* === Level 100%-unlocked completion whisper === */
.completion-whisper {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-top: 14px;
    gap: 8px;
    font-size: 12px;
    letter-spacing: 0.4px;
    animation: completionWhisperIn 300ms ease-out both;
}
.completion-whisper__kao {
    font-size: 11px;
    color: #D74E8A;
    opacity: 0.7;
}
.completion-whisper__msg {
    font-weight: 600;
    color: #D74E8A;
}
:is(html,body).dark .completion-whisper__kao {
    color: #F4A8BC;
    opacity: 1;
}
:is(html,body).dark .completion-whisper__msg {
    color: #FF7AB0;
}
@keyframes completionWhisperIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
    .completion-whisper { animation: none; }
}

.dot.new { background: var(--ink-mute); }
.dot.learning { background: #4A9BD9; }
.dot.mature { background: var(--green-500); }
.dot.due { background: var(--warn); }

/* === Cards Tabs (player profile) === */

.cards-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.cards-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border: 1px solid var(--green-200);
    border-radius: var(--radius-pill);
    background: white;
    color: var(--ink);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    font-family: inherit;
}
.cards-tab:hover { background: var(--green-50); }
.cards-tab.active {
    border-color: var(--tab-color, var(--green-600));
    background: var(--green-100);
    color: var(--tab-color, var(--green-700));
}
.cards-tab .tab-count {
    background: var(--green-50);
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 0.78rem;
    color: var(--ink-mute);
    font-weight: 600;
}
.cards-tab.active .tab-count {
    background: white;
    color: var(--tab-color, var(--green-700));
}

.tab-description {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    margin: 18px 0 16px;
    font-size: inherit;
    color: inherit;
    line-height: 1.55;
}
.tab-desc-journey {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 28px;
    align-items: center;
}
.tab-desc-track {
    position: relative;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    padding: 22px 6px 8px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 10px;
}
.tab-desc-track::before {
    content: "";
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: 14px;
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
}
.tab-desc-stage {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    transition: opacity 0.15s;
}
.tab-desc-stage-icon {
    width: 36px;
    height: 36px;
    opacity: 0.72;
    transition: opacity 0.15s, filter 0.15s;
}
.tab-desc-stage-name {
    font-size: 0.62rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: inherit;
}
.tab-desc-stage.is-active .tab-desc-stage-icon {
    opacity: 1;
    filter: drop-shadow(0 0 10px var(--stage-glow, rgba(74,155,217,0.5)));
}
.tab-desc-body-eyebrow {
    font-size: 0.65rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--stage-natural-color, #9ed09b);
    font-weight: 700;
    margin-bottom: 4px;
}
.tab-desc-body {
    font-size: 0.9rem;
    color: var(--ink-soft);
    line-height: 1.55;
}
.tab-desc-body strong {
    color: var(--ink);
    font-weight: 600;
}

@media (max-width: 640px) {
    .tab-desc-journey {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

.cards-section-active {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--green-100);
}

.kanji-level-group { margin-bottom: 20px; }
.kanji-level-label {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--green-900);
}
.kanji-level-count { color: var(--ink-mute); font-weight: 500; }

/* === Kanji tile grid === */

.kanji-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.kanji-tile {
    --tile-hue: var(--diff-hue, 140);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background:
        linear-gradient(135deg,
            hsla(var(--tile-hue), 72%, 93%, 0.98),
            hsla(var(--tile-hue), 58%, 98%, 0.98));
    border: 1px solid hsla(var(--tile-hue), 48%, 64%, 0.58);
    border-radius: 8px;
    padding: 6px 12px;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.78),
        0 1px 2px rgba(31,58,42,0.04);
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.15s;
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
    color: inherit;
}
.kanji-tile:hover {
    background:
        linear-gradient(135deg,
            hsla(var(--tile-hue), 76%, 90%, 0.98),
            hsla(var(--tile-hue), 62%, 96%, 0.98));
    transform: translateY(-1px);
    border-color: hsla(var(--tile-hue), 54%, 56%, 0.72);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.82),
        0 5px 14px hsla(var(--tile-hue), 42%, 45%, 0.12);
}
.kanji-tile:focus-visible {
    outline: 2px solid hsla(var(--tile-hue), 54%, 44%, 0.56);
    outline-offset: 2px;
}
.kanji-char { font-size: 1.4rem; font-weight: 700; line-height: 1; color: var(--green-900); }
.kanji-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 0.7rem;
    line-height: 1.2;
}
.kanji-stab { font-weight: 700; }
.kanji-reps { color: var(--ink-mute); }
.kanji-meta-label {
    font-size: 0.6em;
    font-weight: 400;
    opacity: 0.6;
    margin-right: 1px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}
.kanji-stab.due-overdue { color: var(--warn); font-weight: 800; }
.kanji-stab.due-new     { color: var(--ink-mute); }
.kanji-stab.due-future  { color: var(--ink-soft); }

/* === Loading / Empty states === */

.loading, .empty-state {
    text-align: center;
    padding: 36px 20px;
    color: var(--ink-mute);
}
.loading::after {
    content: '';
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid var(--green-100);
    border-top-color: var(--green-600);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 8px;
    vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state p { margin-top: 6px; font-size: 0.92rem; }

/* === Search box === */

.search-box {
    display: flex;
    gap: 10px;
    align-items: center;
    background: white;
    border: 1px solid var(--green-200);
    border-radius: var(--radius);
    padding: 8px 14px;
}
.search-box .ic { color: var(--green-600); }
.search-box input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 15px;
    font-family: inherit;
    background: transparent;
    color: var(--ink);
}
.search-box input::placeholder { color: var(--ink-mute); }

/* === Player grid (recent cards on stats page) === */

.player-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
}
.player-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: white;
    border: 1px solid rgba(45,122,79,0.08);
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.15s, transform 0.15s, box-shadow 0.15s;
    text-decoration: none;
    color: inherit;
}
.player-card:hover {
    background: var(--green-50);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
    border-bottom-color: rgba(45,122,79,0.08);
}
.player-card .avatar {
    width: 44px; height: 44px;
    border-radius: 8px;
    image-rendering: pixelated;
    flex-shrink: 0;
    background: var(--green-100);
    object-fit: cover;
}
.player-card .info { min-width: 0; flex: 1; }
.player-card .name {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--green-900);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.player-card .sub {
    color: var(--ink-mute);
    font-size: 0.82rem;
    margin-top: 2px;
}
.player-card-chevron {
    margin-left: auto;
    font-size: 1.4rem;
    line-height: 1;
    color: var(--ink-mute);
    transition: transform 0.15s, color 0.15s;
}
.player-card:hover .player-card-chevron {
    color: var(--green-700);
    transform: translateX(2px);
}

/* === Kanji detail modal === */

@keyframes modal-fadein { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-scalein {
    from { opacity: 0; transform: scale(0.92) translateY(8px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.kanji-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(20,40,30,0.55);
    backdrop-filter: blur(5px);
    animation: modal-fadein 0.18s ease forwards;
    padding: 16px;
}
.kanji-modal-panel {
    position: relative;
    background: var(--bg-card);
    border: 1px solid rgba(45,122,79,0.1);
    border-radius: 18px;
    padding: 28px 28px 24px;
    width: 100%;
    max-width: 460px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modal-scalein 0.22s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    scrollbar-width: thin;
    scrollbar-color: var(--green-200) transparent;
    box-shadow: var(--shadow-lg);
}
.hof-modal-panel { max-width: 680px; }
.kanji-modal-close {
    position: absolute;
    top: 14px;
    right: 16px;
    background: none;
    border: 1px solid var(--green-200);
    border-radius: 50%;
    color: var(--ink-mute);
    font-size: 1.1rem;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    line-height: 1;
    transition: background 0.15s, color 0.15s;
}
.kanji-modal-close::after { content: '×'; }
.kanji-modal-close:hover {
    background: var(--green-50);
    color: var(--ink);
}
.kanji-modal-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 4px;
    padding-right: 36px;
}
.kanji-modal-char {
    font-size: 4rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 6px;
    letter-spacing: -0.02em;
    color: var(--green-900);
}
.kanji-modal-reading {
    font-size: 1.05rem;
    color: var(--ink-soft);
    margin-bottom: 4px;
    letter-spacing: 0.04em;
}
.kanji-modal-meanings {
    font-size: 0.95rem;
    color: var(--ink);
    line-height: 1.5;
}
.kanji-modal-divider {
    height: 1px;
    background: var(--green-100);
    margin: 16px 0;
}
.kanji-modal-section-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ink-mute);
    margin-bottom: 10px;
}
.kanji-modal-progress {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.kanji-modal-badge {
    background: var(--green-50);
    border: 1px solid var(--green-100);
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 0.8rem;
    color: var(--ink-soft);
}
.kanji-modal-badge-lapses { color: var(--warn); }

.example-sentence {
    background: var(--green-50);
    border: 1px solid var(--green-100);
    border-radius: 10px;
    padding: 13px 16px;
    margin-bottom: 8px;
}
.example-sentence:last-child { margin-bottom: 0; }
.example-ja { font-size: 1rem; font-weight: 600; line-height: 2.2; color: var(--ink); }
.example-ja ruby { ruby-align: center; }
.example-ja rt { font-size: 0.58em; font-weight: 400; color: var(--ink-mute); }
.example-tr { font-size: 0.85rem; color: var(--ink-soft); margin-top: 5px; line-height: 1.5; }

.kanji-modal-jisho {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--green-700);
    text-decoration: none;
    border: 1px solid var(--green-200);
    border-radius: 8px;
    padding: 7px 14px;
    transition: background 0.15s;
}
.kanji-modal-jisho:hover { background: var(--green-50); border-bottom-color: var(--green-200); }

.kanji-modal-loading {
    height: 80px;
    background: linear-gradient(90deg, var(--green-50) 25%, var(--green-100) 50%, var(--green-50) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite;
    border-radius: 8px;
    margin-top: 16px;
}
@keyframes shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* === Animations === */

@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.page > * { animation: fadein .35s ease both; }
.page > *:nth-child(2) { animation-delay: .04s; }
.page > *:nth-child(3) { animation-delay: .08s; }
.page > *:nth-child(4) { animation-delay: .12s; }
.page > *:nth-child(5) { animation-delay: .16s; }

/* === Dark mode === */

:is(html,body).dark {
    --bg: #0F1A14;
    --bg-soft: #142219;
    --bg-card: #1A2A20;
    --rail: #142219;
    --ink: #E8F0EA;
    --ink-soft: #A8C4B5;
    --ink-mute: #6E8A7A;
    --green-50: #1A2A20;
    --green-100: #1F3328;
    --green-200: #294636;
    --green-300: #356048;
    --green-400: #4A8868;
    --green-500: #5BAA80;
    --green-600: #7BC79A;
    --green-700: #A6DCBC;
    --green-900: #E1F2E7;
    --accent-soft: #294636;

    --rail-bg: linear-gradient(180deg, #0f1c18 0%, #122620 100%);
    --rail-border-color: rgba(255,255,255,0.04);
    --rail-divider-bg: rgba(255,255,255,0.04);
    --rail-item-color: #8fb29c;
    --rail-item-hover-bg: rgba(255,255,255,0.025);
    --rail-item-hover-color: #cfe6d6;
    --rail-item-active-bg: #18302a;
    --rail-item-active-color: #6fd39a;
    --rail-item-active-bar: #7be0a6;
    --rail-item-active-shadow: rgba(123,224,166,0.55);
}
:is(html,body).dark .card,
:is(html,body).dark .lb,
:is(html,body).dark .ip-card,
:is(html,body).dark .stat,
:is(html,body).dark .feature,
:is(html,body).dark .rule,
:is(html,body).dark .source-list,
:is(html,body).dark .step,
:is(html,body).dark .faq,
:is(html,body).dark .map-frame,
:is(html,body).dark .profile-head,
:is(html,body).dark .lang-switch,
:is(html,body).dark .lb-tabs,
:is(html,body).dark .level-btn,
:is(html,body).dark .cards-tab,
:is(html,body).dark .player-card,
:is(html,body).dark .kanji-tile,
:is(html,body).dark .search-box,
:is(html,body).dark .kanji-modal-panel {
    background: var(--bg-card);
    border-color: rgba(123,199,154,0.15);
}
:is(html,body).dark .hero {
    background:
        linear-gradient(180deg, rgba(10,18,12,0.65), rgba(10,18,12,0.85)),
        url("/assets/hero-bg.jpg") center/cover no-repeat,
        linear-gradient(180deg, var(--green-900), #0F1A14);
    border-color: rgba(123,199,154,0.15);
}
:is(html,body).dark .h2-bar { background: transparent; }
:is(html,body).dark .h2-bar::after { background: linear-gradient(90deg, var(--green-300) 0, var(--green-300) 36px, rgba(123,199,154,0.2) 36px, rgba(123,199,154,0.2) 100%); }
:is(html,body).dark .lb-head { background: linear-gradient(180deg, var(--green-100), transparent); }
:is(html,body).dark .lb-foot,
:is(html,body).dark .card.flat,
:is(html,body).dark .example-sentence,
:is(html,body).dark .kanji-modal-badge { background: var(--green-50); }
:is(html,body).dark .btn-primary { box-shadow: 0 4px 0 #1B4A2E; }
:is(html,body).dark .lb-row:hover { background: rgba(123,199,154,0.05); }
:is(html,body).dark .profile-view-switch,
:is(html,body).dark .mcstats-view-switch,
:is(html,body).dark .mcstats-summary-card,
:is(html,body).dark .mcstats-section-head,
:is(html,body).dark .mcstats-profile-link {
    background: var(--green-50);
    border-color: rgba(123,199,154,0.16);
}
:is(html,body).dark .profile-view-btn:hover {
    background: rgba(123,199,154,0.08);
}
:is(html,body).dark .profile-view-btn.active {
    background: var(--bg-card);
    border-color: rgba(123,199,154,0.22);
}
:is(html,body).dark .profile-view-btn[data-view="minecraft"].active {
    color: #E7C08B;
    border-color: rgba(231,192,139,0.28);
}
:is(html,body).dark .kanji-tile {
    background:
        linear-gradient(135deg,
            hsla(var(--tile-hue), 42%, 23%, 0.96),
            hsla(var(--tile-hue), 32%, 16%, 0.98));
    border-color: hsla(var(--tile-hue), 48%, 48%, 0.46);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.04),
        0 1px 0 rgba(0,0,0,0.08);
}
:is(html,body).dark .kanji-tile:hover {
    background:
        linear-gradient(135deg,
            hsla(var(--tile-hue), 46%, 27%, 0.98),
            hsla(var(--tile-hue), 34%, 19%, 0.98));
    border-color: hsla(var(--tile-hue), 58%, 56%, 0.62);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.06),
        0 6px 16px rgba(0,0,0,0.18);
}
:is(html,body).dark .mcstats-view-btn[data-mcstats-view="advancements"].active {
    color: #E7C08B;
    border-color: rgba(231,192,139,0.28);
}
:is(html,body).dark .mcstats-selector-icon {
    background: var(--green-100);
}
:is(html,body).dark .mcstats-summary-card {
    background: linear-gradient(180deg, var(--green-50), rgba(26,42,32,0.84));
}
:is(html,body).dark .mcstats-profile-link:hover {
    background: var(--green-100);
}

/* Tooltip on the (?) badge - pin to dark fill so the white text stays
 * legible after the palette flip. The light-mode rule uses var(--green-900)
 * which becomes near-white in dark mode, hiding the text. */
:is(html,body).dark .lb-info::after {
    background: #0F1A14;
    color: #E8F0EA;
    border: 1px solid rgba(123,199,154,0.18);
    box-shadow: 0 8px 24px rgba(0,0,0,0.45);
}
:is(html,body).dark .lb-info::before { border-bottom-color: #0F1A14; }

/* Rail palette in dark mode mirrors the original dark-glass look. */
:is(html,body).dark .rail {
    background: linear-gradient(180deg, #0f1c18 0%, #122620 100%);
    border-right: 1px solid rgba(255,255,255,0.04);
}
:is(html,body).dark .rail::-webkit-scrollbar-thumb { background: rgba(143,178,156,0.25); }
:is(html,body).dark .rail-divider { background: rgba(255,255,255,0.04); }
:is(html,body).dark .rail-item { color: #8fb29c; }
:is(html,body).dark .rail-item:hover {
    background: rgba(255,255,255,0.025);
    color: #cfe6d6;
}
:is(html,body).dark .rail-item.active {
    background: #18302a;
    color: #6fd39a;
}
:is(html,body).dark .rail-item.active::before {
    background: #7be0a6;
    box-shadow: 0 0 12px rgba(123,224,166,0.55);
}

/* === Responsive === */

@media (max-width: 860px) {
    :root { --content-max: 100%; }
    .app { grid-template-columns: 1fr; }
    .rail {
        position: sticky;
        top: 0;
        z-index: 50;
        height: auto;
        flex-direction: row;
        align-items: center;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 8px 12px;
        border-right: none;
        border-bottom: 1px solid rgba(255,255,255,0.06);
        gap: 6px;
        white-space: nowrap;
    }
    .rail-logo { display: none; }
    .rail-divider { display: none; }
    .rail-group {
        flex-direction: row;
        width: auto;
        padding: 0;
        gap: 6px;
        flex-shrink: 0;
    }
    .rail-item {
        flex: 0 0 auto;
        flex-direction: row;
        gap: 6px;
        padding: 8px 12px;
        width: auto;
        min-width: auto;
        border-radius: 999px;
    }
    .rail-item .ic { width: 20px; height: 20px; }
    .rail-item .ic svg { width: 18px; height: 18px; }
    .rail-item .ic-emoji { font-size: 18px; }
    .rail-item .lbl { max-width: none; font-size: 12px; text-align: left; }
    .rail-item.active::before { display: none; }
    .main { padding: 20px 16px 60px; }
    .topbar { flex-wrap: wrap; gap: 8px; }
    .page { max-width: 100%; }
    .hero { padding: 28px 22px 24px; border-radius: 20px; }
    .hero-title { font-size: 32px !important; line-height: 1.15; }
    .hero-sub { font-size: 14px; }
    .hero-actions { flex-wrap: wrap; gap: 10px; }
    .hero-actions > * { flex: 1 1 auto; }
    .ip-card { width: 100%; justify-content: space-between; }
    .stat-grid, .stat-grid.cols-3, .stat-grid.cols-4 { grid-template-columns: 1fr 1fr !important; gap: 10px; }
    .stat .num { font-size: 22px; }
    .feature-grid { grid-template-columns: 1fr; }
    .home-grid { grid-template-columns: 1fr; }
    .lb-row { grid-template-columns: 36px 32px 1fr auto; gap: 10px; padding: 10px 12px; }
    .lb-rank { font-size: 14px; }
    .lb-name { font-size: 14px; }
    .lb-meta { font-size: 11px; }
    .lb-score { font-size: 14px; }
    .step { grid-template-columns: 38px 1fr; padding: 14px 16px; gap: 12px; }
    .step h4 { font-size: 14px; }
    .step p { font-size: 13px; }
    .page-title { font-size: 28px; }
    .page-lead { font-size: 14px; }
    .h2-bar h2 { font-size: 14px; }
    .card { padding: 16px; }
    .profile-head { grid-template-columns: 64px 1fr; gap: 14px; padding: 18px; }
    .profile-avatar { width: 64px; height: 64px; font-size: 22px; }
    .profile-view-switch {
        grid-column: 1 / -1;
        min-width: 0;
        width: 100%;
    }
    .mcstats-profile-head {
        align-items: flex-start;
        flex-direction: column;
    }
    .mcstats-profile-link {
        width: 100%;
    }
    .mcstats-summary-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .hero-title { font-size: 26px !important; }
    .hero { padding: 22px 18px 20px; }
    .stat-grid { grid-template-columns: 1fr 1fr !important; }
    .stat { padding: 12px; }
    .lb-row { grid-template-columns: 30px 28px 1fr auto; gap: 8px; }
    .lang-switch button { padding: 4px 8px; font-size: 11px; }
    .player-grid { grid-template-columns: 1fr; }
    .kanji-modal-panel { padding: 22px 18px; }
    .kanji-modal-char { font-size: 2.8rem; }
    .profile-view-switch { grid-template-columns: 1fr; }
    .mcstats-view-switch { grid-template-columns: 1fr; }
    .profile-view-btn { min-height: 52px; }
}

/* === Hide the floating dropdown lang switcher on pages that have the
 *     topbar pill switch (new design pages). On legacy pages
 *     (e.g. /review/:token) the dropdown stays visible. */
body:has(.lang-switch) #lang-switcher { display: none; }

/* === Legacy variable aliases for review.html (post-session review page) === */
:root {
    --panel-bg: var(--bg-card);
    --card-bg: var(--green-50);
    --card-bg-hover: var(--green-100);
    --accent-hover: var(--green-700);
    --green: var(--green-600);
    --blue: #4A9BD9;
    --orange: var(--warn);
    --red: var(--bad);
    --gray: var(--ink-mute);
    --text: var(--ink);
    --text-dim: var(--ink-mute);
    --border: rgba(45,122,79,0.12);
    --radius: 14px;
}
:is(html,body).dark {
    --border: rgba(123,199,154,0.18);
}

/* Legacy fixed-position dropdown lang switcher (used by review.html only) */
#lang-switcher {
    position: fixed;
    top: 16px;
    right: 20px;
    z-index: 100;
}
.lang-dropdown { position: relative; }
.lang-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    background: white;
    border: 1px solid var(--green-200);
    border-radius: 999px;
    color: var(--ink);
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
    font-family: inherit;
}
.lang-btn:hover { background: var(--green-50); }
.lang-arrow { font-size: 0.7rem; opacity: 0.7; }
.lang-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 190px;
    background: white;
    border: 1px solid var(--green-200);
    border-radius: 12px;
    padding: 6px 0;
    box-shadow: var(--shadow);
}
.lang-menu.open { display: block; }
.lang-option {
    display: block;
    width: 100%;
    padding: 11px 18px;
    background: none;
    border: none;
    color: var(--ink);
    font-size: 0.95rem;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
}
.lang-option:hover { background: var(--green-50); }
.lang-option.active { color: var(--green-700); font-weight: 700; }

/* ── MCStats (vanilla Minecraft stats) ──────────────────────────────────── */

.mcstats-meta {
    margin-left: auto;
    font-size: 0.85rem;
    color: var(--ink-mute);
    font-weight: 500;
}

.mcstats-panel {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.mcstats-view-switch {
    display: grid;
    grid-template-columns: repeat(2, minmax(180px, 1fr));
    gap: 4px;
    padding: 4px;
    background: var(--green-50);
    border: 1px solid var(--green-200);
    border-radius: 14px;
    width: 100%;
}
.mcstats-view-btn {
    min-height: 60px;
}
.mcstats-view-btn[data-mcstats-view="stats"].active {
    border-color: rgba(45,122,79,0.28);
}
.mcstats-view-btn[data-mcstats-view="advancements"].active {
    border-color: rgba(146,102,55,0.34);
    color: #6F4A25;
}
.mcstats-selector-icon {
    width: 34px;
    height: 34px;
    padding: 5px;
    border-radius: 8px;
    object-fit: contain;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    background: var(--green-100);
    filter: drop-shadow(0 2px 3px rgba(77, 48, 23, 0.22));
}
.mcstats-subview {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.mcstats-subview[hidden] { display: none !important; }
.mcstats-overview {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.mcstats-profile-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 2px;
}
.mcstats-profile-title {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}
.mcstats-profile-icon {
    width: 48px;
    height: 48px;
    object-fit: contain;
    filter: drop-shadow(0 4px 6px rgba(77, 48, 23, 0.25));
}
.mcstats-profile-title h3 {
    margin: 0;
    font-size: 1.18rem;
    line-height: 1.2;
    color: var(--green-900);
}
.mcstats-profile-title p {
    margin: 2px 0 0;
    color: var(--ink-mute);
    font-size: 0.82rem;
    line-height: 1.35;
}
.mcstats-profile-link {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 6px 12px;
    border: 1px solid var(--green-200);
    border-radius: 999px;
    color: var(--green-700);
    background: var(--green-50);
    font-size: 0.82rem;
    font-weight: 800;
}
.mcstats-profile-link:hover {
    background: var(--green-100);
    border-bottom-color: var(--green-200);
}
.mcstats-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}
.mcstats-summary-card {
    min-height: 74px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    padding: 12px 14px;
    border: 1px solid rgba(45,122,79,0.08);
    border-radius: 8px;
    background: linear-gradient(180deg, var(--green-50), rgba(255,255,255,0.86));
}
.mcstats-summary-card span {
    color: var(--ink-mute);
    font-size: 0.76rem;
    font-weight: 700;
}
.mcstats-summary-card strong {
    color: var(--green-700);
    font-size: 1.22rem;
    line-height: 1.2;
    font-weight: 900;
}
.mcstats-threshold {
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid rgba(217,146,74,0.3);
    background: rgba(217,146,74,0.1);
    color: var(--ink-soft);
    font-size: 0.85rem;
    font-weight: 600;
}
.mcstats-empty-panel {
    min-height: 220px;
    place-items: center;
    align-content: center;
    gap: 14px;
    text-align: center;
    color: var(--ink-soft);
}
.mcstats-empty-icon {
    width: 76px;
    height: 76px;
    object-fit: contain;
    filter: drop-shadow(0 4px 8px rgba(77, 48, 23, 0.22));
}
.mcstats-empty-panel p {
    max-width: 360px;
    margin: 0;
    font-weight: 700;
}

/* Crown / HoF ribbon shown on the player profile when the player has medals */
.mcstats-crown {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    padding: 12px 16px;
    margin: 10px 0 14px;
    background: linear-gradient(90deg, rgba(99,102,241,0.10), rgba(139,92,246,0.08));
    border: 1px solid transparent;
    background-clip: padding-box;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06), 0 0 0 1px rgba(99,102,241,0.20);
    border-radius: 12px;
}
.mcstats-crown.is-top3 {
    background: linear-gradient(100deg,
        rgba(251,191,36,0.18) 0%,
        rgba(251,100,36,0.14) 20%,
        rgba(236,72,153,0.15) 40%,
        rgba(139,92,246,0.17) 60%,
        rgba(59,130,246,0.14) 80%,
        rgba(16,185,129,0.14) 100%
    );
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08), 0 0 0 1px rgba(168,85,247,0.30);
}
.mcstats-crown-btn {
    width: 100%;
    text-align: left;
    cursor: pointer;
    font: inherit;
    color: inherit;
    transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
}
.mcstats-crown-btn:hover {
    background: linear-gradient(90deg, rgba(99,102,241,0.18), rgba(139,92,246,0.15));
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08), 0 0 0 1px rgba(99,102,241,0.38);
    transform: translateY(-1px);
}
.mcstats-crown-btn.is-top3:hover {
    background: linear-gradient(100deg,
        rgba(251,191,36,0.28) 0%,
        rgba(251,100,36,0.22) 20%,
        rgba(236,72,153,0.22) 40%,
        rgba(139,92,246,0.26) 60%,
        rgba(59,130,246,0.22) 80%,
        rgba(16,185,129,0.22) 100%
    );
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.10), 0 0 0 1px rgba(168,85,247,0.45);
    transform: translateY(-1px);
}
.hof-modal-title {
    margin: 0 0 6px;
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--green-900);
}
.mcstats-crown-rank {
    font-weight: 800;
    font-size: 1.1rem;
    color: var(--green-700);
    min-width: 44px;
}
.mcstats-crown-label { color: var(--ink-soft); font-weight: 600; }
.mcstats-crown-medals { display: inline-flex; gap: 10px; }
.mcstats-crown-medals .mcstats-medal {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 9px 2px 4px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.9rem;
    background: var(--bg-soft);
    border: 1px solid var(--green-200);
    color: var(--ink);
}
.mcstats-crown-medals .mcstats-medal-icon { width: 20px; height: 20px; }
.mcstats-crown-score {
    margin-left: auto;
    font-size: 1.6rem;
    font-weight: 900;
    color: var(--green-700);
}
.mcstats-crown.is-top3 .mcstats-crown-score {
    background: linear-gradient(90deg, #a855f7, #ec4899, #f59e0b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Rank pills (used on award cards, hof rows, profile) */
.mcstats-rank {
    display: inline-block;
    min-width: 36px;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--green-100);
    color: var(--green-700);
    font-weight: 700;
    font-size: 0.85rem;
    text-align: center;
}
.mcstats-rank.rank-gold,
.rank-gold { color: #b8860b; background: rgba(251,191,36,0.18); }
.mcstats-rank.rank-silver,
.rank-silver { color: #6b7280; background: rgba(156,163,175,0.18); }
.mcstats-rank.rank-bronze,
.rank-bronze { color: #b45309; background: rgba(180,83,9,0.18); }
.mcstats-rank-na { color: var(--ink-mute); background: transparent; }

/* Top awards strip on the player profile */
.mcstats-awards-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
    margin: 12px 0 18px;
}
.mcstats-award-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg-soft);
    border: 1px solid var(--green-200);
    border-radius: 10px;
    text-decoration: none;
    color: var(--ink);
    transition: transform 120ms ease, border-color 120ms ease;
}
.mcstats-award-card:hover {
    transform: translateY(-1px);
    border-color: var(--green-400);
}
.mcstats-award-title {
    flex: 1;
    font-weight: 700;
    font-size: 0.95rem;
}
.mcstats-award-value {
    font-weight: 800;
    color: var(--green-700);
    font-size: 0.95rem;
}

/* Collapsible sections (advancements + full stats list) on the profile */
.mcstats-section-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--green-100);
    border-radius: 8px;
    background: var(--green-50);
    margin-top: 2px;
}
.mcstats-section-head h4 {
    margin: 0;
    font-size: 1rem;
    color: var(--ink);
}
.mcstats-section-summary { color: var(--ink-mute); font-size: 0.9rem; }
.mcstats-section-toggle {
    margin-left: auto;
    background: none;
    border: 1px solid var(--green-200);
    border-radius: 8px;
    padding: 5px 12px;
    color: var(--green-700);
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.85rem;
}
.mcstats-section-toggle:hover { background: var(--green-50); }
.adv-filter-btn {
    margin-left: auto;
    background: none;
    border: 1px solid var(--green-200);
    border-radius: 8px;
    padding: 5px 12px;
    color: var(--green-700);
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.85rem;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.adv-filter-btn:hover { background: var(--green-50); border-color: var(--green-400); }
.adv-filter-btn.is-active {
    background: var(--green-700);
    border-color: var(--green-700);
    color: #fff;
}
.adv-filter-btn.is-active:hover { background: var(--green-800); border-color: var(--green-800); }

/* Advancement table on the profile */
.mcstats-adv-table { display: grid; gap: 4px; padding: 6px 0 14px; }
.mcstats-adv-table.is-filtered .is-done { display: none; }
.mcstats-adv-row {
    display: grid;
    grid-template-columns: 50px 1fr 2fr 1fr;
    align-items: center;
    gap: 12px;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 0.9rem;
}
.mcstats-adv-row.is-done { background: rgba(63,149,96,0.07); }
.mcstats-adv-row.is-pending { color: var(--ink-mute); }
.mcstats-adv-rank { color: var(--ink-mute); font-weight: 600; }
.mcstats-adv-title {
    font-weight: 700;
    color: var(--ink);
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.mcstats-adv-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.mcstats-adv-row.is-pending .mcstats-adv-title { color: var(--ink-soft); }
.mcstats-adv-desc { color: var(--ink-soft); font-size: 0.85rem; }
.mcstats-adv-status { color: var(--green-700); font-size: 0.8rem; text-align: right; }

/* Advancement icon: same pixel-art treatment as award icons, but framed by the
   advancement type (task/goal/challenge) the way the original MinecraftStats
   project did. Pending rows are dimmed; completed rows show full color. */
.mcstats-adv-icon {
    width: 22px;
    height: 22px;
    padding: 2px;
    border-radius: 4px;
    background: rgba(255,255,255,0.05);
    box-sizing: content-box;
    border: 1.5px solid var(--adv-frame, #B79754);
}
.mcstats-adv-row.frame-task    { --adv-frame: #C9A227; }   /* gold - basic */
.mcstats-adv-row.frame-goal    { --adv-frame: #4FC3A1; }   /* mint - progression */
.mcstats-adv-row.frame-challenge { --adv-frame: #B47AD0; } /* purple - challenge */
.mcstats-adv-row.is-done.frame-task .mcstats-adv-name    { color: #C9A227; }
.mcstats-adv-row.is-done.frame-goal .mcstats-adv-name    { color: #2D7A4F; }
.mcstats-adv-row.is-done.frame-challenge .mcstats-adv-name { color: #8E4FB0; }
.mcstats-adv-row.is-pending .mcstats-adv-icon {
    opacity: 0.5;
    filter: grayscale(0.4);
}

/* Full stat table on the profile */
.mcstats-stat-table { display: flex; flex-direction: column; gap: 2px; padding: 6px 0 4px; }
.mcstats-stat-row {
    display: grid;
    grid-template-columns: 50px 1fr 2fr 1fr;
    align-items: center;
    gap: 12px;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--ink);
    text-decoration: none;
}
.mcstats-stat-row:hover { background: var(--green-50); }
.mcstats-stat-title {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.mcstats-stat-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.mcstats-stat-desc {
    color: var(--ink-soft);
    font-size: 0.85rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.mcstats-stat-value { text-align: right; font-weight: 700; color: var(--green-700); }

/* Awards list - wider last column to fit avatar + name + value */
.mcstats-awards-stat-table .mcstats-stat-row {
    grid-template-columns: 50px 1fr 2fr minmax(130px, 1.5fr);
}
.mcstats-award-holder-cell {
    display: flex;
    align-items: center;
    gap: 7px;
    justify-content: flex-end;
    min-width: 0;
}
.mcstats-award-holder-cell img {
    width: 26px;
    height: 26px;
    border-radius: 3px;
    image-rendering: pixelated;
    flex-shrink: 0;
}
.mcstats-award-holder-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    font-weight: 600;
}
.mcstats-award-holder-value {
    font-weight: 700;
    color: var(--green-700);
    flex-shrink: 0;
    white-space: nowrap;
}
.mcstats-award-holder-empty { color: var(--ink-mute); font-style: italic; }

/* Minecraft block/item textures used as award icons.
   Crisp pixel art at small sizes; never anti-aliased. */
.mcstats-icon {
    width: 20px;
    height: 20px;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    flex-shrink: 0;
    filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.25));
    vertical-align: middle;
}
.mcstats-icon-lg { width: 28px; height: 28px; }

/* Awards grid page - one card per award with current #1 */
.mcstats-tabs {
    display: flex;
    gap: 10px;
    margin: 14px 0 18px;
    border-bottom: 1px solid var(--green-100);
    padding-bottom: 8px;
}
.mcstats-tab {
    padding: 7px 14px;
    color: var(--ink-soft);
    border-radius: 999px;
    background: var(--bg-soft);
    border: 1px solid var(--green-200);
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
}
.mcstats-tab:hover { color: var(--green-700); }

.mcstats-awards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
    margin-top: 10px;
}
.mcstats-award-card-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 14px 16px;
    background: var(--bg-soft);
    border: 1px solid var(--green-200);
    border-radius: 12px;
    color: var(--ink);
    text-decoration: none;
    transition: transform 120ms ease, border-color 120ms ease;
}
.mcstats-award-card-grid:hover {
    transform: translateY(-2px);
    border-color: var(--green-400);
}
.mcstats-award-card-title {
    font-weight: 800;
    font-size: 1.05rem;
    color: var(--green-900);
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.mcstats-award-card-title > span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.mcstats-award-card-desc { color: var(--ink-soft); font-size: 0.85rem; }
.mcstats-award-card-holder {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    padding-top: 8px;
    border-top: 1px solid var(--green-100);
    font-size: 0.9rem;
}
.mcstats-award-card-holder.mcstats-award-card-empty { color: var(--ink-mute); font-style: italic; }
.mcstats-award-avatar {
    width: 28px; height: 28px;
    border-radius: 6px;
    image-rendering: pixelated;
    flex-shrink: 0;
}
.mcstats-award-name {
    font-weight: 700;
    color: var(--green-700);
    text-decoration: none;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.mcstats-award-card-value {
    font-weight: 800;
    color: var(--green-700);
}

/* Award detail modal - replaces /award/<id> for in-page navigation.
   Standalone /award/<id> page reuses .mcstats-award-head + leaderboard styles. */
.award-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 30, 22, 0.62);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 56px 24px 32px;
    overflow-y: auto;
    z-index: 1000;
}
.award-modal-panel {
    position: relative;
    width: 100%;
    max-width: 720px;
    background: var(--bg-card);
    border: 1px solid var(--green-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 22px 24px 18px;
    animation: award-modal-in 140ms ease-out;
}
@keyframes award-modal-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.award-modal-close {
    position: absolute;
    top: 10px;
    right: 12px;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--ink-soft);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    border-radius: 999px;
    display: grid;
    place-items: center;
}
.award-modal-close:hover { background: var(--green-50); color: var(--ink); }
.award-modal-loading,
.award-modal-empty {
    padding: 28px 8px;
    text-align: center;
    color: var(--ink-soft);
}
.award-modal-content .mcstats-award-head { margin: 4px 0 14px; }
.award-modal-content .mcstats-leaderboard { max-height: 60vh; overflow-y: auto; }

/* Single award leaderboard page */
.mcstats-award-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 12px 14px 14px;
    border-left: 4px solid var(--green-500);
    margin: 14px 0 16px;
}
.mcstats-award-head h3 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--green-700);
    line-height: 1.3;
}
.mcstats-award-desc {
    margin: 0;
    color: var(--ink);
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.45;
    text-align: right;
    flex-shrink: 0;
}
.mcstats-leaderboard { margin-top: 8px; }
.mcstats-leaderboard-row {
    display: grid;
    grid-template-columns: 80px 1fr 200px;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
}
.mcstats-leaderboard-body { display: flex; flex-direction: column; gap: 2px; padding-top: 4px; }
.mcstats-leaderboard-row {
    border-radius: 8px;
    color: var(--ink);
    text-decoration: none;
    font-size: 0.95rem;
}
.mcstats-leaderboard-row:hover { background: var(--green-50); }
.mcstats-leaderboard-player {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    color: var(--green-900);
}
.mcstats-leaderboard-player img {
    width: 32px; height: 32px;
    border-radius: 6px;
    image-rendering: pixelated;
}
.mcstats-leaderboard-value {
    text-align: right;
    font-weight: 800;
    color: var(--green-700);
}

/* Hall of Fame */
.mcstats-hof-description { color: var(--ink-soft); font-size: 0.9rem; margin: 4px 0 12px; }
.mcstats-hof-table { margin-top: 8px; }
.mcstats-hof-head,
.mcstats-hof-row {
    display: grid;
    grid-template-columns: 80px 1fr 70px 70px 70px 90px;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
}
.mcstats-hof-head {
    color: var(--ink-mute);
    font-weight: 700;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--green-100);
}
.mcstats-hof-body { display: flex; flex-direction: column; gap: 2px; padding-top: 4px; }
.mcstats-hof-row {
    border-radius: 8px;
    color: var(--ink);
    text-decoration: none;
}
.mcstats-hof-row:hover { background: var(--green-50); }
.mcstats-hof-row.is-top3 {
    background: linear-gradient(100deg,
        rgba(251,191,36,0.10) 0%,
        rgba(236,72,153,0.08) 40%,
        rgba(139,92,246,0.10) 70%,
        rgba(59,130,246,0.08) 100%
    );
    box-shadow: inset 0 0 0 1px rgba(168,85,247,0.18);
}
.mcstats-hof-row.is-top3:hover {
    background: linear-gradient(100deg,
        rgba(251,191,36,0.18) 0%,
        rgba(236,72,153,0.15) 40%,
        rgba(139,92,246,0.18) 70%,
        rgba(59,130,246,0.14) 100%
    );
    box-shadow: inset 0 0 0 1px rgba(168,85,247,0.32);
}
.mcstats-hof-player {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    color: var(--green-900);
}
.mcstats-hof-player img {
    width: 32px; height: 32px;
    border-radius: 6px;
    image-rendering: pixelated;
}
.mcstats-hof-gold,
.mcstats-hof-silver,
.mcstats-hof-bronze {
    text-align: center;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 6px;
    font-size: 0.95rem;
}
.mcstats-hof-score {
    text-align: right;
    font-weight: 900;
    font-size: 1.05rem;
    color: var(--green-700);
}

/* Medal & crown icons from the original MinecraftStats project (fatcow set).
   Used in the HOF column headers (medal_award_*) and rank column (crown_*). */
.mcstats-medal-icon,
.mcstats-crown-icon {
    width: 22px;
    height: 22px;
    vertical-align: middle;
    flex-shrink: 0;
}
.mcstats-hof-medal-col { text-align: center; }
.mcstats-rank-crown {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* Mobile tweaks */
@media (max-width: 720px) {
    .mcstats-adv-row { grid-template-columns: 36px 1fr; }
    .mcstats-adv-desc, .mcstats-adv-status { display: none; }
    .mcstats-stat-row { grid-template-columns: 48px 1fr 100px; }
    .mcstats-awards-stat-table .mcstats-stat-row { grid-template-columns: 48px 1fr minmax(110px, 1.5fr); }
    .mcstats-stat-desc { display: none; }
    .mcstats-leaderboard-row { grid-template-columns: 60px 1fr 100px; }
    .mcstats-award-head {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    .mcstats-award-desc { text-align: left; }
    .mcstats-hof-head,
    .mcstats-hof-row { grid-template-columns: 50px 1fr 60px; }
    .mcstats-hof-gold, .mcstats-hof-silver, .mcstats-hof-bronze,
    .mcstats-hof-medal-col { display: none; }
}

@media (max-width: 860px) {
    .mcstats-profile-head {
        align-items: flex-start;
        flex-direction: column;
    }
    .mcstats-profile-link {
        width: 100%;
    }
    .mcstats-summary-grid { grid-template-columns: 1fr; }
    .docs-layout {
        flex-direction: column;
    }
    .docs-sidebar {
        flex: none;
        width: 100%;
        position: static;
        max-height: none;
    }
}

/* === Docs page === */

.page-docs {
    max-width: none;
    width: 100%;
}

.docs-layout {
    display: flex;
    gap: 32px;
    align-items: flex-start;
    min-height: 60vh;
}

.docs-sidebar {
    flex: 0 0 240px;
    position: sticky;
    top: 36px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    scrollbar-width: thin;
}
.docs-sidebar::-webkit-scrollbar { width: 4px; }
.docs-sidebar::-webkit-scrollbar-thumb {
    background: var(--green-200);
    border-radius: 4px;
}

.docs-sidebar-loading,
.docs-sidebar-error {
    padding: 20px;
    color: var(--ink-mute);
    font-size: 13px;
    text-align: center;
}

.docs-section { border-radius: var(--radius); overflow: hidden; }
.docs-section + .docs-section { margin-top: 4px; }

.docs-section-head {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 14px;
    background: var(--bg-card);
    border: 1px solid rgba(45,122,79,0.06);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    color: var(--green-700);
    cursor: pointer;
    transition: background .12s;
    text-align: left;
}
.docs-section-head:hover { background: var(--green-50); }
.docs-section-head .ic {
    display: inline-flex;
    transition: transform .2s;
    color: var(--ink-mute);
}
.docs-section.open .docs-section-head { border-radius: var(--radius) var(--radius) 0 0; }
.docs-section.open .docs-section-head .ic { transform: rotate(180deg); }

.docs-section-body {
    display: none;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid rgba(45,122,79,0.06);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    padding: 4px 0;
}
.docs-section.open .docs-section-body { display: flex; }

.docs-page-link {
    display: block;
    padding: 8px 14px 8px 20px;
    font-size: 13px;
    color: var(--ink-soft);
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: all .12s;
    font-weight: 500;
}
.docs-page-link:hover {
    color: var(--green-700);
    background: var(--green-50);
    border-bottom-color: transparent;
}
.docs-page-link.active {
    color: var(--green-700);
    font-weight: 700;
    border-left-color: var(--green-600);
    background: var(--green-50);
}

.docs-content {
    flex: 1;
    min-width: 0;
    min-height: 300px;
}

.docs-content-loading,
.docs-content-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 60px 20px;
    color: var(--ink-mute);
    text-align: center;
}
.docs-content-loading svg { color: var(--green-300); }

/* Markdown content */

.docs-md {
    line-height: 1.85;
    color: var(--ink);
    font-size: 15px;
}
.docs-md h1,
.docs-md h2,
.docs-md h3,
.docs-md h4 {
    color: var(--green-900);
    font-weight: 700;
    margin: 28px 0 12px;
    line-height: 1.3;
}
.docs-md h1 { font-size: 28px; border-bottom: 1px solid var(--green-200); padding-bottom: 8px; }
.docs-md h2 { font-size: 22px; }
.docs-md h3 { font-size: 18px; }
.docs-md h4 { font-size: 16px; }
.docs-md h1:first-child { margin-top: 0; }

.docs-md p { margin: 0 0 14px; }
.docs-md p:last-child { margin-bottom: 0; }

.docs-md a { color: var(--link); text-decoration: underline; }
.docs-md a:hover { color: var(--green-900); }

.docs-md ul,
.docs-md ol { margin: 0 0 14px; padding-left: 24px; }
.docs-md li { margin-bottom: 4px; }
.docs-md li:last-child { margin-bottom: 0; }

.docs-md strong { font-weight: 700; color: var(--green-900); }

.docs-md code {
    background: var(--green-50);
    padding: 2px 7px;
    border-radius: 5px;
    font-family: 'Kosugi Maru', 'SF Mono', monospace;
    font-size: 0.85em;
    color: var(--green-700);
    word-break: break-word;
}
.docs-md pre {
    background: var(--bg-card);
    border: 1px solid rgba(45,122,79,0.08);
    border-radius: var(--radius);
    padding: 16px 20px;
    overflow-x: auto;
    margin: 0 0 14px;
    line-height: 1.6;
}
.docs-md pre code {
    background: none;
    padding: 0;
    border-radius: 0;
    font-size: 0.85em;
    color: var(--ink);
    white-space: pre;
}

.docs-md blockquote {
    margin: 0 0 14px;
    padding: 12px 18px;
    border-left: 4px solid var(--green-500);
    background: var(--green-50);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--ink-soft);
}
.docs-md blockquote p:last-child { margin-bottom: 0; }

.docs-md table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 0 14px;
    font-size: 14px;
}
.docs-md th,
.docs-md td {
    padding: 8px 14px;
    text-align: left;
    border: 1px solid var(--green-200);
}
.docs-md th {
    background: var(--green-50);
    font-weight: 700;
    color: var(--green-900);
}
.docs-md tr:nth-child(even) td { background: var(--bg-soft); }

.docs-md img {
    max-width: 100%;
    border-radius: var(--radius);
    margin: 8px 0;
}

.docs-md hr {
    border: none;
    height: 1px;
    background: var(--green-200);
    margin: 24px 0;
}

/* Dark mode overrides for docs */

:is(html,body).dark .docs-section-head { background: var(--bg-card); border-color: rgba(123,199,154,0.12); }
:is(html,body).dark .docs-section-body { background: var(--bg-card); border-color: rgba(123,199,154,0.12); }
:is(html,body).dark .docs-page-link:hover { background: var(--bg-soft); }
:is(html,body).dark .docs-page-link.active { background: var(--bg-soft); }
:is(html,body).dark .docs-md code { background: var(--green-100); }
:is(html,body).dark .docs-md pre {
    background: var(--bg-card);
    border-color: rgba(123,199,154,0.12);
}
:is(html,body).dark .docs-md pre code { color: var(--ink); }
:is(html,body).dark .docs-md blockquote { background: var(--bg-soft); }
:is(html,body).dark .docs-md th { background: var(--green-100); }
:is(html,body).dark .docs-md tr:nth-child(even) td { background: var(--bg-soft); }
:is(html,body).dark .docs-md h1 { border-bottom-color: var(--green-200); }

/* ============================================================================
   "What you can do here" bento — append this block to css/style.css
   Uses existing tokens: --green-50, --green-100, --green-200, --green-700,
   --green-900, --ink-soft, --bg-card, --shadow.
   ============================================================================ */

/* === Bento (home "what you can do here") === */

.bento {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.bento-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  text-align: left;
  background: var(--bg-card);
  border-radius: 18px;
  border: 1px solid rgba(45,122,79,0.08);
  padding: 0;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
  overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
  min-height: 240px;
}
.bento-tile:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: var(--green-200);
}
.bento-tile:focus-visible {
  outline: 2px solid var(--green-500);
  outline-offset: 2px;
}

.bt-hero {
  position: relative;
  height: 130px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.bt-body {
  padding: 14px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}
.bt-tag {
  align-self: flex-start;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--green-700);
  background: var(--green-100);
  padding: 3px 9px;
  border-radius: 999px;
  margin-bottom: 2px;
  white-space: nowrap;
}
.bt-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 2px;
}
.bt-chips span {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--green-700);
  background: var(--green-100);
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
  line-height: 1.3;
}
.bt-title {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  color: var(--green-900);
  letter-spacing: -0.005em;
}
.bt-desc {
  margin: 0;
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.55;
}
.bt-cta {
  margin-top: 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--green-700);
  letter-spacing: 0.01em;
  align-self: flex-start;
  transition: gap .15s ease, color .15s ease;
}
.bento-tile:hover .bt-cta {
  color: var(--green-600);
}

/* --- Tile 1: Flashcards --- */
.bt-flash .bt-hero {
  background:
    radial-gradient(circle at 30% 30%, rgba(123,199,154,0.35), transparent 55%),
    linear-gradient(135deg, var(--green-100), var(--green-50));
}
.bt-kanji-badge {
  width: 84px; height: 84px;
  border-radius: 18px;
  background: white;
  border: 1px solid var(--green-200);
  display: grid;
  place-items: center;
  font-family: 'Zen Maru Gothic', serif;
  font-weight: 900;
  font-size: 52px;
  line-height: 1;
  color: var(--green-700);
  box-shadow: 0 6px 18px rgba(45,122,79,0.15);
  transition: transform .25s ease;
}
.bt-flash:hover .bt-kanji-badge { transform: rotate(-4deg) scale(1.04); }

/* --- Tile 2: Duels --- */
.bt-duel .bt-hero {
  background:
    radial-gradient(circle at 50% 50%, rgba(217,144,112,0.18), transparent 60%),
    linear-gradient(135deg, #1F3A2A, #294636);
  color: white;
}
.bt-vs {
  display: flex;
  align-items: center;
  gap: 14px;
}
.bt-vs-side {
  width: 56px; height: 56px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 16px;
  color: white;
  image-rendering: pixelated;
  position: relative;
  transition: transform .25s ease;
}
.bt-vs-left {
  background: linear-gradient(135deg, #7BC79A, #3F9560);
  transform: rotate(-6deg);
}
.bt-vs-right {
  background: linear-gradient(135deg, #E89070, #C45A4A);
  transform: rotate(6deg);
}
.bt-duel:hover .bt-vs-left  { transform: rotate(-10deg) translateY(-2px); }
.bt-duel:hover .bt-vs-right { transform: rotate(10deg)  translateY(-2px); }
.bt-vs-mark {
  font-family: 'Zen Maru Gothic', sans-serif;
  font-weight: 900;
  font-size: 28px;
  letter-spacing: -0.02em;
  background: linear-gradient(180deg, #FFE066, #D9924A);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 2px 0 rgba(0,0,0,0.15);
  filter: drop-shadow(0 2px 6px rgba(217,144,112,0.5));
}

.bt-duel .bt-photo { object-position: center 30%; }

/* --- Photo tiles (Flashcards, Duels, Build) --- */
.bt-hero-photo {
  background: #1F3A2A;
  position: relative;
  overflow: hidden;
}
.bt-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .4s ease;
}
.bento-tile:hover .bt-photo { transform: scale(1.06); }
.bt-hero-photo::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(15,26,20,0.4));
  pointer-events: none;
}

/* --- Tile 3: Coins --- */
.bt-hero-coins {
  background:
    radial-gradient(circle at 50% 60%, rgba(255,224,102,0.35), transparent 60%),
    linear-gradient(135deg, #FFF6DD, #FFE9B0);
  position: relative;
}
.bt-coin {
  position: absolute;
  image-rendering: pixelated;
  filter: drop-shadow(0 4px 6px rgba(180,120,40,0.25));
  transition: transform .3s ease;
}
.bt-coin-front {
  width: 70px; height: 70px;
  z-index: 3;
}
.bt-coin-back {
  width: 50px; height: 50px;
  z-index: 1;
  opacity: 0.85;
}
.bt-coin-back.c1 { transform: translate(-44px, 14px) rotate(-12deg); }
.bt-coin-back.c2 { transform: translate( 44px, 14px) rotate(12deg);  }
.bt-coins:hover .bt-coin-front { transform: translateY(-3px) rotate(8deg); }
.bt-coins:hover .bt-coin-back.c1 { transform: translate(-52px, 10px) rotate(-20deg); }
.bt-coins:hover .bt-coin-back.c2 { transform: translate( 52px, 10px) rotate(20deg); }

/* --- Tile 4: Build (Minecraft-style map screenshot) --- */
.bt-hero-map {
  height: 130px;
  background: #1F3A2A;
  position: relative;
  overflow: hidden;
}
.bt-map {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .35s ease, filter .35s ease;
  filter: saturate(1.05);
}
.bt-build:hover .bt-map { transform: scale(1.08); }
.bt-hero-map::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 50%, rgba(15,26,20,0.35));
  pointer-events: none;
}/* Dark mode */
:is(html,body).dark .bento-tile,
body.dark .bento-tile {
  background: var(--bg-card);
  border-color: rgba(123,199,154,0.15);
}
:is(html,body).dark .bt-flash .bt-hero,
body.dark .bt-flash .bt-hero {
  background:
    radial-gradient(circle at 30% 30%, rgba(123,199,154,0.2), transparent 55%),
    linear-gradient(135deg, var(--green-100), var(--bg-card));
}
:is(html,body).dark .bt-kanji-badge,
body.dark .bt-kanji-badge {
  background: var(--bg-card);
  border-color: var(--green-200);
  color: var(--green-700);
}
:is(html,body).dark .bt-hero-coins,
body.dark .bt-hero-coins {
  background:
    radial-gradient(circle at 50% 60%, rgba(255,200,80,0.18), transparent 60%),
    linear-gradient(135deg, #2A2618, #1F1F1A);
}

/* Mobile: stack single column */
@media (max-width: 720px) {
  .bento { grid-template-columns: 1fr; }
  .bento-tile { min-height: 220px; }
  .bt-hero { height: 110px; }
  .bt-title { font-size: 16px; }
}
