/* moradoklanna.com portal (homepage, /word/, /quiz/) — same look as blog.moradoklanna.com (brand red #B11F24). */
@font-face { font-family: 'Noto Sans Thai'; font-style: normal; font-weight: 100 900; font-display: swap; src: url('/assets/fonts/noto-sans-thai.woff2') format('woff2'); unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: 'Noto Sans Thai'; font-style: normal; font-weight: 100 900; font-display: swap; src: url('/assets/fonts/noto-sans-thai-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Tilok'; src: url('/dict/LN_TILOK_V6_05.TTF') format('truetype'); font-display: swap; }

:root {
  --red: #B11F24; --red-soft: #f7e9e9; --bg: #fff; --surface: #fcfbfa; --card: #f1efec; --text: #222; --text-2: #444;
  --muted: #6A6A6A; --line: #ddd; --ok: #1f7a3a; --ok-soft: #e7f5ec; --bad: #b42318; --bad-soft: #fdecea;
  --nav-h: 56px; color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --red: #e05a5f; --red-soft: #3a2224; --bg: #141312; --surface: #1d1b19; --card: #262320; --text: #ece8e1; --text-2: #cfc8bd;
    --muted: #a39d93; --line: #3a3631; --ok: #5cc47e; --ok-soft: #17281c; --bad: #ff8a80; --bad-soft: #3a1d1b; color-scheme: dark;
  }
  .nav__logo img, .hero__logo img { filter: brightness(1.35) saturate(1.1); }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 17px/1.7 "Noto Sans Thai", system-ui, sans-serif; }
a { color: var(--red); }
img { max-width: 100%; height: auto; }
.wrap { max-width: 1140px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.lanna { font-family: 'Tilok', sans-serif; }
:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; border-radius: 3px; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 50; background: var(--red); color: #fff; padding: 8px 14px; border-radius: 4px; }
.skip:focus { left: 8px; }

/* nav (same as the blog) */
.nav { position: sticky; top: 0; z-index: 30; background: var(--bg); border-bottom: 1px solid var(--line); }
.nav__inner { display: flex; align-items: center; gap: 14px; height: var(--nav-h); }
.nav__logo img { display: block; height: 38px; width: auto; }
.nav__links { display: flex; gap: 2px; flex: 1; justify-content: flex-end; }
.nav__links a { text-decoration: none; color: var(--text-2); font-size: 15px; padding: 6px 10px; border-radius: 6px; white-space: nowrap; }
.nav__links a:hover, .nav__links a.is-current { background: var(--red-soft); color: var(--red); }
.nav__drawer { display: none; margin-left: auto; }
.nav__drawer summary { list-style: none; cursor: pointer; font-size: 24px; padding: 4px 8px; color: var(--text-2); }
.nav__drawer summary::-webkit-details-marker { display: none; }
.nav__drawer > div { position: absolute; right: 0; left: 0; top: var(--nav-h); background: var(--bg); border-bottom: 1px solid var(--line); padding: 8px 16px 16px; box-shadow: 0 8px 20px rgba(0,0,0,.12); }
.nav__drawer > div a { display: block; padding: 10px 4px; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--text); }
@media (max-width: 760px) { .nav__links { display: none; } .nav__drawer { display: block; } }

/* homepage */
.hero { text-align: center; padding: 36px 0 12px; }
.hero__logo img { width: 300px; max-width: 72vw; height: auto; }
.hero h1 { font-size: 22px; font-weight: 600; margin: 8px 0 4px; color: var(--text-2); }
.hero p { margin: 0 0 18px; color: var(--muted); }
.dsearch { display: flex; gap: 8px; max-width: 640px; margin: 0 auto; border: 2px solid var(--red); border-radius: 12px; padding: 6px 6px 6px 14px; background: var(--bg); }
.dsearch input { flex: 1; min-width: 0; font: inherit; font-size: 18px; border: 0; outline: 0; background: transparent; color: var(--text); }
.dsearch button { font: inherit; font-weight: 600; border: 0; background: #B11F24; color: #fff; border-radius: 8px; padding: 8px 18px; cursor: pointer; }
.dsearch-hint { text-align: center; font-size: 14px; color: var(--muted); margin: 8px 0 0; }
.today { text-align: center; margin: 22px auto 0; font-size: 15px; color: var(--text-2); }
.today b { color: var(--red); }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 32px 0; }
@media (max-width: 760px) { .grid2 { grid-template-columns: 1fr; } }
.panel { border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; background: var(--surface); display: flex; flex-direction: column; }
.panel__label { font-size: 13px; letter-spacing: .06em; color: var(--muted); font-weight: 600; margin: 0 0 6px; }
.panel h2 { font-size: 22px; margin: 0 0 8px; }
.panel .btn { margin-top: auto; align-self: flex-start; }
.btn { display: inline-block; font: inherit; font-weight: 600; text-decoration: none; padding: 9px 18px; border-radius: 8px; border: 1px solid var(--red); color: var(--red); background: transparent; cursor: pointer; }
.btn--solid { background: #B11F24; border-color: #B11F24; color: #fff; }
.quiz-teaser { font-size: 52px; line-height: 1.2; margin: 6px 0 10px; }

.tools { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin: 0 0 32px; }
@media (max-width: 420px) { .tools { grid-template-columns: 1fr 1fr; } }
.tools a { display: block; border: 1px solid var(--line); border-radius: 12px; padding: 14px; text-decoration: none; color: var(--text); background: var(--bg); }
.tools a:hover { border-color: var(--red); }
.tools b { display: block; font-size: 16px; } .tools small { color: var(--muted); font-size: 13px; line-height: 1.5; display: block; }

.section-title { display: flex; justify-content: space-between; align-items: baseline; margin: 8px 0 12px; }
.section-title h2 { font-size: 22px; margin: 0; } .section-title a { font-size: 15px; }
.posts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 860px) { .posts { grid-template-columns: 1fr; } }
.post { display: flex; flex-direction: column; text-decoration: none; color: var(--text); border-radius: 12px; overflow: hidden; background: var(--card); }
.post img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; display: block; background: var(--line); }
.post div { padding: 10px 14px 14px; }
.post b { color: var(--red); font-size: 17px; line-height: 1.45; display: block; }
.post small { color: var(--muted); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 860px) { .post { flex-direction: row; } .post img { width: 120px; aspect-ratio: auto; height: auto; } }

/* word card */
.wcard { text-align: center; }
.wcard__lanna { font-size: 46px; line-height: 1.5; color: var(--text); }
.wcard__reading { font-size: 22px; font-weight: 700; color: var(--red); }
.wcard__pos { display: inline-block; font-size: 13px; color: var(--text-2); border: 1px solid var(--line); border-radius: 999px; padding: 0 10px; margin: 4px 0; }
.wcard__meaning { margin: 6px 0 4px; } .wcard__en { margin: 0; color: var(--muted); font-style: italic; }
.wcard--big { border: 1px solid var(--line); border-top: 5px solid var(--red); border-radius: 14px; padding: 26px 20px; background: var(--surface); }
.wcard--big .wcard__lanna { font-size: 84px; }
.wcard--big .wcard__reading { font-size: 32px; }
.wcard--big .wcard__meaning { font-size: 19px; max-width: 640px; margin: 10px auto 4px; }

/* /word/ page */
.page-head { text-align: center; margin: 28px 0 16px; }
.page-head h1 { font-size: 28px; margin: 0; } .page-head p { margin: 4px 0 0; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 18px 0; }
.related { max-width: 640px; margin: 8px auto 0; }
.archive { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 10px; }
.archive li { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; background: var(--bg); }
.archive a { text-decoration: none; color: var(--text); display: block; }
.archive .lanna { font-size: 30px; line-height: 1.4; display: block; }
.archive b { color: var(--red); } .archive small { color: var(--muted); display: block; font-size: 13px; }
.share { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center; font-size: 14px; color: var(--muted); }
.share a, .share button { font: inherit; font-size: 14px; text-decoration: none; border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; color: var(--text); background: var(--surface); cursor: pointer; }
.share .share--line { background: #06c755; border-color: #06c755; color: #fff; }
.share .share--fb { background: #1877f2; border-color: #1877f2; color: #fff; }

/* /quiz/ */
.quiz { max-width: 680px; margin: 0 auto; }
.quiz__best { text-align: center; color: var(--text-2); min-height: 1.7em; }
.quiz__modes { display: grid; gap: 12px; }
.qmode { font: inherit; text-align: left; border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; background: var(--surface); color: var(--text); cursor: pointer; }
.qmode:hover { border-color: var(--red); } .qmode b { display: block; font-size: 19px; } .qmode small { color: var(--muted); font-size: 14px; }
.quiz__bar { display: flex; justify-content: space-between; font-size: 15px; color: var(--text-2); }
.quiz__progress { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin: 6px 0 16px; }
.quiz__progress span { display: block; height: 100%; width: 0; background: var(--red); transition: width .3s; }
.quiz__lanna { text-align: center; font-size: 76px; line-height: 1.5; min-height: 1.5em; }
.quiz__reading { text-align: center; font-size: 24px; font-weight: 700; color: var(--red); min-height: 0; }
.quiz__ask { text-align: center; color: var(--text-2); margin: 4px 0 12px; }
.quiz__choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 560px) { .quiz__choices { grid-template-columns: 1fr; } }
.qchoice { font: inherit; font-size: 18px; text-align: center; border: 2px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--bg); color: var(--text); cursor: pointer; line-height: 1.5; }
.qchoice:hover:not(:disabled) { border-color: var(--red); }
.qchoice:disabled { cursor: default; opacity: .75; }
.qchoice.is-right { border-color: var(--ok); background: var(--ok-soft); opacity: 1; font-weight: 600; }
.qchoice.is-wrong { border-color: var(--bad); background: var(--bad-soft); opacity: 1; }
.quiz__feedback { min-height: 1.7em; margin: 14px 0 10px; text-align: center; }
.quiz__feedback.is-right { color: var(--ok); } .quiz__feedback.is-wrong { color: var(--bad); }
.quiz__feedback b { color: var(--text); }
#q-next { display: block; margin: 0 auto; }
.quiz__big { text-align: center; font-size: 56px; font-weight: 700; color: var(--red); margin: 10px 0 0; }
#q-msg { text-align: center; font-size: 18px; margin: 0; }
.quiz__review-title { font-size: 20px; margin: 28px 0 10px; }
.qdaily { border: 2px solid var(--red); border-radius: 16px; padding: 18px 20px; margin: 0 0 18px; background: var(--red-soft); text-align: center; }
.qdaily .panel__label { margin: 0; } .qdaily__text { margin: 4px 0; } .qdaily__streak { margin: 0 0 8px; font-weight: 600; color: var(--red); min-height: 0; }
.quiz__grid { font: 26px/1.3 system-ui, "Apple Color Emoji", "Segoe UI Emoji", sans-serif; text-align: center; margin: 8px 0; white-space: pre-wrap; letter-spacing: 2px; }
.quiz__context { text-align: center; margin: 0 0 8px; font-weight: 600; }
.quiz__reading--big { font-size: 40px; margin: 18px 0 6px; }
.qchoice--lanna { font-family: 'Tilok', sans-serif; font-size: 32px; padding: 8px 10px; }
.q-fb-lanna { font-size: 26px; }
.quiz__sets-title { font-size: 20px; margin: 28px 0 10px; }
.play { font: inherit; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 0 10px; cursor: pointer; }
.qmode--review { border-color: var(--red); }

/* /word/ extras */
.voice { text-align: center; margin: 14px 0 0; }
.example { max-width: 640px; margin: 16px auto 0; padding: 10px 16px; border-left: 4px solid var(--red); background: var(--surface); border-radius: 6px; }
.example .panel__label { display: block; }
.wimg { max-width: 640px; margin: 28px auto 0; text-align: center; }
.wimg canvas { width: 100%; max-width: 420px; height: auto; border-radius: 12px; box-shadow: 0 6px 24px rgba(0,0,0,.15); }
.embed { max-width: 760px; margin: 32px auto 0; border: 1px solid var(--line); border-radius: 10px; padding: 10px 16px; font-size: 15px; }
.embed summary { cursor: pointer; font-weight: 600; } .embed pre { white-space: pre-wrap; word-break: break-all; background: var(--card); padding: 8px 10px; border-radius: 6px; font-size: 13px; }

/* homepage panel buttons */
.panel__btns { margin-top: auto; display: flex; flex-wrap: wrap; gap: 8px; }

/* /play/ hub + /play/match/ */
.games { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.games a { display: block; border: 1px solid var(--line); border-radius: 14px; padding: 18px; text-decoration: none; color: var(--text); background: var(--surface); }
.games a:hover { border-color: var(--red); } .games__icon { font-size: 40px; display: block; } .games b { font-size: 20px; display: block; margin: 4px 0; color: var(--red); }
.games small { color: var(--text-2); font-size: 15px; }
.match { max-width: 680px; margin: 0 auto; }
.match__grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 10px 0; }
@media (max-width: 560px) { .match__grid { grid-template-columns: repeat(3, 1fr); } }
.mcard { font: inherit; aspect-ratio: 3 / 4; border: 2px solid var(--line); border-radius: 12px; background: #B11F24; color: #fff; cursor: pointer; padding: 6px; display: grid; place-items: center; transition: transform .15s; }
.mcard:active { transform: scale(.97); }
.mcard__back { font-weight: 700; opacity: .85; } .mcard__face { display: none; font-size: 20px; font-weight: 600; line-height: 1.3; word-break: break-word; }
.mcard__face.lanna { font-size: 34px; font-weight: 400; }
.mcard.is-open, .mcard.is-done { background: var(--bg); color: var(--text); }
.mcard.is-open .mcard__back, .mcard.is-done .mcard__back { display: none; } .mcard.is-open .mcard__face, .mcard.is-done .mcard__face { display: block; }
.mcard.is-done { border-color: var(--ok); background: var(--ok-soft); cursor: default; } .mcard.is-miss { border-color: var(--bad); }

/* /ask/ — AI */
.ask { max-width: 760px; margin: 0 auto; }
.ask__tabs { display: flex; gap: 6px; justify-content: center; margin: 0 0 12px; }
.ask__tabs button { font: inherit; border: 1px solid var(--line); background: var(--surface); color: var(--text-2); border-radius: 999px; padding: 6px 16px; cursor: pointer; }
.ask__tabs button.is-current { border-color: var(--red); background: var(--red-soft); color: var(--red); font-weight: 600; }
.ask__form button:disabled { opacity: .6; }
.ask__examples { text-align: center; margin: 10px 0 0; font-size: 14px; color: var(--muted); }
.chip { font: inherit; font-size: 14px; border: 1px solid var(--line); background: var(--bg); color: var(--text-2); border-radius: 999px; padding: 2px 12px; margin: 3px; cursor: pointer; }
.chip:hover { border-color: var(--red); color: var(--red); }
.ask__out { margin: 20px 0 0; min-height: 40px; }
.ask__wait { text-align: center; color: var(--muted); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .4; } }
.ask__answer { border: 1px solid var(--line); border-left: 4px solid var(--red); border-radius: 10px; padding: 12px 18px; background: var(--surface); }
.ask__answer ul { padding-left: 20px; } .ask__q { color: var(--muted); margin: 0 0 6px; font-size: 15px; }
.cite { text-decoration: none; font-size: 13px; vertical-align: super; margin-left: 1px; }
.ask__h { font-size: 18px; margin: 20px 0 8px; }
.ask .archive em { font-style: normal; font-size: 12px; color: var(--muted); }
.ask__err { color: var(--bad); text-align: center; } .ask__report { text-align: right; }
.ask__note { font-size: 13px; color: var(--muted); text-align: center; margin: 24px 0 0; }

/* footer (same as the blog) */
.site-footer { margin-top: 56px; border-top: 1px solid var(--line); background: var(--surface); color: var(--text-2); font-size: 15px; }
.footer__grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 24px; padding-top: 28px; padding-bottom: 12px; }
.footer__grid b { display: block; color: var(--text); margin-bottom: 6px; }
.footer__grid ul { list-style: none; margin: 0; padding: 0; } .footer__grid li { margin: 3px 0; }
.footer__grid a { color: var(--text-2); text-decoration: none; } .footer__grid a:hover { color: var(--red); text-decoration: underline; }
.footer__copy { padding-top: 12px; padding-bottom: 28px; font-size: 13px; color: var(--muted); }
@media (max-width: 700px) { .footer__grid { grid-template-columns: 1fr 1fr; } .footer__grid > div:first-child { grid-column: 1 / -1; } }

@media print { .nav, .skip, .site-footer, .share, .actions { display: none !important; } }
