/* OPTIMAL SPOON — watercolour paper styling, palette from Meowniversity (game/scripts/palette.gd). */

@font-face {
  font-family: "Nunito";
  src: url("../fonts/nunito-latin.woff2") format("woff2");
  font-weight: 200 1000;
  font-style: normal;
  font-display: swap;
}
@font-face { font-family: "WenKai SC"; src: url("../fonts/wenkai-sc.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "WenKai TC"; src: url("../fonts/wenkai-tc.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "WenKai JA"; src: url("../fonts/wenkai-ja.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "WenKai KO"; src: url("../fonts/wenkai-ko.woff2") format("woff2"); font-display: swap; }

:root {
  color-scheme: light;
  --paper: #f8f1e4;
  --paper-hi: #fffcf6;
  --paper-lo: #f0e5d1;
  --ink: #3b3129;
  --ink-soft: #66574a;
  --ink-faint: #8c7c6c;
  --line: rgba(110, 84, 58, 0.16);
  --line-strong: rgba(110, 84, 58, 0.3);
  --red: #f4a4c1;
  --yellow: #fadc78;
  --blue: #a4d9f4;
  --orange: #feca7b;
  --purple: #d3a4f4;
  --green: #b3f588;
  --blue-ink: #2a668f;
  --rose-ink: #a23f69;
  --gold-ink: #7e5a0c;
  --green-ink: #3b6e2a;
  --purple-ink: #6b47a0;
  --radius: 22px;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset, 0 18px 40px -26px rgba(90, 60, 30, 0.45);
  --shadow-pop: 0 18px 44px -18px rgba(70, 48, 26, 0.5);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .42 0 0 0 0 .32 0 0 0 0 .22 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --brush: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 24' preserveAspectRatio='none'%3E%3Cpath d='M3 14c22-6 52-9 92-8 38 1 70 2 102-1 2 3 0 7-4 8-38 4-70 2-104 3-30 0-58 2-84 5-3 0-5-5-2-7z' fill='%23FADC78' fill-opacity='.75'/%3E%3C/svg%3E");
}

/* Page text uses the game's LXGW WenKai (subset per language). Typing areas use the system
   CJK font instead, so characters outside the subset never mix two typefaces. */
:root { --font-input: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
html:lang(zh-CN) { --font: "Nunito", "WenKai SC", "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif; --font-input: "Nunito", "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif; }
html:lang(zh-TW) { --font: "Nunito", "WenKai TC", "PingFang TC", "Microsoft JhengHei", "Noto Sans CJK TC", sans-serif; --font-input: "Nunito", "PingFang TC", "Microsoft JhengHei", "Noto Sans CJK TC", sans-serif; }
html:lang(ja) { --font: "Nunito", "WenKai JA", "Hiragino Sans", "Yu Gothic", "Noto Sans CJK JP", sans-serif; --font-input: "Nunito", "Hiragino Sans", "Yu Gothic UI", "Meiryo", "Noto Sans CJK JP", sans-serif; }
html:lang(ko) { --font: "Nunito", "WenKai KO", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans CJK KR", sans-serif; --font-input: "Nunito", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans CJK KR", sans-serif; }

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
/* While a non-English language pack loads, hide the English text (never longer than 1.5 s). */
html.i18n-loading body { visibility: hidden; animation: i18n-reveal 0s linear 1.5s forwards; }
@keyframes i18n-reveal { to { visibility: visible; } }
html { scroll-behavior: smooth; scroll-padding-top: 84px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--ink);
  background-color: var(--paper);
  background-image: var(--grain);
  overflow-x: hidden;
}
img, video { max-width: 100%; display: block; }
a { color: var(--blue-ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
button, input, select { font: inherit; color: inherit; }
input, .editor { font-family: var(--font-input); }
:focus-visible { outline: 3px solid var(--blue-ink); outline-offset: 3px; border-radius: 8px; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0; font-weight: 800; letter-spacing: -0.01em; }
p { margin: 0; }
kbd {
  font: 800 0.72em/1 var(--font);
  padding: 0.22em 0.45em 0.26em;
  border-radius: 6px;
  background: #fff;
  border: 1px solid var(--line-strong);
  box-shadow: 0 1px 0 var(--line-strong);
  white-space: nowrap;
}
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 200;
  background: var(--paper-hi); padding: 8px 14px; border-radius: 10px; box-shadow: var(--shadow-pop);
}
.skip-link:focus { top: 12px; }
.wrap { width: min(1180px, calc(100% - 40px)); margin-inline: auto; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5em;
  padding: 0.72em 1.35em; border-radius: 999px;
  font-weight: 800; font-size: 1rem; line-height: 1.1; text-decoration: none; cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), background-color 0.2s;
}
.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn:active { transform: translateY(0); }
.btn-primary {
  color: var(--ink);
  background: linear-gradient(180deg, #fde9a2, #f8d25f);
  border-color: #e2bd52;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset, 0 10px 22px -12px rgba(170, 120, 20, 0.7);
}
.btn-ghost {
  color: var(--ink);
  background: rgba(255, 252, 246, 0.86);
  border-color: var(--line-strong);
}
.btn-small { padding: 0.48em 0.95em; font-size: 0.88rem; }
.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px;
  border-radius: 12px; border: 1px solid var(--line-strong); background: var(--paper-hi);
  cursor: pointer; color: var(--ink); transition: background-color 0.2s;
}
.icon-btn:hover { background: #fff; }
.icon-btn svg, .btn svg { width: 18px; height: 18px; flex: none; }

/* Header */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(248, 241, 228, 0.86);
  backdrop-filter: blur(10px) saturate(1.2);
  -webkit-backdrop-filter: blur(10px) saturate(1.2);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s, box-shadow 0.3s;
}
.topbar.is-scrolled { border-bottom-color: var(--line); box-shadow: 0 8px 24px -22px rgba(70, 48, 26, 0.6); }
.topbar-inner { display: flex; align-items: center; gap: 18px; min-height: 66px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; flex: none; }
.brand img { width: 48px; height: 48px; filter: drop-shadow(0 1px 1.5px rgba(90, 60, 30, 0.28)); }
.brand-word { font-weight: 900; letter-spacing: 0.08em; font-size: 1.02rem; }
.topnav { display: flex; gap: 4px; margin-left: auto; }
.topnav a {
  color: var(--ink-soft); text-decoration: none; font-weight: 700; font-size: 0.95rem;
  padding: 0.45em 0.8em; border-radius: 999px; white-space: nowrap;
}
.topnav a:hover, .topnav a[aria-current="page"] { color: var(--ink); background: rgba(250, 220, 120, 0.38); }
.lang-picker {
  position: relative; display: inline-flex; align-items: center; flex: none;
  border: 1px solid var(--line-strong); border-radius: 999px; background: var(--paper-hi);
}
.lang-picker svg { position: absolute; left: 11px; width: 17px; height: 17px; pointer-events: none; color: var(--ink-soft); }
.lang-picker select {
  appearance: none; -webkit-appearance: none; border: 0; background: transparent;
  padding: 0.5em 2em 0.5em 2.2em; font-weight: 700; font-size: 0.92rem; cursor: pointer; border-radius: 999px;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}
.lang-picker::after {
  content: ""; position: absolute; right: 13px; top: 50%; width: 7px; height: 7px; margin-top: -5px;
  border-right: 2px solid var(--ink-soft); border-bottom: 2px solid var(--ink-soft); transform: rotate(45deg); pointer-events: none;
}

/* Hero */
.hero {
  position: relative; isolation: isolate; overflow: hidden;
  min-height: min(84vh, 760px); display: grid; place-items: center; text-align: center;
  padding: 72px 0 120px;
}
.hero-art {
  position: absolute; inset: 0; z-index: -1;
  background:
    linear-gradient(180deg, rgba(248, 241, 228, 0.1) 0%, rgba(248, 241, 228, 0.2) 52%, var(--paper) 98%),
    url("../img/hero-campus.webp") center 38% / cover no-repeat;
}
.hero-inner { max-width: 860px; padding: 0 20px; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 8px; margin-bottom: 22px;
  padding: 0.42em 1em; border-radius: 999px; font-weight: 800; font-size: 0.86rem; letter-spacing: 0.04em;
  background: rgba(255, 252, 246, 0.82); border: 1px solid var(--line); color: var(--ink-soft);
}
.hero-badge i { width: 8px; height: 8px; border-radius: 50%; background: #6fbf4a; box-shadow: 0 0 0 4px rgba(179, 245, 136, 0.55); }
.hero-title { font-size: clamp(2.3rem, 6vw, 4.6rem); font-weight: 900; line-height: 1.06; text-wrap: balance; }
.hero-brand { display: block; letter-spacing: 0.05em; }
.hero-rest {
  display: inline; font-weight: 800; font-size: 0.62em; letter-spacing: 0;
  background: var(--brush) no-repeat 0 92% / 100% 0.5em; padding: 0 0.12em;
  box-decoration-break: clone; -webkit-box-decoration-break: clone;
}
.hero-sub { margin-top: 20px; font-size: clamp(1.05rem, 2.2vw, 1.3rem); font-weight: 700; color: var(--ink-soft); letter-spacing: 0.02em; }
.hero-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 34px; }

/* Sections */
.section { position: relative; padding: 84px 0; }
.section-head { max-width: 760px; margin-bottom: 40px; }
.eyebrow { font-weight: 900; font-size: 0.82rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--rose-ink); margin-bottom: 10px; }
.section-head h2 { font-size: clamp(1.9rem, 4vw, 2.8rem); }
.section-head h2 span, .brushed {
  background: var(--brush) no-repeat 0 92% / 100% 0.42em; padding: 0 0.1em;
  box-decoration-break: clone; -webkit-box-decoration-break: clone;
}
.lead { margin-top: 14px; font-size: 1.12rem; color: var(--ink-soft); }

.project {
  position: relative; background: rgba(255, 252, 246, 0.72); border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 8px); padding: clamp(20px, 3.4vw, 38px); box-shadow: var(--shadow);
}
.project + .project { margin-top: 36px; }
.project::before {
  content: ""; position: absolute; z-index: -1; inset: -40px -30px auto auto; width: 360px; height: 260px;
  background: radial-gradient(closest-side, rgba(164, 217, 244, 0.45), transparent); filter: blur(6px); pointer-events: none;
}
#meowniversity::before { background: radial-gradient(closest-side, rgba(244, 164, 193, 0.4), transparent); }
.project-head { display: flex; gap: 18px; align-items: flex-start; margin-bottom: 26px; }
.project-num {
  flex: none; display: grid; place-items: center; width: 56px; height: 56px; border-radius: 18px;
  font-weight: 900; font-size: 1.25rem; color: var(--blue-ink);
  background: linear-gradient(160deg, #e9f6fd, #c7e8f8); border: 1px solid #a4d9f4;
}
.project-icon { flex: none; width: 64px; height: 64px; border-radius: 18px; box-shadow: 0 10px 20px -12px rgba(80, 55, 30, 0.6); }
.project-kind { font-weight: 800; font-size: 0.82rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-faint); }
.project-head h3 { font-size: clamp(1.45rem, 3vw, 2rem); margin-top: 4px; }
.project-desc { margin-top: 8px; color: var(--ink-soft); max-width: 70ch; }
.status {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 12px; padding: 0.25em 0.75em;
  border-radius: 999px; font-size: 0.82rem; font-weight: 800; background: #edfbe3; color: var(--green-ink); border: 1px solid #c5ecab;
}

/* Tag demo */
.tag-demo { display: grid; grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr); gap: 20px; align-items: start; }
.demo-box {
  background: var(--paper-hi); border: 1px solid var(--line-strong); border-radius: var(--radius);
  padding: 18px; min-width: 0; box-shadow: 0 14px 30px -26px rgba(70, 48, 26, 0.7);
}
.box-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.box-head h4 { font-size: 1.12rem; }
.box-sub { font-size: 0.82rem; font-weight: 700; color: var(--ink-faint); }
.box-tools { display: flex; gap: 8px; margin-left: auto; align-items: center; }
.guide-btn { position: relative; }
.guide-btn .dot {
  position: absolute; top: -3px; right: -3px; width: 11px; height: 11px; border-radius: 50%;
  background: #f07aa5; border: 2px solid var(--paper-hi); animation: pulse 1.8s infinite;
}
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.35); } }

.tag-list { display: grid; gap: 12px; }
.tag-card { border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; background: rgba(248, 241, 228, 0.45); }
.tag-card.is-new { animation: newtag 1.4s var(--ease); }
@keyframes newtag { 0% { box-shadow: 0 0 0 0 rgba(250, 220, 120, 0.9); } 100% { box-shadow: 0 0 0 14px rgba(250, 220, 120, 0); } }
.tag-card-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tag-count { font-size: 0.8rem; font-weight: 700; color: var(--ink-faint); }
.tag-remove { margin-left: auto; width: 28px; height: 28px; border-radius: 9px; border: 1px solid var(--line); background: #fff; cursor: pointer; color: var(--ink-soft); }
.tag-chip {
  display: inline-flex; align-items: center; gap: 0.3em; max-width: 100%;
  padding: 0.28em 0.78em; border-radius: 999px; border: 1px solid; cursor: pointer;
  font-weight: 800; font-size: 0.92rem; line-height: 1.3; text-align: left;
  transition: transform 0.15s var(--ease), box-shadow 0.15s;
}
.tag-chip:hover { transform: translateY(-1px); box-shadow: 0 6px 12px -8px rgba(40, 80, 110, 0.7); }
.tag-chip .hash { opacity: 0.6; font-weight: 900; }
.tag-chip.is-common { background: #e5f4fc; border-color: #a4d9f4; color: #1f5677; }
.tag-chip.is-mine { background: #fdf1c7; border-color: #ecc95a; color: #6e4f0a; }
.tag-points { margin: 10px 0 0; padding-left: 1.4em; display: grid; gap: 6px; font-size: 0.93rem; color: var(--ink-soft); }
.tag-points li::marker { color: var(--ink-faint); font-weight: 800; }
.wordings { display: inline-block; margin-left: 6px; font-size: 0.74rem; font-weight: 800; color: var(--blue-ink); background: #e5f4fc; border-radius: 999px; padding: 0 0.55em; }
.mine-head { margin: 18px 0 10px; font-weight: 800; font-size: 0.9rem; display: flex; align-items: center; gap: 8px; }
.mine-empty { font-size: 0.9rem; color: var(--ink-faint); border: 1px dashed var(--line-strong); border-radius: 14px; padding: 10px 12px; }

.editor-wrap { position: relative; }
.editor {
  min-height: 300px; padding: 18px 20px; border-radius: 16px; outline: none;
  background:
    repeating-linear-gradient(180deg, transparent 0 calc(1.9em - 1px), rgba(164, 217, 244, 0.28) calc(1.9em - 1px) 1.9em) 0 18px / 100% calc(100% - 36px) no-repeat,
    #fffdf9;
  border: 1px solid var(--line-strong); line-height: 1.9; font-size: 1.04rem;
  overflow-wrap: anywhere; white-space: pre-wrap; caret-color: var(--rose-ink);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.editor:focus { border-color: #8ccbea; box-shadow: 0 0 0 4px rgba(164, 217, 244, 0.35); }
.editor.is-empty::before { content: attr(data-placeholder); color: var(--ink-faint); pointer-events: none; }
.editor mark.tag-mark { color: inherit; border-radius: 0.35em; padding: 0.06em 0.1em; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
mark.tag-mark.is-common { background: rgba(164, 217, 244, 0.62); box-shadow: inset 0 -2px 0 rgba(42, 102, 143, 0.22); }
mark.tag-mark.is-mine { background: rgba(250, 220, 120, 0.68); box-shadow: inset 0 -2px 0 rgba(126, 90, 12, 0.2); }
mark.tag-mark.is-fresh { animation: fresh 1.2s var(--ease); }
@keyframes fresh { 0% { background-color: rgba(254, 202, 123, 0.95); } }
.demo-hint { margin-top: 12px; font-size: 0.86rem; line-height: 2; color: var(--ink-soft); }
.demo-hint kbd { margin: 0 1px; }
.demo-nudge { font-weight: 800; font-size: 0.92rem; }
.demo-note { margin-top: 8px; font-size: 0.8rem; color: var(--ink-faint); display: flex; align-items: center; gap: 6px; }
.demo-status { min-height: 1.4em; margin-top: 6px; font-size: 0.88rem; font-weight: 700; color: var(--green-ink); }

.caret-bar {
  position: absolute; z-index: 20; display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  max-width: calc(100% - 16px); padding: 6px; border-radius: 14px;
  background: rgba(255, 253, 248, 0.98); border: 1px solid var(--line-strong); box-shadow: var(--shadow-pop);
  animation: pop 0.18s var(--ease);
}
.caret-bar .tag-chip { font-size: 0.88rem; }
.caret-bar kbd { margin-left: 0.3em; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } }
.palette {
  position: absolute; z-index: 25; width: min(560px, calc(100% - 16px)); overflow: hidden;
  border-radius: 16px; background: #fffdf8; border: 1px solid var(--line-strong); box-shadow: var(--shadow-pop);
  animation: pop 0.2s var(--ease);
}
.palette-head { display: flex; align-items: center; gap: 10px; padding: 9px 10px 9px 12px; background: #f8f1e4; border-bottom: 1px solid var(--line); }
.palette-title { display: inline-flex; align-items: baseline; gap: 8px; font-weight: 800; min-width: 0; flex: none; max-width: 60%; }
.palette-title .tag-chip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-title small { font-weight: 700; color: var(--ink-faint); font-size: 0.78rem; white-space: nowrap; }
.palette-hint { margin-left: auto; min-width: 0; font-size: 0.72rem; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.palette-close { flex: none; margin-left: auto; width: 30px; height: 30px; border-radius: 9px; border: 1px solid var(--line); background: #fff; cursor: pointer; line-height: 1; font-size: 1.1rem; }
.palette-hint + .palette-close { margin-left: 0; }
.palette-search { display: flex; align-items: center; gap: 8px; flex: 1 1 220px; background: #fff; border: 1px solid var(--line-strong); border-radius: 10px; padding: 0 10px; }
.palette-search svg { width: 16px; height: 16px; color: var(--ink-faint); flex: none; }
.palette-search input { border: 0; outline: none; background: transparent; padding: 0.5em 0; width: 100%; min-width: 0; }
.palette-options { position: relative; max-height: 280px; overflow: auto; padding: 6px; display: grid; gap: 4px; }
.palette-option { display: flex; align-items: flex-start; gap: 6px; border-radius: 12px; padding: 2px; }
.palette-option.is-selected { background: #e8f5fc; box-shadow: inset 0 0 0 1.5px #a4d9f4; }
.palette-text { flex: 1; min-width: 0; text-align: left; background: none; border: 0; padding: 8px 10px; line-height: 1.5; cursor: pointer; border-radius: 10px; }
.palette-text small { display: inline-block; margin-bottom: 2px; font-weight: 800; font-size: 0.72rem; border-radius: 999px; padding: 0 0.6em; }
.palette-text small.is-common { background: #e5f4fc; color: #1f5677; }
.palette-text small.is-mine { background: #fdf1c7; color: #6e4f0a; }
.palette-text span { display: block; }
.palette-variants { display: flex; align-items: center; gap: 3px; padding: 8px 6px 0 0; font-size: 0.74rem; color: var(--ink-soft); white-space: nowrap; }
.palette-variants button { width: 26px; height: 26px; border-radius: 8px; border: 1px solid var(--line); background: #fff; cursor: pointer; line-height: 1; }
.palette-variants button:disabled { opacity: 0.35; cursor: default; }
.palette-empty { padding: 14px; color: var(--ink-faint); font-size: 0.92rem; }
.palette-foot { padding: 6px 12px 9px; font-size: 0.74rem; color: var(--ink-soft); border-top: 1px solid var(--line); }
.mark-bar {
  position: absolute; z-index: 24; display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  max-width: calc(100% - 16px); padding: 9px 10px; border-radius: 14px;
  background: #fffdf8; border: 1px solid var(--line-strong); box-shadow: var(--shadow-pop); animation: pop 0.18s var(--ease);
}
.mark-bar label { font-weight: 800; font-size: 0.86rem; }
.mark-bar input { width: 12em; max-width: 100%; padding: 0.42em 0.7em; border-radius: 10px; border: 1px solid var(--line-strong); background: #fff; }
.mark-bar .mark-names { display: flex; flex-wrap: wrap; gap: 6px; width: 100%; }
.mark-bar .mark-names .tag-chip { font-size: 0.8rem; padding: 0.18em 0.6em; }

/* Guided tour */
.tour-layer { position: fixed; inset: 0; z-index: 120; pointer-events: none; }
.tour-spot {
  position: fixed; border-radius: 18px; pointer-events: none;
  box-shadow: 0 0 0 200vmax rgba(52, 42, 34, 0.4);
  outline: 3px solid rgba(250, 220, 120, 0.95); outline-offset: 2px;
  transition: left 0.35s var(--ease), top 0.35s var(--ease), width 0.35s var(--ease), height 0.35s var(--ease);
}
.tour-spot.is-empty { outline: 0; width: 0 !important; height: 0 !important; left: 50% !important; top: 50% !important; }
.tour-card {
  position: fixed; width: min(370px, calc(100vw - 24px)); pointer-events: auto;
  background: #fffdf8; border: 1px solid var(--line-strong); border-radius: 18px;
  box-shadow: 0 26px 54px -22px rgba(40, 28, 18, 0.6); padding: 14px 16px 14px;
  transition: left 0.35s var(--ease), top 0.35s var(--ease);
}
.tour-card.is-docked { left: 12px !important; right: 12px; top: auto !important; bottom: 12px; width: auto; }
.tour-progress { height: 4px; border-radius: 4px; background: var(--paper-lo); overflow: hidden; }
.tour-progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--yellow), var(--orange)); transition: width 0.35s var(--ease); }
.tour-top { display: flex; align-items: center; justify-content: space-between; margin: 10px 0 4px; }
.tour-count { font-size: 0.78rem; font-weight: 800; color: var(--ink-faint); letter-spacing: 0.06em; }
.tour-card h4 { font-size: 1.12rem; }
.tour-card p { margin-top: 6px; color: var(--ink-soft); }
.tour-actions { display: flex; gap: 8px; margin-top: 14px; justify-content: flex-end; flex-wrap: wrap; }
.tour-actions .btn[hidden] { display: none; }
.tour-actions .is-ready { animation: ready 1.2s infinite; }
@keyframes ready { 50% { box-shadow: 0 0 0 6px rgba(250, 220, 120, 0.55); } }

/* Meowniversity */
.shots { display: grid; grid-template-columns: 1.7fr 1fr 1fr; gap: 12px; margin-bottom: 30px; }
.shot {
  position: relative; padding: 0; border: 0; border-radius: 16px; overflow: hidden; cursor: zoom-in;
  background: var(--paper-lo); box-shadow: 0 12px 26px -20px rgba(70, 48, 26, 0.75); aspect-ratio: 16 / 9;
}
.shot:first-child { grid-row: span 2; aspect-ratio: auto; }
.shot img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s var(--ease); }
.shot:hover img { transform: scale(1.03); }
.shot figcaption, .shot .shot-cap {
  position: absolute; left: 8px; bottom: 8px; max-width: calc(100% - 16px);
  padding: 0.2em 0.7em; border-radius: 999px; font-size: 0.78rem; font-weight: 800; text-align: left;
  background: rgba(255, 252, 246, 0.9); color: var(--ink);
}
.lab { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.lab-title { font-size: 1.3rem; margin-bottom: 4px; }
.lab-desc { color: var(--ink-soft); font-size: 0.95rem; margin-bottom: 16px; }
.lab-stage {
  position: relative; aspect-ratio: 2 / 1; border-radius: 20px; overflow: hidden;
  background: #efe3cc center / cover no-repeat; border: 1px solid var(--line-strong); box-shadow: var(--shadow);
}
.lab-stage video { width: 100%; height: 100%; object-fit: cover; }
.lab-caption {
  position: absolute; left: 10px; top: 10px; max-width: calc(100% - 20px);
  padding: 0.3em 0.85em; border-radius: 999px; font-weight: 800; font-size: 0.86rem;
  background: rgba(255, 252, 246, 0.9); box-shadow: 0 6px 16px -10px rgba(70, 48, 26, 0.6);
}
.lab-play { position: absolute; right: 12px; bottom: 12px; }
.lab-play[hidden] { display: none; }
.lab-credit { margin-top: 8px; font-size: 0.8rem; color: var(--ink-faint); }
.lab-controls h4 { font-size: 0.95rem; margin: 0 0 10px; }
.lab-controls h4 + * { margin-bottom: 20px; }
.cat-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.cat-pick {
  display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 0;
  padding: 5px 2px 3px; border-radius: 14px; border: 1.5px solid transparent; background: rgba(255, 252, 246, 0.75); cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s;
}
.cat-pick img { width: 100%; max-width: 58px; aspect-ratio: 168 / 150; object-fit: contain; transition: transform 0.25s var(--ease); }
.cat-pick:hover img { transform: translateY(-2px) rotate(-4deg); }
.cat-pick[aria-checked="true"] { border-color: #ecc95a; background: #fdf3cf; box-shadow: 0 8px 16px -10px rgba(160, 120, 30, 0.7); }
.cat-name { max-width: 100%; font-size: 0.7rem; font-weight: 800; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fruit-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.fruit-pick {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px 6px; min-width: 0;
  border-radius: 16px; border: 1.5px solid var(--line); background: rgba(255, 252, 246, 0.8); cursor: pointer; font-weight: 800; font-size: 0.86rem;
}
.fruit-pick img { width: 54px; height: 54px; transition: transform 0.25s var(--ease); }
.fruit-pick:hover img { transform: translateY(-3px) scale(1.05); }
.fruit-pick[aria-checked="true"][data-fruit="strawberry"] { border-color: var(--red); background: #fdeaf1; }
.fruit-pick[aria-checked="true"][data-fruit="blueberry"] { border-color: var(--blue); background: #e8f5fc; }
.fruit-pick[aria-checked="true"][data-fruit="pineapple"] { border-color: #ecc95a; background: #fdf3cf; }

/* Contact */
.contact-card {
  display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 28px; align-items: center;
  background:
    radial-gradient(closest-side at 15% 20%, rgba(250, 220, 120, 0.45), transparent),
    radial-gradient(closest-side at 90% 90%, rgba(211, 164, 244, 0.35), transparent),
    var(--paper-hi);
  border: 1px solid var(--line); border-radius: calc(var(--radius) + 8px); padding: clamp(22px, 4vw, 44px); box-shadow: var(--shadow);
}
.contact-card h2 { font-size: clamp(1.7rem, 3.4vw, 2.4rem); }
.contact-card .lead { margin-top: 10px; }
.contact-card .btn { margin-top: 22px; }
.facts { margin: 0; display: grid; gap: 12px; padding: 18px 20px; border-radius: 18px; background: rgba(248, 241, 228, 0.7); border: 1px solid var(--line); }
.facts div { display: grid; grid-template-columns: 8.5em 1fr; gap: 10px; }
.facts dt { font-weight: 800; color: var(--ink-faint); font-size: 0.86rem; padding-top: 2px; }
.facts dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }

/* Footer */
.site-footer { margin-top: 40px; padding: 34px 0 40px; background: rgba(240, 229, 209, 0.65); border-top: 1px solid var(--line); font-size: 0.9rem; color: var(--ink-soft); }
.footer-inner { display: flex; flex-wrap: wrap; gap: 14px 28px; align-items: center; justify-content: space-between; }
.footer-links { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.footer-links a { color: var(--ink-soft); font-weight: 700; }
.footer-brand { display: flex; align-items: center; gap: 10px; font-weight: 800; color: var(--ink); }
.footer-brand img { width: 32px; height: 32px; }
.footer-legal { width: 100%; font-size: 0.82rem; color: var(--ink-faint); }

/* Legal and support pages */
.page-hero { padding: 58px 0 18px; }
.page-hero h1 { font-size: clamp(2rem, 4.6vw, 3rem); }
.page-hero p { margin-top: 10px; color: var(--ink-soft); }
.prose {
  max-width: 820px; background: rgba(255, 252, 246, 0.78); border: 1px solid var(--line); border-radius: calc(var(--radius) + 4px);
  padding: clamp(20px, 4vw, 44px); box-shadow: var(--shadow); margin-bottom: 30px;
}
.prose h2 { font-size: 1.32rem; margin: 30px 0 10px; }
.prose h2:first-child { margin-top: 0; }
.prose h3 { font-size: 1.08rem; margin: 20px 0 6px; }
.prose p, .prose ul, .prose ol { margin: 0 0 12px; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin: 4px 0; }
.prose .callout { padding: 14px 18px; border-radius: 16px; background: #edfbe3; border: 1px solid #c5ecab; margin: 0 0 18px; }
.prose .note { font-size: 0.9rem; color: var(--ink-faint); }
.prose details { border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px; background: var(--paper-hi); margin: 0 0 10px; }
.prose summary { font-weight: 800; cursor: pointer; }
.prose details[open] summary { margin-bottom: 8px; }

/* Lightbox */
.lightbox { border: 0; padding: 0; background: transparent; max-width: min(1280px, 94vw); width: 100%; }
.lightbox::backdrop { background: rgba(40, 30, 22, 0.78); }
.lightbox figure { margin: 0; }
.lightbox img { width: 100%; border-radius: 14px; box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.6); }
.lightbox figcaption { margin-top: 10px; color: #fff8ec; font-weight: 700; text-align: center; }
.lightbox-close, .lightbox-nav {
  position: fixed; z-index: 2; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  border: 0; background: rgba(255, 252, 246, 0.92); cursor: pointer; font-size: 1.4rem; line-height: 1; color: var(--ink);
}
.lightbox-close { top: 16px; right: 16px; }
.lightbox-nav.prev { left: 16px; top: 50%; }
.lightbox-nav.next { right: 16px; top: 50%; }

/* Responsive */
@media (max-width: 980px) {
  .tag-demo, .lab, .contact-card { grid-template-columns: minmax(0, 1fr); }
  .lab-controls { order: 2; }
}
@media (max-width: 760px) {
  body { font-size: 1rem; }
  .wrap { width: calc(100% - 32px); }
  .topbar-inner { flex-wrap: wrap; gap: 8px 12px; min-height: 0; padding: 10px 0 8px; }
  .lang-picker { margin-left: auto; }
  .topnav { order: 3; width: 100%; margin: 0 -4px; overflow-x: auto; scrollbar-width: none; }
  .topnav::-webkit-scrollbar { display: none; }
  .topnav a { font-size: 0.88rem; padding: 0.35em 0.7em; }
  .hero { min-height: 0; padding: 64px 0 88px; }
  .hero-art { background-image: linear-gradient(180deg, rgba(248, 241, 228, 0.15) 0%, rgba(248, 241, 228, 0.35) 50%, var(--paper) 98%), url("../img/hero-campus-sm.webp"); }
  .section { padding: 60px 0; }
  .project-head { gap: 12px; }
  .project-num { width: 44px; height: 44px; border-radius: 14px; font-size: 1.05rem; }
  .project-icon { width: 52px; height: 52px; }
  .demo-box { padding: 14px; }
  .editor { min-height: 240px; padding: 14px 15px; }
  .shots { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 10px; padding-bottom: 6px; margin-inline: -4px; }
  .shot, .shot:first-child { flex: 0 0 84%; aspect-ratio: 16 / 9; scroll-snap-align: center; }
  .cat-name { display: none; }
  .facts div { grid-template-columns: 1fr; gap: 0; }
  .palette-hint { display: none; }
  .project-head { flex-direction: column; gap: 10px; }
  .tag-points { font-size: 0.9rem; }
  .lab-play { padding: 0.5em 1em; font-size: 0.9rem; right: 8px; bottom: 8px; }
  .lab-caption { font-size: 0.78rem; left: 8px; top: 8px; }
}
@media (hover: none) {
  .demo-hint .keys, .caret-bar kbd { display: none; }
}
@media (hover: hover) {
  .demo-hint .touch { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* Safety Warning Evidence — feature list and an interactive copy of the app's one-button screen.
   Colours follow the app (#101010 screen, #E53935 button). The web preview never flashes. */
#safety::before { background: radial-gradient(closest-side, rgba(244, 164, 193, 0.42), transparent); }
.safety { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 30px; align-items: center; }
.safety-features { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.safety-features li {
  display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 16px;
  background: var(--paper-hi); border: 1px solid var(--line); color: var(--ink-soft);
}
.safety-features .fi {
  flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px;
  font-size: 1.1rem; background: #fdeaf1; border: 1px solid #f6c3d6;
}
.phone-wrap { display: grid; justify-items: center; }
.phone {
  width: min(300px, 100%); padding: 11px; border-radius: 40px;
  background: linear-gradient(160deg, #3a332e, #1d1916); box-shadow: 0 26px 50px -24px rgba(40, 26, 14, 0.75), inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}
.phone-screen {
  position: relative; min-height: 560px; border-radius: 30px; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 30px 16px 18px;
  background: #101010; color: #fff; text-align: center;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans", "Microsoft YaHei", "Malgun Gothic", sans-serif;
}
.phone-screen::before { content: ""; position: absolute; top: 10px; left: 50%; width: 76px; height: 7px; margin-left: -38px; border-radius: 999px; background: #262626; }
.phone-title { font-weight: 800; font-size: 1rem; letter-spacing: 0.01em; }
.phone-sub { font-size: 0.72rem; line-height: 1.45; color: #9e9e9e; }
.sos-btn {
  position: relative; display: grid; place-items: center; width: 150px; height: 150px; margin: 10px 0 4px; border: 0; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ff6f6a, #e53935 55%, #b71c1c); color: #fff; cursor: pointer;
  font: 900 1.45rem/1.15 system-ui, -apple-system, "Segoe UI", sans-serif; letter-spacing: 0.04em; white-space: pre-line;
  box-shadow: 0 0 0 12px rgba(229, 57, 53, 0.33), 0 16px 30px rgba(0, 0, 0, 0.55);
  touch-action: manipulation; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent;
  transition: background-color 0.2s, transform 0.12s;
}
.sos-btn:active { transform: scale(0.97); }
.sos-btn .sos-label { position: relative; z-index: 1; }
.sos-btn .hold-ring {
  position: absolute; inset: -14px; border-radius: 50%; pointer-events: none;
  background: conic-gradient(#ffb300 var(--p, 0%), transparent 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 6px), #000 calc(100% - 5px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 6px), #000 calc(100% - 5px));
}
.phone.is-on .sos-btn { background: #424242; font-size: 1.02rem; animation: sos-glow 2.4s ease-in-out infinite; }
@keyframes sos-glow { 50% { box-shadow: 0 0 0 16px rgba(229, 57, 53, 0.2), 0 16px 30px rgba(0, 0, 0, 0.55); } }
.phone-hint { min-height: 1.2em; font-size: 0.72rem; color: #ffb300; }
.phone-status { width: 100%; display: grid; gap: 6px; text-align: left; }
.phone-status p { padding: 6px 10px; border-radius: 10px; background: #1e1e1e; font-size: 0.72rem; line-height: 1.35; animation: pop 0.25s var(--ease); }
.phone-foot { margin-top: auto; font-size: 0.62rem; line-height: 1.45; color: #9e9e9e; }
.phone-note { margin-top: 12px; max-width: 300px; text-align: center; font-size: 0.82rem; color: var(--ink-faint); }
@media (max-width: 980px) {
  .safety { grid-template-columns: minmax(0, 1fr); }
}
