/* ToolHub styles
   1. Tokens (colours, radius) – change the look of the whole site here
   2. Base
   3. Layout: header, footer, page
   4. Components: buttons, forms, cards, badges, alerts, tables
   5. Quota meter & upsell
   6. Pages: home, plans, donate, account, admin
   7. Tool pieces shared by tools (dropzone, progress, result cards) */

/* 0. Font: IBM Plex Sans Thai, served from our own server (static/fonts, SIL OFL) -------- */
@font-face { font-family: "IBM Plex Sans Thai"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("../fonts/plex-thai-thai-400.woff2") format("woff2"); unicode-range: U+02D7,U+0303,U+0331,U+0E01-0E5B,U+200C-200D,U+25CC; }
@font-face { font-family: "IBM Plex Sans Thai"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("../fonts/plex-thai-latin-400.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: "IBM Plex Sans Thai"; font-style: normal; font-weight: 500; font-display: swap;
  src: url("../fonts/plex-thai-thai-500.woff2") format("woff2"); unicode-range: U+02D7,U+0303,U+0331,U+0E01-0E5B,U+200C-200D,U+25CC; }
@font-face { font-family: "IBM Plex Sans Thai"; font-style: normal; font-weight: 500; font-display: swap;
  src: url("../fonts/plex-thai-latin-500.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: "IBM Plex Sans Thai"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("../fonts/plex-thai-thai-600.woff2") format("woff2"); unicode-range: U+02D7,U+0303,U+0331,U+0E01-0E5B,U+200C-200D,U+25CC; }
@font-face { font-family: "IBM Plex Sans Thai"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("../fonts/plex-thai-latin-600.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: "IBM Plex Sans Thai"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("../fonts/plex-thai-thai-700.woff2") format("woff2"); unicode-range: U+02D7,U+0303,U+0331,U+0E01-0E5B,U+200C-200D,U+25CC; }
@font-face { font-family: "IBM Plex Sans Thai"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("../fonts/plex-thai-latin-700.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; }
/* IBM Plex Sans Thai draws ฬ without its tall stroke, so "นาฬิกา" reads like "นาผิกา". This face takes over
   ฬ from a font already on the device (Windows / Apple / Android). The marks are in the range too so a whole
   ฬ+vowel cluster switches font together; every other cluster still matches Plex first (its base letter isn't here). */
@font-face { font-family: "Thai LoChula"; font-weight: 400 500; unicode-range: U+0E2C,U+0E31,U+0E34-0E3A,U+0E47-0E4E;
  src: local("Leelawadee UI"), local("LeelawadeeUI"), local("Thonburi"), local("Noto Sans Thai"), local("NotoSansThai-Regular"); }
@font-face { font-family: "Thai LoChula"; font-weight: 600 700; unicode-range: U+0E2C,U+0E31,U+0E34-0E3A,U+0E47-0E4E;
  src: local("Leelawadee UI Bold"), local("LeelawadeeUI-Bold"), local("Thonburi Bold"), local("Thonburi-Bold"),
       local("Noto Sans Thai Bold"), local("NotoSansThai-Bold"); }

/* 1. Tokens ---------------------------------------------------------------- */
:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --surface-2: #faf9f7;
  --text: #1d1b19;
  --muted: #6f6a64;
  --line: #e4e0da;
  --accent: #e8453c;
  --accent-soft: #fdeceb;
  --accent-ink: #ffffff;
  --gold: #b7791f;
  --gold-soft: #fbf3e4;
  --ok: #1f8a4c;
  --ok-soft: #e7f5ec;
  --bad: #c2362f;
  --bad-soft: #fbeceb;
  --info-soft: #ecf2fb;
  --radius: 18px;
  --radius-sm: 12px;
  --yellow: #ffd166;       /* second accent (logo dot): stats strip, highlights */
  --yellow-ink: #141312;
  --shadow: 0 1px 2px rgb(0 0 0 / .04), 0 6px 20px rgb(0 0 0 / .04);
  --font: "Thai LoChula", "IBM Plex Sans Thai", "Noto Sans Thai", "Leelawadee UI", system-ui, sans-serif;
  color-scheme: light;
}
/* Dark theme: <html data-theme="dark">, set before the page paints by the script in base.html
   (the visitor's choice from the header button, else the device setting). Tool CSS uses [data-theme=dark] too. */
:root[data-theme=dark] {
    /* design "Mix 1" (2026-11-07): near-black ground, warm off-white text, tubhool red + logo yellow */
    --bg: #0b0b0c;
    --surface: #161413;
    --surface-2: #1d1a19;
    --text: #f4f1ec;
    --muted: #a8a29a;
    --line: #2a2623;
    --accent: #e8453c;
    --accent-soft: #2a1c1a;
    --accent-ink: #ffffff;
    --gold: #f0b252;
    --gold-soft: #33281a;
    --ok: #4fc483;
    --ok-soft: #173123;
    --bad: #ff7a72;
    --bad-soft: #3a1f1c;
    --info-soft: #1c2533;
    --shadow: none;
    color-scheme: dark;
}

/* 2. Base ------------------------------------------------------------------ */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--text); font: 16px/1.6 var(--font);
}
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.25; letter-spacing: -.01em; }
code { background: var(--line); padding: 1px 6px; border-radius: 6px; font-size: .9em; }
.icon { width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.2em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.hidden, [hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* 3. Layout ---------------------------------------------------------------- */
.container { width: min(1080px, 100% - 32px); margin: 0 auto; }
.container.narrow { width: min(860px, 100% - 32px); }
.container.tiny { width: min(440px, 100% - 32px); }
main { flex: 1; padding-bottom: 48px; }

.site-header {
  position: sticky; top: 0; z-index: 40;
  border-bottom: 1px solid transparent; transition: border-color .2s, box-shadow .2s;
}
/* the blur sits on a pseudo-element: backdrop-filter on the header itself would trap the
   position:fixed apps sheet (phones) inside the header box */
.site-header::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: color-mix(in srgb, var(--bg) 84%, transparent); backdrop-filter: saturate(1.4) blur(12px);
}
.site-header.scrolled { border-bottom-color: var(--line); box-shadow: 0 6px 20px rgb(0 0 0 / .06); }
.site-header .container { position: relative; display: flex; align-items: center; gap: 16px; height: 64px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 1.1rem; color: var(--text); text-decoration: none; }
.logo { display: block; width: 34px; height: 34px; flex: none; transition: transform .2s; }
.logo svg { display: block; width: 100%; height: 100%; }
.brand:hover .logo { transform: rotate(-6deg) scale(1.05); }
.brand-name { text-transform: lowercase; letter-spacing: -.01em; }
.brand-dot { color: #f5b82e; }
.brand, .header-right { flex: none; }
.header-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.user-menu { position: relative; }
.user-menu summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px;
  padding: 4px 10px 4px 4px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
}
.user-menu summary::-webkit-details-marker { display: none; }
.avatar {
  display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: .85rem;
}
.user-menu .dropdown {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.dropdown a, .dropdown button {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border-radius: 8px;
  color: var(--text); text-decoration: none; background: none; border: 0; font: inherit; font-size: .92rem; cursor: pointer; text-align: left;
}
.dropdown a:hover, .dropdown button:hover { background: var(--line); }
.dropdown .who { padding: 8px 10px; font-size: .85rem; border-bottom: 1px solid var(--line); margin-bottom: 4px; }

.site-footer { border-top: 1px solid var(--line); padding: 24px 0 32px; color: var(--muted); font-size: .85rem; }
.site-footer .container { display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; }
.site-footer a { color: var(--muted); }

.page-head { padding: 36px 0 20px; }
.page-head h1 { margin: 0 0 6px; font-size: clamp(1.5rem, 3.5vw, 2rem); }
.page-head p { margin: 0; color: var(--muted); }

/* 4. Components ------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-size: .92rem; font-weight: 500; line-height: 1.2; white-space: nowrap;
  padding: 9px 16px; border-radius: var(--radius-sm); border: 1px solid transparent;
  cursor: pointer; text-decoration: none; transition: filter .15s, background .15s;
}
.btn:disabled { opacity: .6; cursor: progress; }
.btn-primary { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn-primary:hover:not(:disabled) { filter: brightness(1.06); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn-ghost:hover:not(:disabled) { background: var(--line); }
.btn-gold { background: var(--gold); color: #fff; font-weight: 600; }
.btn-danger { background: transparent; color: var(--bad); border-color: var(--bad); }
.btn-sm { padding: 5px 10px; font-size: .82rem; }
.btn-block { width: 100%; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
}
.card h2, .card h3 { margin-top: 0; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px;
  font-size: .75rem; font-weight: 600; background: var(--line); color: var(--muted); white-space: nowrap;
}
.badge-accent { background: var(--accent-soft); color: var(--accent); }
.badge-gold { background: var(--gold-soft); color: var(--gold); }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-bad { background: var(--bad-soft); color: var(--bad); }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: .9rem; font-weight: 500; }
.field .hint { font-size: .8rem; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search],
input[type=url], input[type=date], input:not([type]), select, textarea {
  font: inherit; font-size: .95rem; color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 9px 12px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: .9rem; }
.check input { margin-top: 5px; accent-color: var(--accent); }

.alert {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm);
  font-size: .92rem; border: 1px solid transparent; margin-bottom: 10px;
}
.alert-success { background: var(--ok-soft); color: var(--ok); }
.alert-error { background: var(--bad-soft); color: var(--bad); }
.alert-info { background: var(--info-soft); color: var(--text); }
.flashes { padding-top: 16px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .8rem; color: var(--muted); font-weight: 600; background: var(--surface-2); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { padding: 28px; text-align: center; color: var(--muted); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs a {
  padding: 8px 14px; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; white-space: nowrap; font-size: .92rem;
}
.tabs a.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }

/* 5. Quota meter & upsell -------------------------------------------------- */
.quota {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); font-size: .88rem;
}
.quota .bar { flex: 1; min-width: 80px; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.quota .bar i { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width .3s; }
.quota.is-empty .bar i { background: var(--bad); }
.quota.is-unlimited .bar i { background: var(--gold); width: 100%; }
.quota .text b { font-variant-numeric: tabular-nums; }

.upsell {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 16px 18px; margin: 14px 0;
  border-radius: var(--radius); background: var(--gold-soft); border: 1px solid color-mix(in srgb, var(--gold) 35%, transparent);
}
.upsell p { margin: 0; flex: 1; min-width: 200px; }

/* 6. Pages ----------------------------------------------------------------- */
.hero { padding: 56px 0 28px; text-align: center; }
.hero h1 { font-size: clamp(1.9rem, 5vw, 3rem); margin: 0 0 10px; }
.hero p { color: var(--muted); margin: 0 auto 24px; max-width: 560px; font-size: 1.05rem; }
.search { position: relative; max-width: 480px; margin: 0 auto; }
.search .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input { padding: 12px 14px 12px 42px; border-radius: 999px; }

.section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 32px 0 14px; }
.section-title h2 { margin: 0; font-size: 1.25rem; }

.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.tool-card {
  display: flex; flex-direction: column; gap: 10px; padding: 20px; color: var(--text); text-decoration: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  transition: border-color .15s, transform .15s;
}
.tool-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.tool-card .top { display: flex; align-items: center; justify-content: space-between; }
.tool-icon {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px;
  background: var(--accent-soft); color: var(--accent);
}
.tool-icon .icon { width: 22px; height: 22px; }
.tool-card h3 { margin: 0; font-size: 1.08rem; }
.tool-card p { margin: 0; color: var(--muted); font-size: .9rem; flex: 1; }
.tool-card .foot { font-size: .8rem; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; }
.tool-card.soon { opacity: .6; pointer-events: none; }

.plans { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: stretch; }
.plan { display: flex; flex-direction: column; gap: 12px; position: relative; }
.plan.featured { border-color: var(--gold); border-width: 2px; }
.plan .price { font-size: 1.6rem; font-weight: 700; }
.plan .price small { font-size: .85rem; font-weight: 400; color: var(--muted); }
.plan ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; font-size: .92rem; flex: 1; }
.plan li { display: flex; gap: 8px; }
.plan li .icon { color: var(--ok); margin-top: 3px; }
.plan li.no { color: var(--muted); }
.plan li.no .icon { color: var(--muted); }
.plan .current { position: absolute; top: -11px; right: 16px; }

.faq details { border-bottom: 1px solid var(--line); padding: 12px 0; }
.faq summary { cursor: pointer; font-weight: 500; }
.faq p { color: var(--muted); margin: 8px 0 0; }

.tier-picker { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.tier {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 14px 8px; text-decoration: none;
  color: var(--text); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
}
.tier b { font-size: 1.3rem; }
.tier span { font-size: .82rem; color: var(--muted); }
.tier.active { border: 2px solid var(--gold); background: var(--gold-soft); }
.qr-box { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.qr-box svg { width: 220px; height: 220px; background: #fff; border-radius: 12px; padding: 6px; }
.whatsnew-link { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 99px;
  border: 1px solid var(--line); font-size: .9rem; text-decoration: none; }
.whatsnew-link:hover { border-color: var(--accent); }
.whatsnew-link svg { width: 16px; height: 16px; color: var(--yellow, #ffd166); }
/* Live Stage hero with the how-to clip (shown when back office → Live Stage has a YouTube link) */
.ls-hero-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 48px; align-items: center; text-align: left; }
.ls-hero-split .ls-hero-text p { margin-left: 0; }
.ls-hero-split .row { justify-content: flex-start !important; }
.hero .ls-accept { margin: 12px auto 0; font-size: .82rem; }
.hero .ls-accept a { color: inherit; text-decoration: underline; }
.ls-tut { position: relative; min-width: 0; }
.ls-tut-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.ls-tut-yt { display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px 5px 6px; border-radius: 99px; background: #ff0033; color: #fff; font-weight: 700; font-size: .82rem; }
.ls-tut-yt i { width: 22px; height: 16px; border-radius: 5px; background: #fff; display: grid; place-items: center; }
.ls-tut-yt i::before { content: ""; border-left: 7px solid #ff0033; border-top: 4.5px solid transparent; border-bottom: 4.5px solid transparent; margin-left: 2px; }
.hero .ls-tut-title { font-size: clamp(1.3rem, 2.4vw, 1.75rem); font-weight: 700; line-height: 1.3; margin: 0 0 18px; max-width: none; color: var(--text); }
.ls-tut-title em { font-style: normal; background: linear-gradient(90deg, #ffd166, #ff8f88); -webkit-background-clip: text; background-clip: text; color: transparent; }
@property --ls-a { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
.ls-tut-frame { position: relative; padding: 3px; border-radius: 22px; isolation: isolate; }
.ls-tut-frame::before, .ls-tut-frame::after { content: ""; position: absolute; border-radius: inherit;
  background: conic-gradient(from var(--ls-a), #e8453c, #ffd166, #b06cff, #e8453c); animation: ls-spin 5s linear infinite; }
.ls-tut-frame::before { inset: 0; z-index: -1; }
.ls-tut-frame::after { inset: -18px; z-index: -2; border-radius: 36px; filter: blur(30px); opacity: .5; }
@keyframes ls-spin { to { --ls-a: 360deg; } }
.ls-tut-video { position: relative; display: block; width: 100%; aspect-ratio: 16 / 9; padding: 0; border: 0; border-radius: 19px; overflow: hidden;
  background: #000; cursor: pointer; }
.ls-tut-video img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ls-tut-play { position: absolute; left: 50%; top: 50%; width: 84px; height: 60px; transform: translate(-50%, -50%); border-radius: 16px; background: #ff0033;
  display: grid; place-items: center; box-shadow: 0 0 0 10px rgb(255 0 51 / .18), 0 12px 30px rgb(0 0 0 / .5); transition: transform .2s; }
.ls-tut-play::before { content: ""; border-left: 22px solid #fff; border-top: 13px solid transparent; border-bottom: 13px solid transparent; margin-left: 5px; }
.ls-tut-video:hover .ls-tut-play, .ls-tut-video:focus-visible .ls-tut-play { transform: translate(-50%, -50%) scale(1.08); }
.ls-tut-sticker { position: absolute; top: -22px; right: -14px; z-index: 5; padding: 9px 16px; border-radius: 14px; background: var(--yellow, #ffd166); color: #1a1408;
  font-weight: 800; font-size: .98rem; white-space: nowrap; box-shadow: 0 10px 24px rgb(0 0 0 / .45), 0 0 0 3px rgb(0 0 0 / .25);
  transform: rotate(6deg); animation: ls-bob 2.4s ease-in-out infinite; pointer-events: none; }
.ls-tut-sticker::after { content: ""; position: absolute; left: 50%; top: -9px; width: 46px; height: 16px; transform: translateX(-50%) rotate(-4deg);
  background: rgb(255 255 255 / .55); border-radius: 2px; }
@keyframes ls-bob { 50% { transform: rotate(6deg) translateY(-6px); } }
.ls-tut-steps { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 16px; font-size: .86rem; }
.ls-tut-steps span { padding: 5px 12px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); }
.ls-tut-steps b { color: var(--yellow, #ffd166); margin-right: 4px; }
.ls-tut-steps i { font-style: normal; color: var(--muted); }
.ls-tut-steps .goal { background: rgb(255 209 102 / .12); border-color: rgb(255 209 102 / .45); color: var(--yellow, #ffd166); font-weight: 600; }
.ls-tut-link { display: inline-block; margin-top: 10px; }
@media (max-width: 900px) {
  .ls-hero-split { grid-template-columns: 1fr; text-align: center; gap: 40px; }
  .ls-hero-split .row { justify-content: center !important; }
  .ls-tut-sticker { right: 6px; top: -16px; padding: 6px 12px; font-size: .82rem; }
  .hero .ls-tut-title { margin-bottom: 30px; }
  .ls-tut-head, .ls-tut-steps { justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  .ls-tut-frame::before, .ls-tut-frame::after, .ls-tut-sticker { animation: none; }
}
/* Live Stage feature showcase (download page) */
.ls-show { margin: 8px 0 12px; }
.ls-show-stage { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 40px;
  padding: 26px 48px; border-radius: 24px; border: 1px solid var(--line); overflow: hidden;
  background: radial-gradient(120% 90% at 0% 0%, rgba(232, 69, 60, .28), transparent 55%),
              radial-gradient(110% 90% at 100% 100%, rgba(124, 77, 255, .30), transparent 55%), var(--surface, #141416); }
.ls-show-text h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); line-height: 1.2; margin: 14px 0 12px; }
.ls-show-text p { font-size: 1.05rem; line-height: 1.75; max-width: 34em; }
.ls-phone { height: min(60vh, 540px); aspect-ratio: 9 / 16; border-radius: 28px; padding: 8px; background: #050506;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .12), 0 24px 60px rgba(0, 0, 0, .55); }
.ls-phone video { width: 100%; height: 100%; display: block; border-radius: 21px; object-fit: cover; background: #000; }
.ls-tabs { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.ls-show-stage[data-mode="pc"] { grid-template-columns: 1fr; gap: 22px; }
.ls-show-stage[data-mode="pc"] .ls-phone-main, .ls-show-stage[data-mode="phone"] .ls-pc { display: none; }
.ls-show-stage[data-mode="pc"] .ls-show-text p { max-width: 46em; }
.ls-show-stage[data-mode="pc"] .ls-show-note { display: none; }
.ls-pc { position: relative; padding-right: 220px; }
.ls-win { border-radius: 12px; overflow: hidden; background: #0f0e0d; border: 1px solid #34302c;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .6), 0 0 0 1px rgba(255, 255, 255, .04); }
.ls-win-bar { display: flex; align-items: center; gap: 10px; height: 32px; padding-left: 12px; background: #1c1a18;
  border-bottom: 1px solid #2a2724; font-size: .76rem; color: #cfc9c1; }
.ls-win-logo { width: 16px; height: 16px; border-radius: 4px; background: var(--accent); display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 11px; }
.ls-win-ctl { margin-left: auto; display: flex; height: 100%; }
.ls-win-ctl i { width: 42px; display: grid; place-items: center; font-style: normal; color: #bbb; }
.ls-win video { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; background: #000; }
.ls-pc .ls-phone-side { position: absolute; right: 0; bottom: -14px; height: auto; width: 250px; }
.ls-pc-arrow { position: absolute; right: 232px; top: 44%; z-index: 1; padding: 7px 14px; border-radius: 99px; background: var(--yellow, #ffd166);
  color: #111; font-weight: 700; font-size: .85rem; box-shadow: 0 8px 20px rgba(0, 0, 0, .4); }
.ls-tab { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center;
  padding: 16px 10px 18px; border-radius: 16px; border: 1px solid transparent; background: none; color: var(--muted);
  font: inherit; cursor: pointer; overflow: hidden; transition: background .2s, border-color .2s, color .2s; }
.ls-tab:hover { background: var(--surface-2); color: var(--text); }
.ls-tab.active { background: var(--surface-2); border-color: var(--line); color: var(--text); }
.ls-tab b { font-size: .95rem; line-height: 1.35; }
.ls-tab .small { line-height: 1.45; }
.ls-tab-icon svg { width: 26px; height: 26px; color: var(--accent); }
.ls-tab.active .ls-tab-icon svg { color: var(--yellow, #ffd166); }
.ls-tab-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; }
.ls-tab-bar i { display: block; height: 100%; width: 0; background: var(--accent); }
@media (max-width: 900px) {
  .ls-show-stage { grid-template-columns: 1fr; justify-items: center; text-align: center; padding: 24px 16px; gap: 20px; }
  .ls-show-text p { margin-inline: auto; }
  .ls-phone { height: min(58vh, 520px); order: -1; }
  .ls-show-text h2 { margin-top: 10px; }
  .ls-show-text p { font-size: .95rem; }
  .ls-show-note { display: none; }
  .ls-tabs { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 4px; }
  .ls-tab { flex: 0 0 150px; scroll-snap-align: start; }
  .ls-pc { padding-right: 0; padding-bottom: 250px; width: 100%; }
  .ls-pc .ls-phone-side { width: 150px; right: 50%; transform: translateX(50%); bottom: 0; }
  .ls-pc-arrow { display: none; }
}
/* Live Stage: "พร้อมไลฟ์ใน 4 ขั้น" + "วิธีติดตั้ง" */
.ls-block { margin: 64px 0 8px; scroll-margin-top: 90px; }
.ls-block-head { text-align: center; max-width: 640px; margin: 0 auto 28px; }
.ls-block-head h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); margin: 8px 0 6px; line-height: 1.25; }
.ls-block-head p { margin: 0; }
.ls-eyebrow { display: inline-block; padding: 4px 12px; border-radius: 99px; font-size: .8rem; font-weight: 600; letter-spacing: .02em;
  color: var(--accent); background: rgba(232, 69, 60, .12); border: 1px solid rgba(232, 69, 60, .3); }

.ls-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; position: relative; }
.ls-steps::before { content: ""; position: absolute; top: 46px; left: 12%; right: 12%; height: 2px; z-index: 0;
  background: linear-gradient(90deg, transparent, rgba(232, 69, 60, .55) 12%, rgba(255, 209, 102, .55) 88%, transparent); }
.ls-step { position: relative; z-index: 1; padding: 24px 20px 22px; border-radius: 18px; border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--surface-2), var(--surface)); transition: transform .2s, border-color .2s; }
.ls-step:hover { transform: translateY(-3px); border-color: rgba(232, 69, 60, .45); }
.ls-step-num { position: absolute; top: 14px; right: 16px; font-size: 2.6rem; font-weight: 800; line-height: 1; color: transparent;
  -webkit-text-stroke: 1px rgba(255, 255, 255, .16); }
.ls-step-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; margin-bottom: 16px;
  background: var(--accent); color: #fff; box-shadow: 0 8px 22px rgba(232, 69, 60, .35); }
.ls-step-icon svg { width: 24px; height: 24px; }
.ls-step h3 { font-size: 1.05rem; margin: 0 0 6px; }
.ls-step p { margin: 0; color: var(--muted); line-height: 1.65; font-size: .93rem; }
.ls-step p b, .ls-mini b { color: var(--text); }
.ls-step-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.ls-step-tags span { padding: 3px 10px; border-radius: 99px; font-size: .8rem; color: var(--muted); background: rgba(255, 255, 255, .05); border: 1px solid var(--line); }
.ls-step-tags b { color: var(--yellow, #ffd166); font-weight: 600; }

.ls-tip { display: flex; gap: 14px; align-items: flex-start; margin-top: 14px; padding: 16px 20px; border-radius: 16px;
  border: 1px solid rgba(255, 209, 102, .28); background: rgba(255, 209, 102, .06); }
.ls-tip-icon { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: rgba(255, 209, 102, .16); color: var(--yellow, #ffd166); }
.ls-tip-icon svg { width: 20px; height: 20px; }
.ls-tip ul { margin: 4px 0 0; padding-left: 18px; color: var(--muted); line-height: 1.7; font-size: .92rem; }
.ls-tip b { color: var(--text); }

.ls-os { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.ls-os-card { display: flex; flex-direction: column; padding: 24px; border-radius: 20px; border: 1px solid var(--line); background: var(--surface); }
.ls-os-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.ls-os-head h3 { margin: 0; font-size: 1.2rem; }
.ls-os-dl { margin-left: auto; }
.ls-os-dl svg { width: 16px; height: 16px; }
.ls-os-logo { flex: none; width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line); }
.ls-os-win { grid-template-columns: 10px 10px; grid-template-rows: 10px 10px; gap: 2px; place-content: center; }
.ls-os-win i { width: 10px; height: 10px; background: #3d8ef0; border-radius: 1px; }
.ls-os-mac svg { width: 24px; height: 24px; fill: var(--text); }
.ls-mini { list-style: none; counter-reset: m; margin: 0 0 18px; padding: 0; }
.ls-mini li { counter-increment: m; position: relative; padding: 0 0 12px 40px; color: var(--muted); line-height: 1.7; }
.ls-mini li::before { content: counter(m); position: absolute; left: 0; top: 1px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  font-size: .8rem; font-weight: 700; color: var(--text); background: var(--surface-2); border: 1px solid var(--line); }
.ls-mini li:not(:last-child)::after { content: ""; position: absolute; left: 12.5px; top: 30px; bottom: 2px; width: 1px; background: var(--line); }
.ls-block kbd { display: inline-block; padding: 0 7px; border-radius: 6px; font: inherit; font-size: .85em; font-weight: 600; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--line); border-bottom-width: 2px; white-space: nowrap; }
.ls-smartscreen { margin-top: auto; display: grid; gap: 6px; padding: 16px 18px; border-radius: 10px; background: #0b5cad; color: #fff; font-size: .8rem; line-height: 1.45;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12); }
.ls-smartscreen b { font-size: 1rem; font-weight: 600; }
.ls-smartscreen span { opacity: .85; }
.ls-smartscreen u { justify-self: start; padding: 1px 6px; border-radius: 4px; outline: 2px solid var(--yellow, #ffd166); outline-offset: 2px; text-underline-offset: 3px; }
.ls-ss-btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.ls-ss-btns em, .ls-ss-btns s { font-style: normal; text-decoration: none; padding: 5px 14px; border: 1px solid rgba(255, 255, 255, .7); }
.ls-ss-btns em { outline: 2px solid var(--yellow, #ffd166); outline-offset: 2px; font-weight: 600; }
.ls-drag { margin-top: auto; display: flex; align-items: center; justify-content: center; gap: 22px; padding: 18px; border-radius: 12px;
  background: linear-gradient(180deg, #e9e7e4, #d8d5d1); color: #222; font-size: .8rem; font-weight: 600; }
.ls-drag-app { display: grid; justify-items: center; gap: 6px; }
.ls-drag-app svg { width: 52px; height: 52px; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .25)); }
.ls-drag-arrow { font-size: 1.6rem; color: #555; }
.ls-os-note { display: flex; gap: 8px; align-items: center; margin: 14px 0 0; font-size: .85rem; color: var(--muted); }
.ls-os-note svg { width: 16px; height: 16px; flex: none; color: #4caf7d; }

@media (max-width: 900px) {
  .ls-steps { grid-template-columns: 1fr 1fr; }
  .ls-steps::before { display: none; }
  .ls-os { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .ls-block { margin-top: 48px; }
  .ls-steps { grid-template-columns: 1fr; }
  .ls-os-card { padding: 20px 16px; }
  .ls-os-head { flex-wrap: wrap; }
}
#changelog { scroll-margin-top: 90px; }
.changelog details { padding: 12px 0; }
.changelog details + details { border-top: 1px solid var(--line); }
.changelog summary { cursor: pointer; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.changelog .cl-ver { font-size: 1.1rem; }
.changelog ul { list-style: none; margin: 10px 0 0; padding: 0; line-height: 1.7; }
.changelog li { display: flex; gap: 10px; align-items: baseline; margin: 7px 0; }
.changelog li .badge { flex: none; min-width: 64px; text-align: center; }
.changelog .cl-dot { flex: none; }
.changelog .cl-note { margin: 10px 0 0; }
.pay-summary { justify-content: center; padding-block: 28px; }
.pay-amount { font-size: 2.4rem; font-weight: 800; line-height: 1.1; }
.qr-box .pp { font-weight: 700; color: #1a3f73; background: #fff; padding: 2px 10px; border-radius: 6px; font-size: .85rem; }
.steps-list { counter-reset: s; list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.steps-list li { counter-increment: s; display: flex; gap: 10px; font-size: .92rem; }
.steps-list li::before {
  content: counter(s); flex: none; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink); font-size: .78rem; font-weight: 700;
}

.stat { padding: 16px 18px; }
.stat .label { font-size: .82rem; color: var(--muted); }
.stat .value { font-size: 1.7rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.mini-bars { display: flex; align-items: flex-end; gap: 8px; height: 120px; padding-top: 8px; }
.mini-bars .b { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; font-size: .72rem; color: var(--muted); }
.mini-bars .b i { display: block; width: 100%; max-width: 36px; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 2px; }
.slip-thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); display: block; }

.auth-card { margin-top: 48px; }
.auth-card h1 { font-size: 1.5rem; margin: 0 0 4px; }
.auth-card .sub { color: var(--muted); margin: 0 0 20px; font-size: .92rem; }
.perk { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--accent-soft); font-size: .88rem; margin-bottom: 18px; }
.perk .icon { color: var(--accent); }

.error-page { text-align: center; padding: 80px 0; }
.error-page .code { font-size: 4rem; font-weight: 700; color: var(--accent); line-height: 1; }

.prose h2 { font-size: 1.15rem; margin-top: 28px; }
.prose p, .prose li { color: var(--muted); }

/* 7. Shared tool pieces ---------------------------------------------------- */
.tool-head { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; justify-content: space-between; padding: 32px 0 18px; }
.tool-head .title { display: flex; gap: 14px; align-items: center; }
.tool-head h1 { margin: 0; font-size: clamp(1.4rem, 3.5vw, 1.9rem); }
.tool-head p { margin: 2px 0 0; color: var(--muted); font-size: .92rem; }
.tool-head .quota { min-width: 280px; }

.box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow); }
.box textarea { border: 0; outline: 0; resize: vertical; background: transparent; padding: 6px 8px; }
.box textarea:focus { outline: 0; }
.actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }

.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center;
  padding: 40px 20px; border: 2px dashed var(--line); border-radius: var(--radius); background: var(--surface);
  cursor: pointer; transition: border-color .15s, background .15s;
}
.dropzone.drag, .dropzone:hover { border-color: var(--accent); background: var(--accent-soft); }
.dropzone .icon { width: 36px; height: 36px; color: var(--accent); }

.progress { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; margin-top: 10px; }
.progress i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: inherit; transition: width .3s ease; }
.progress.busy i { width: 30%; animation: busy 1.1s ease-in-out infinite alternate; }
@keyframes busy { from { margin-left: 0; } to { margin-left: 70%; } }
.status { margin-top: 4px; font-size: .85rem; color: var(--muted); min-height: 1.2em; word-break: break-word; }
.status.ok { color: var(--ok); }
.status.bad { color: var(--bad); }

.loading { display: flex; gap: 10px; justify-content: center; align-items: center; color: var(--muted); padding: 20px; }
.spinner { width: 18px; height: 18px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.error-box {
  white-space: pre-wrap; word-break: break-word; background: var(--surface); border: 1px solid var(--bad);
  color: var(--bad); border-radius: var(--radius); padding: 12px 14px; font-size: .9rem;
}

/* Responsive --------------------------------------------------------------- */
@media (max-width: 860px) {
  .plans, .grid-3 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .tool-head .quota { min-width: 0; width: 100%; }
  .tier-picker { grid-template-columns: 1fr 1fr 1fr; }
}

/* Site announcement (set in admin → settings) */
.announce { padding: 10px 0; font-size: .9rem; background: var(--info-soft); border-bottom: 1px solid var(--line); }
.announce-warning { background: var(--gold-soft); color: var(--text); }

/* Back office */
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.member-head { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.avatar-lg { width: 52px; height: 52px; font-size: 1.3rem; }
.truncate { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.limit-table input[type=number]:disabled { opacity: .45; }
.danger-zone { border-color: var(--bad); }
@media (max-width: 860px) { .grid-4 { grid-template-columns: 1fr 1fr; } }
.settings-layout { display: grid; grid-template-columns: 200px 1fr; gap: 20px; align-items: start; }
.settings-tabs { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 80px; }
.settings-tabs a { padding: 8px 12px; border-radius: 8px; color: var(--muted); text-decoration: none; font-size: .92rem; }
.settings-tabs a:hover { background: var(--line); color: var(--text); }
.settings-tabs a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.tool-setting { padding: 14px 0; border-bottom: 1px solid var(--line); }
.tool-setting:first-of-type { padding-top: 0; }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font: inherit; font-size: .8rem; text-decoration: underline; }
@media (max-width: 860px) {
  .settings-layout { grid-template-columns: 1fr; }
  .settings-tabs { flex-direction: row; overflow-x: auto; position: static; }
  .settings-tabs a { white-space: nowrap; }
}

/* Waiting in a queue: calm grey sliding bar instead of the accent colour */
.progress.queued i { background: var(--muted); animation-duration: 2s; }
.queue-stat { padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.queue-stat.is-busy { border-color: var(--gold); background: var(--gold-soft); }
.queue-stat .warn { color: var(--gold); font-weight: 600; }

/* Breadcrumb + the about / FAQ / related block under each tool (templates/_macros.html) */
.crumbs { padding-top: 18px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px; }
.crumbs a { color: var(--muted); }
.crumbs + .tool-head { padding-top: 10px; }
.tool-info { border-top: 1px solid var(--line); margin-top: 36px; padding: 8px 0 40px; display: flex; flex-direction: column; gap: 8px; }
.tool-info h2 { font-size: 1.2rem; margin: 24px 0 8px; }
.tool-info .prose p { margin: 0 0 10px; }

/* Back office: sub-tool switches */
.sub-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px 14px; margin-top: 8px; }

/* light / dark switch in the header (icon shows the theme you switch to) */
.theme-toggle { display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 1px solid var(--line);
  border-radius: 8px; background: none; color: var(--muted); cursor: pointer; }
.theme-toggle:hover { color: var(--text); border-color: var(--text); }
.theme-toggle .icon { width: 18px; height: 18px; }
.theme-toggle .to-light, [data-theme=dark] .theme-toggle .to-dark { display: none; }
[data-theme=dark] .theme-toggle .to-light { display: block; }

/* language switch in the header */
.lang-switch { font-size: .82rem; font-weight: 600; color: var(--muted); text-decoration: none; padding: 5px 8px;
  border: 1px solid var(--line); border-radius: 8px; }
.lang-switch:hover { color: var(--text); border-color: var(--text); }

/* Small multi-page tools (templates/_subpage.html) */
.sp-head { display: flex; flex-wrap: wrap; gap: 14px; justify-content: space-between; align-items: center; padding: 10px 0 18px; }
.sp-title { display: flex; gap: 14px; align-items: center; min-width: 0; }
.sp-title h1 { margin: 0 0 4px; font-size: clamp(1.35rem, 3.4vw, 1.9rem); }
.sp-title p { margin: 0; color: var(--muted); }
.sp-links { display: flex; flex-wrap: wrap; gap: 8px; }
.sp-links a { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px;
  color: var(--text); text-decoration: none; background: var(--surface); font-size: .9rem; }
.sp-links a:hover { border-color: var(--accent); color: var(--accent); }
.sp-links .icon { width: 16px; height: 16px; }
.sp-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.sp-card { display: flex; gap: 14px; align-items: flex-start; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--text); text-decoration: none; transition: border-color .15s, transform .15s; }
.sp-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.sp-card .tool-icon { flex: none; }
.sp-card span { display: flex; flex-direction: column; gap: 4px; }
.sp-card small { color: var(--muted); font-size: .85rem; }

/* Home search: pages inside tools */
.sub-results { margin-top: 22px; }
.sub-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.sub-item { display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); text-decoration: none; }
.sub-item:hover { border-color: var(--accent); }
.sub-item small { color: var(--muted); font-size: .8rem; overflow: hidden; text-overflow: ellipsis; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

/* ---- Header, design C (2026-10-18): search-first bar, apps grid, phone tab bar.
   The previous header is kept in ui_backups/header-before-design-c-2026-10-18/ ---- */
.gsearch { position: relative; flex: 1; max-width: 620px; margin: 0 auto; min-width: 0; }
.gs-box {
  display: flex; align-items: center; gap: 10px; height: 44px; margin: 0; padding: 0 8px 0 16px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted);
  cursor: text; transition: border-color .15s, box-shadow .15s;
}
.gs-box:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.gs-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); color: var(--text); }
.gs-box .icon { width: 18px; height: 18px; flex: none; }
.gs-box input {
  flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; background: none; box-shadow: none; outline: none;
  font: inherit; font-size: .95rem; color: var(--text);
}
.gs-box input:focus { box-shadow: none; }
.gs-box input::-webkit-search-cancel-button { display: none; }
.gs-kbd {
  flex: none; padding: 2px 8px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-2);
  font: 600 .72rem var(--font); color: var(--muted); white-space: nowrap;
}
.gs-close { display: none; }
.gs-results {
  position: absolute; left: 0; right: 0; top: calc(100% + 8px); max-height: min(70vh, 520px); overflow: auto; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 16px 40px rgb(0 0 0 / .16);
}
.gs-group { margin: 8px 10px 4px; font-size: .75rem; font-weight: 600; color: var(--muted); }
.gs-item { display: flex; flex-direction: column; gap: 1px; padding: 9px 12px; border-radius: 10px; color: var(--text); text-decoration: none; }
.gs-item small { color: var(--muted); font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gs-item:hover, .gs-item.on { background: var(--accent-soft); }
.gs-empty { margin: 0; padding: 14px; color: var(--muted); font-size: .9rem; text-align: center; }

.hdr-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px; padding: 0; border: 1px solid var(--line);
  border-radius: 12px; background: var(--surface); color: var(--text); cursor: pointer; transition: border-color .15s, background .15s, color .15s;
}
.hdr-btn:hover, .hdr-btn[aria-expanded="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.hdr-btn .icon { width: 20px; height: 20px; }
.gs-open { display: none; }
/* Prompt Play (/games) – the one top-level section next to the tools; on phones it shrinks to its icon */
.hdr-games {
  display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 12px; border-radius: 12px; white-space: nowrap;
  border: 1px solid #ddd6fe; background: #f5f3ff; color: #6d28d9; font-weight: 600; font-size: .88rem; text-decoration: none;
  transition: border-color .15s, background .15s;
}
.hdr-games:hover, .hdr-games.on { border-color: #8b5cf6; background: #ede9fe; color: #5b21b6; }
.hdr-games .icon { width: 19px; height: 19px; }
[data-theme="dark"] .hdr-games { border-color: #3d3466; background: #2b2440; color: #c9b8ff; }
[data-theme="dark"] .hdr-games:hover, [data-theme="dark"] .hdr-games.on { border-color: #8b5cf6; background: #352c52; color: #ddd2ff; }
@media (max-width: 720px) { .hdr-games { width: 38px; padding: 0; justify-content: center; } .hdr-games span { display: none; } }

.apps-panel {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 45; width: min(440px, calc(100vw - 24px)); padding: 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 20px 50px rgb(0 0 0 / .2);
  animation: apps-in .16s ease-out;
}
@keyframes apps-in { from { transform: translateY(-6px); opacity: 0; } to { transform: none; opacity: 1; } }
.apps-head { display: none; }
.apps-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
.app-tile {
  display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 10px 4px 8px; border-radius: 14px;
  color: var(--text); text-decoration: none; text-align: center; font-size: .78rem; line-height: 1.25; transition: background .15s;
}
.app-tile:hover, .app-tile.active { background: var(--surface-2); }
.app-tile.active .app-name { font-weight: 600; }
.app-ico { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 13px; transition: transform .15s; }
.app-tile:hover .app-ico { transform: translateY(-2px) scale(1.04); }
.app-ico .icon { width: 22px; height: 22px; }
.app-name { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.g-files .app-ico { background: #fde2e0; color: #c2362f; }
.g-calc .app-ico { background: #dbeafe; color: #1d4ed8; }
.g-fun .app-ico { background: #d5f5ec; color: #0f766e; }
.g-general .app-ico { background: #ede9fe; color: #6d28d9; }
[data-theme="dark"] .g-files .app-ico { background: #3a1f1c; color: #ff9b93; }
[data-theme="dark"] .g-calc .app-ico { background: #1c2840; color: #93c5fd; }
[data-theme="dark"] .g-fun .app-ico { background: #14302b; color: #5eead4; }
[data-theme="dark"] .g-general .app-ico { background: #2b2440; color: #c4b5fd; }
.apps-foot { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--line); }
.apps-foot a, .theme-toggle-row {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line);
  background: none; color: var(--text); font: inherit; font-size: .85rem; text-decoration: none; cursor: pointer;
}
.apps-foot a:hover, .theme-toggle-row:hover { border-color: var(--accent); color: var(--accent); }
.apps-foot .icon, .theme-toggle-row .icon { width: 16px; height: 16px; }
.dropdown .theme-toggle-row { display: none; }
.apps-backdrop { position: fixed; inset: 0; z-index: 35; background: rgb(0 0 0 / .22); }
.tabbar { display: none; }

@media (max-width: 1100px) {
  .gs-kbd { display: none; }
  .header-right .btn-gold .lbl { display: none; }
  .header-right .btn-gold { padding: 7px 10px; }
}
@media (max-width: 900px) {
  .user-menu .name { display: none; }
  .header-right .login { display: none; }
}
@media (max-width: 720px) {
  .site-header .container { height: 58px; gap: 8px; }
  .gsearch { display: none; }
  .gsearch.open { display: block; position: absolute; left: 12px; right: 12px; top: 7px; max-width: none; margin: 0; z-index: 46; }
  .gsearch.open .gs-close {
    display: inline-grid; place-items: center; flex: none; width: 32px; height: 32px; padding: 0;
    border: 0; background: none; color: var(--muted); cursor: pointer;
  }
  .gs-open { display: inline-grid; }
  .hdr-hide-m { display: none !important; }
  .header-right { gap: 6px; }
  .dropdown .theme-toggle-row { display: flex; width: 100%; border: 0; border-radius: 8px; padding: 8px 10px; }
  /* the apps panel becomes a bottom sheet above the tab bar */
  .apps-panel {
    position: fixed; left: 0; right: 0; top: auto; bottom: 0; width: auto; max-height: 82vh; overflow: auto;
    border-radius: 22px 22px 0 0; padding: 14px 14px calc(80px + env(safe-area-inset-bottom)); animation: sheet-up .22s ease-out;
  }
  @keyframes sheet-up { from { transform: translateY(30%); opacity: .4; } to { transform: none; opacity: 1; } }
  .apps-head { display: flex; align-items: center; justify-content: space-between; margin: 0 4px 8px; font-weight: 600; }
  .tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; display: grid; grid-template-columns: repeat(5, 1fr);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: saturate(1.4) blur(12px);
    border-top: 1px solid var(--line);
  }
  .tabbar a, .tabbar button {
    display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 4px 0; border: 0; background: none;
    color: var(--muted); font: inherit; font-size: .68rem; text-decoration: none; cursor: pointer;
  }
  .tabbar .icon { width: 22px; height: 22px; }
  .tabbar .on { color: var(--accent); font-weight: 600; }
  .tabbar .gold { color: var(--gold); }
  body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
}

/* QR Code | barcode switcher (qr_generator/_switch.html) */
.code-switch { display: inline-flex; gap: 4px; padding: 4px; margin: 0 0 16px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.code-switch a { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 999px; color: var(--muted); font-weight: 600; text-decoration: none; }
.code-switch a .icon { width: 18px; height: 18px; }
.code-switch a:hover { color: var(--text); }
.code-switch a.on { background: var(--accent); color: var(--accent-ink); }
