body {
    background: #160f0c;
}

:root {
    --bg: #160f0c;
    --surface: #241916;
    --surface-2: #33231d;
    --text: #f6ead8;
    --muted: #cbb69b;
    --line: #5d4435;
    --accent: #e9bd6b;
    --accent-2: #85b894;
    --danger: #e57c65;
    --radius: 10px;
    --radius-sm: 8px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    color: var(--text);
    font-family: "Segoe UI", Tahoma, sans-serif;
    line-height: 1.65;
    overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }

main {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
}

.site-header, .site-footer {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 18px 0;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    letter-spacing: .01em;
    color: var(--accent);
}

.brand span, .table-symbol { font-size: 1.5rem; }

nav {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    color: var(--muted);
}

nav a {
    position: relative;
    padding: 8px 10px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: .94rem;
    transition: color .2s ease, background .2s ease, border-color .2s ease, transform .2s ease, box-shadow .2s ease;
}

nav a::after {
    content: "";
    position: absolute;
    right: 10px;
    bottom: 4px;
    left: 10px;
    height: 2px;
    border-radius: 999px;
    transform: scaleX(0);
    background: var(--accent);
    box-shadow: 0 0 12px rgba(233, 189, 107, .65);
    transition: transform .22s ease;
}

nav a:hover, nav a:focus-visible {
    background: linear-gradient(135deg, rgba(233, 189, 107, .16), rgba(233, 189, 107, .04));
    border-color: rgba(233, 189, 107, .25);
    color: var(--text);
    box-shadow: 0 8px 18px rgba(0, 0, 0, .16);
    transform: translateY(-1px);
}
nav a:hover::after, nav a.active::after { transform: scaleX(1); }
nav a.active { background: rgba(233, 189, 107, .08); color: var(--text); font-weight: 700; }

.header-actions, .language-switch {
    display: flex;
    align-items: center;
    gap: 14px;
}

.language-switch {
    gap: 0;
    padding: 3px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: rgba(22, 15, 12, .72);
    color: var(--muted);
    white-space: nowrap;
    font-size: .78rem;
}

.language-switch a {
    min-width: 38px;
    border-radius: 6px;
    color: var(--muted);
    padding: 5px 9px;
    text-align: center;
    transition: background .18s ease, color .18s ease;
}

.language-switch a:hover { color: var(--text); }
.language-switch a.active {
    background: var(--accent);
    color: #241309;
    font-weight: 800;
}

.site-footer {
    border-top: 1px solid var(--line);
    margin-top: 72px;
    color: var(--muted);
    font-size: .9rem;
    padding-bottom: 28px;
}

.site-footer strong { color: var(--accent); letter-spacing: .02em; }
.site-footer p { max-width: 680px; margin: 0; text-align: right; }

.hero, .daily-card, .detail, .admin-panel, .quiz-panel {
    background: linear-gradient(135deg, rgba(51, 35, 29, .96), rgba(24, 16, 13, .96));
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 24px 80px rgba(0,0,0,.28);
}

.hero {
    min-height: 500px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
    align-items: center;
    gap: clamp(32px, 5vw, 68px);
    padding: clamp(32px, 5vw, 64px);
    position: relative;
    overflow: hidden;
}

.hero-copy { position: relative; z-index: 1; max-width: 680px; }

.hero:before {
    content: "";
    position: absolute;
    inset: auto -80px -120px 30%;
    height: 240px;
    background: radial-gradient(circle, rgba(133,184,148,.2), transparent 65%);
    pointer-events: none;
}

h1, h2, h3, p { margin-top: 0; }

.eyebrow {
    margin-bottom: 8px;
    color: var(--accent);
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

h1 {
    font-size: clamp(2.25rem, 5vw, 4.5rem);
    line-height: 1.06;
    max-width: 760px;
}

.hero p, .lead {
    color: var(--muted);
    font-size: 1.12rem;
}

.hero-copy > p:not(.eyebrow):not(.hero-subtitle) { max-width: 610px; margin-bottom: 28px; }

.hero-subtitle {
    max-width: 720px;
    color: var(--text) !important;
    font-size: 1.35rem !important;
    font-weight: 700;
}

.actions, .row-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.hero .actions { gap: 18px; }

.button, button {
    position: relative;
    isolation: isolate;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #2a1d18;
    color: var(--text);
    min-height: 44px;
    padding: 10px 16px;
    font: inherit;
    cursor: pointer;
}

.button, button, .hero-text-link { transition: transform .18s ease, background .18s ease, border-color .18s ease, box-shadow .18s ease, color .18s ease; }
.button::before, button::before {
    content: "";
    position: absolute;
    z-index: -1;
    inset: -1px;
    border-radius: inherit;
    opacity: 0;
    background: radial-gradient(circle at 50% 0, rgba(255, 240, 199, .32), transparent 58%);
    transition: opacity .2s ease;
}
.button:hover, button:hover { transform: translateY(-2px); border-color: rgba(233, 189, 107, .82); box-shadow: 0 10px 24px rgba(0, 0, 0, .22); }
.button:hover::before, button:hover::before { opacity: 1; }
.button.primary, button.primary { box-shadow: 0 5px 0 #b4863f, 0 10px 22px rgba(0, 0, 0, .2); }
.button.primary:hover, button.primary:hover { background: #f2c978; box-shadow: 0 4px 0 #b4863f, 0 14px 30px rgba(233, 189, 107, .3); }
.button.primary:active, button.primary:active { transform: translateY(2px); box-shadow: 0 2px 0 #b4863f, 0 5px 12px rgba(0, 0, 0, .24); }
.hero-text-link { color: var(--muted); font-weight: 700; padding: 10px 0; }
.hero-text-link:hover { color: var(--accent); text-shadow: 0 0 14px rgba(233, 189, 107, .28); transform: translateX(3px); }

.button.primary, button.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #241309;
    font-weight: 800;
}

.button.ghost { background: transparent; }

.hero-stone, .rune-stone {
    display: grid;
    place-items: center;
    aspect-ratio: 1;
    background:
        linear-gradient(145deg, rgba(255,255,255,.08), transparent 40%),
        #3a2a22;
    border: 1px solid #6b5142;
    border-radius: var(--radius);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.04), 0 16px 40px rgba(0,0,0,.24);
}

.hero-stone {
    width: min(100%, 320px);
    justify-self: end;
    font-size: clamp(9rem, 15vw, 12rem);
    color: var(--accent);
    transform: rotate(-5deg);
}

.rune-stone {
    width: 96px;
    color: var(--accent);
    font-size: 4rem;
    flex: 0 0 auto;
}

.rune-stone.large {
    width: min(320px, 100%);
    font-size: 12rem;
}

.rune-stone img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius);
}

.section, .page-head, .daily { padding: 52px 0 16px; }

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.section-heading a { color: var(--accent); font-weight: 700; }
.section-heading a:hover { text-decoration: underline; text-underline-offset: 4px; }

.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 18px;
}

.content-card {
    min-height: 100%;
    display: grid;
    gap: 10px;
    align-content: start;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background:
        linear-gradient(150deg, rgba(88, 49, 86, .24), rgba(36, 25, 22, .9) 42%),
        var(--surface);
    padding: 18px;
    transition: transform .18s ease, border-color .18s ease, background .18s ease;
}

.content-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
    background:
        linear-gradient(150deg, rgba(88, 49, 86, .34), rgba(36, 25, 22, .94) 42%),
        var(--surface);
}

.content-card h3 {
    margin-bottom: 0;
    color: var(--text);
    font-size: 1.08rem;
}

.content-card p {
    margin-bottom: 0;
    color: var(--muted);
    font-size: .96rem;
}

.card-rune {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border: 1px solid #6b5142;
    border-radius: var(--radius);
    background: rgba(233, 189, 107, .08);
    color: var(--accent);
    font-size: 1.8rem;
}

.article-label {
    width: max-content;
    border: 1px solid rgba(133, 184, 148, .45);
    border-radius: 999px;
    color: var(--accent-2);
    padding: 2px 9px;
    font-size: .78rem;
}

.ad-unit {
    margin: 42px 0 6px;
    min-height: 112px;
    display: grid;
    align-items: center;
    gap: 4px;
    border: 1px dashed rgba(233, 189, 107, .56);
    border-radius: var(--radius);
    background:
        linear-gradient(135deg, rgba(233, 189, 107, .08), rgba(88, 49, 86, .12)),
        rgba(36, 25, 22, .72);
    color: var(--muted);
    text-align: center;
    overflow: hidden;
}

.ad-unit .adsbygoogle {
    width: 100%;
    min-height: 90px;
}

.ad-wide {
    width: 100%;
}

.ad-after-featured { margin-top: 34px; }

.ad-between-content {
    margin: 28px 0;
}

.ad-after-section {
    margin-top: 34px;
}

.ad-sidebar {
    margin: 18px 0 0;
    min-height: 280px;
}

.ad-sidebar .adsbygoogle {
    min-height: 250px;
}

.ad-multiplex {
    min-height: 260px;
}

.ad-multiplex .adsbygoogle {
    min-height: 230px;
}

.intro-band {
    display: grid;
    grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
    gap: 22px 36px;
    align-items: center;
    margin-top: 18px;
    padding-block: 44px;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.intro-band p {
    color: var(--muted);
}

.intro-band .actions {
    grid-column: 2;
}

.faq-list {
    display: grid;
    gap: 12px;
}

.faq-item {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(36, 25, 22, .86);
    padding: 0;
}

.faq-item summary {
    cursor: pointer;
    color: var(--text);
    font-weight: 800;
    padding: 16px 18px;
}

.faq-item p {
    margin: 0;
    border-top: 1px solid var(--line);
    color: var(--muted);
    padding: 14px 18px 18px;
}

.content-page {
    border-bottom: 1px solid var(--line);
}

.content-body {
    max-width: 820px;
}

.rune-grid, .mode-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 16px;
}

.rune-card, .mode-card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(36, 25, 22, .86);
}

.rune-card a {
    height: 100%;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 18px;
    transition: background .2s ease, transform .2s ease;
}

.rune-card { min-height: 148px; overflow: hidden; transition: border-color .2s ease, box-shadow .2s ease; }
.rune-card:hover, .rune-card:focus-within { border-color: rgba(233, 189, 107, .8); box-shadow: 0 14px 30px rgba(0, 0, 0, .2); }
.rune-card:hover a { transform: translateY(-2px); background: rgba(233, 189, 107, .035); }
.rune-card h3 { font-size: 1.1rem; line-height: 1.25; }
.rune-card p:last-child { margin-bottom: 0; color: var(--muted); font-size: .94rem; }

.rune-card h3, .daily h2, .detail h1 { margin-bottom: 0; }

.thai-name, .meta, .notice { color: var(--muted); }

.filter-bar {
    display: grid;
    grid-template-columns: 1fr 220px auto;
    gap: 12px;
    margin-bottom: 24px;
}

input, select, textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #1d1411;
    color: var(--text);
    padding: 11px 12px;
    font: inherit;
}

textarea { min-height: 110px; resize: vertical; }

.detail {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 40px;
    padding: 32px;
    margin-top: 36px;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
}

.detail-symbol {
    display: grid;
    gap: 12px;
    align-content: start;
    min-width: 0;
}

.quiz-cta {
    display: grid;
    gap: 2px;
    margin-top: 8px;
    border-color: rgba(233, 189, 107, .68);
    background: linear-gradient(135deg, rgba(233, 189, 107, .18), rgba(88, 49, 86, .18));
    padding: 16px;
}

.quiz-cta span {
    color: var(--accent);
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .09em;
    text-transform: uppercase;
}

.quiz-cta strong { color: var(--text); font-size: 1.12rem; }
.quiz-cta small { color: var(--muted); }
.quiz-cta:hover { border-color: var(--accent); background: rgba(233, 189, 107, .16); }

.detail-copy { min-width: 0; }

.reading-badge {
    display: inline-flex;
    width: fit-content;
    max-width: 100%;
    margin-bottom: 14px;
    border: 1px solid rgba(233, 189, 107, .45);
    border-radius: 999px;
    background: rgba(233, 189, 107, .12);
    color: var(--accent);
    padding: 6px 12px;
    font-size: .9rem;
    font-weight: 800;
}

.detail h1 span, .daily h2 span { color: var(--muted); font-size: .65em; }

.keyword-box, .advice {
    border-left: 4px solid var(--accent);
    background: rgba(233, 189, 107, .08);
    padding: 14px 16px;
    margin: 18px 0;
}

.meaning-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
    gap: 14px;
}

.meaning-list section, .daily-sections section, .stats div {
    background: rgba(255,255,255,.04);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px;
    max-width: 100%;
    min-width: 0;
    overflow-wrap: anywhere;
}

.reading-sections {
    grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
}

.reading-general, .reading-sample {
    grid-column: 1 / -1;
}

.reading-card h2, .daily-sections h3 {
    color: var(--accent);
    font-size: 1.02rem;
}

blockquote {
    margin: 24px 0 0;
    padding: 18px;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    color: var(--muted);
}

.daily-card {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 32px;
    padding: 32px;
}

.daily-sections {
    display: grid;
    gap: 14px;
    margin: 18px 0;
}

.daily-highlight {
    border-color: var(--accent);
    background: rgba(233, 189, 107, .08);
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.stats strong {
    display: block;
    color: var(--accent);
    font-size: 2rem;
}

.stats span { color: var(--muted); }

.mode-card { padding: 24px; }

.quiz-panel {
    max-width: 760px;
    margin: 48px auto;
    padding: 32px;
    text-align: center;
}

.quiz-symbol { font-size: 9rem; color: var(--accent); line-height: 1; }
.quiz-lead { font-size: 1.4rem; color: var(--accent); margin: 24px 0; }

.answer-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 24px;
}

.answer-list button { min-height: 62px; }

.result.correct { border-color: var(--accent-2); }
.result.wrong { border-color: var(--danger); }

.admin-panel { padding: 22px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px; border-bottom: 1px solid var(--line); text-align: left; }
th { color: var(--accent); }
.row-actions form { display: inline; }

.rune-form {
    background: rgba(36, 25, 22, .86);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 22px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 18px;
}

.span-2 { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: 10px; }
.check input { width: auto; }

.flash, .empty {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    padding: 14px 16px;
    margin: 16px 0;
}

a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline: 3px solid rgba(233, 189, 107, .75);
    outline-offset: 3px;
}

@media (hover: none) {
    .button.primary, button.primary { box-shadow: 0 4px 0 #b4863f, 0 8px 18px rgba(0, 0, 0, .18); }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

.flash.success { border-color: var(--accent-2); }
.flash.error { border-color: var(--danger); }

.admin-body {
    background: #f4f5f7;
    color: #24313f;
}

.admin-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
}

.admin-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    background: #1f2937;
    color: #eef2f7;
    padding: 18px;
}

.admin-brand {
    font-size: 1.2rem;
    font-weight: 800;
    color: #f6c76f;
    margin-bottom: 18px;
}

.admin-nav {
    display: grid;
    gap: 4px;
}

.admin-nav a {
    display: block;
    padding: 9px 10px;
    border-radius: 6px;
    color: #d9e1ec;
}

.admin-nav a:hover {
    background: rgba(255,255,255,.08);
}

.admin-nav-group {
    margin: 14px 0 4px;
    color: #94a3b8;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.admin-main {
    min-width: 0;
}

.admin-topbar {
    position: sticky;
    top: 0;
    z-index: 5;
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 24px;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
}

.breadcrumb-line {
    color: #64748b;
    font-size: .86rem;
}

.hamburger {
    display: none;
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #0f172a;
}

.admin-content {
    width: min(1180px, calc(100% - 32px));
    margin: 24px auto;
}

.admin-content .page-head,
.admin-content .admin-panel,
.admin-content .rune-form,
.admin-content .stats div {
    color: #24313f;
    background: #fff;
    border-color: #e2e8f0;
    box-shadow: 0 14px 34px rgba(15, 23, 42, .06);
}

.admin-content .page-head {
    padding: 20px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 18px;
}

.admin-content input,
.admin-content select,
.admin-content textarea {
    background: #fff;
    color: #0f172a;
    border-color: #cbd5e1;
}

.toast-note {
    border-radius: 8px;
    background: #fff;
    border-left: 4px solid #22c55e;
    padding: 12px 14px;
    margin-bottom: 12px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, .08);
}

.toast-note.error {
    border-left-color: #ef4444;
}

.admin-table-actions {
    min-width: 220px;
}

.pagination-lite {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
}

@media (max-width: 760px) {
    .site-header, .site-footer, .hero, .detail, .daily-card {
        grid-template-columns: 1fr;
    }

    main, .site-header, .site-footer {
        width: min(1120px, calc(100% - 20px));
    }

    .site-header, .site-footer {
        align-items: flex-start;
        flex-direction: column;
    }
    .site-footer { gap: 8px; }
    .site-footer p { text-align: left; }
    .header-actions {
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .header-actions nav { width: 100%; }

    .hero { padding: 28px; min-height: auto; gap: 30px; }
    .detail { gap: 22px; padding: 22px 14px; }
    .hero-stone { width: min(220px, 68vw); justify-self: center; font-size: 8rem; }
    .hero-subtitle { font-size: 1.12rem !important; }
    .intro-band { grid-template-columns: 1fr; }
    .intro-band .actions { grid-column: auto; }
    .filter-bar, .answer-list, .form-grid { grid-template-columns: 1fr; }
    .rune-card a { flex-direction: column; }
    .rune-card { min-height: 0; }
    .span-2 { grid-column: auto; }
}

@media (max-width: 960px) and (min-width: 761px) {
    .site-header { align-items: flex-start; }
    .header-actions { flex-wrap: wrap; justify-content: flex-end; }
    .hero { grid-template-columns: minmax(0, 1fr) 250px; }
    .hero-stone { font-size: 9rem; }
}

@media (max-width: 960px) {
    .admin-shell {
        grid-template-columns: 1fr;
    }

    .admin-sidebar {
        position: fixed;
        z-index: 20;
        inset: 0 auto 0 0;
        width: 280px;
        transform: translateX(-100%);
        transition: transform .2s ease;
    }

    body.sidebar-open .admin-sidebar {
        transform: translateX(0);
    }

    .hamburger {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 42px;
        height: 42px;
    }
}
