/* Mojiri / Malnori websites. One stylesheet for both sites; <html class="app-ja"> or "app-ko" picks
   the ground. Colours follow the app (github/Mojiri/Resources/Styles/MojiriColors.xaml): cream paper
   for Mojiri, the indigo paper of the Malnori icon (#D8DEEA) for Malnori, vermilion accent for both.
   Light and dark follow prefers-color-scheme. Fonts are self-hosted (no third-party requests). */

@font-face { font-family: "Nunito"; src: url("fonts/nunito-400.woff") format("woff"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Nunito"; src: url("fonts/nunito-700.woff") format("woff"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Nunito"; src: url("fonts/nunito-800.woff") format("woff"); font-weight: 800; font-display: swap; }
/* Only the few kana / Hangul glyphs this site shows (subset by tools/website/build_site.py). */
@font-face { font-family: "Native"; src: url("fonts/native-700.woff") format("woff"); font-weight: 400 900; font-display: swap; }

:root {
  color-scheme: light dark;
  --paper: #F6F1E7;         /* PaperLight */
  --paper-2: #EFE7D7;       /* WellLight */
  --surface: #FFFDF8;       /* SurfaceLight */
  --line: #E6DCC8;          /* LineLight */
  --text: #2B2A28;          /* TextLight */
  --text-soft: #5E5A52;     /* TextSoftLight */
  --accent: #E0573E;        /* AccentLight (vermilion) */
  --accent-deep: #B8432D;   /* AccentDeepLight: buttons, white text 5:1 */
  --accent-text: #A63B26;   /* AccentTextLight: links, 5.6:1 on paper */
  --accent-tint: #FCE3DC;
  --indigo: #5B6C8F;
  --indigo-tint: #E9ECF3;
  --sage-text: #4C5C46;
  --sage-tint: #E5EBE2;
  --gold-tint: #FAEFD3;
  --gold-text: #7A5A10;
  --tile: #FFFDF8;
  --tile-edge: #E2D6BF;
  --tile-text: #2B2A28;
  --on-accent: #FFFAF2;
  --shadow: 0 10px 28px rgba(60, 45, 20, .10);
  --phone-edge: #2B2A28;

  --font: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --native: "Native", "Hiragino Sans", "Apple SD Gothic Neo", "Noto Sans CJK JP", "Noto Sans KR", "Yu Gothic", "Malgun Gothic", sans-serif;
  --max: 1040px;
  --radius: 22px;
}
.app-ko {
  --paper: #E4E8F1;          /* lighter than the icon paper, so cards still stand out */
  --paper-2: #D8DEEA;        /* Malnori icon paper */
  --surface: #FAFBFD;
  --line: #CBD3E2;
  --text: #22262F;
  --text-soft: #4D5466;
  --tile-edge: #C9D1E0;
  --shadow: 0 10px 28px rgba(30, 40, 70, .12);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1A1917;        /* PaperDark */
    --paper-2: #221F1D;      /* WellDark */
    --surface: #252321;      /* SurfaceDark */
    --line: #36332F;
    --text: #F6F1E7;         /* TextDark */
    --text-soft: #CFC8BA;    /* TextSoftDark */
    --accent: #EA6A50;
    --accent-deep: #B8432D;
    --accent-text: #F29A86;  /* AccentTextDark */
    --accent-tint: #3A2620;
    --indigo: #8D9BBA;
    --indigo-tint: #2C3240;
    --sage-text: #CFDCC8;
    --sage-tint: #34402F;
    --gold-tint: #3A3020;
    --gold-text: #F2C85B;
    --tile: #F6F1E7;         /* tiles stay light in the dark theme, as in the app */
    --tile-edge: #BDB4A3;
    --shadow: 0 10px 28px rgba(0, 0, 0, .35);
    --phone-edge: #3A3733;
  }
  .app-ko {
    --paper: #161922;
    --paper-2: #1D212C;
    --surface: #232836;
    --line: #333A4C;
    --text: #EEF1F7;
    --text-soft: #C3CADA;
    --tile: #EEF1F7;
    --tile-edge: #AEB8CC;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--text);
  font-family: var(--font); font-size: 17px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent-text); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
h1, h2, h3 { font-weight: 800; line-height: 1.15; margin: 0; letter-spacing: -.01em; }
h1 { font-size: clamp(2.3rem, 8vw, 3.6rem); }
h2 { font-size: clamp(1.6rem, 5vw, 2.2rem); }
h3 { font-size: 1.15rem; }
.native { font-family: var(--native); font-weight: 700; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 16px; background: var(--surface); padding: 8px 14px; border-radius: 10px; z-index: 10; }

.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 16px; }

/* Nav */
.nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 0; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 800; font-size: 1.3rem; }
.brand img { width: 40px; height: 40px; border-radius: 10px; box-shadow: 0 2px 8px rgba(0, 0, 0, .12); }
.nav-link { font-weight: 700; text-decoration: none; color: var(--text); padding: 10px 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); }
.nav-link:hover { border-color: var(--accent); }

/* Hero */
.hero { padding: 24px 0 56px; }
.hero-grid { display: grid; gap: 36px; align-items: center; }
.hero-icon { width: 96px; height: 96px; border-radius: 24px; box-shadow: var(--shadow); margin-bottom: 22px; }
.eyebrow { margin: 0 0 10px; font-weight: 800; font-size: .85rem; letter-spacing: .1em; text-transform: uppercase; color: var(--accent-text); }
.lead { font-size: 1.2rem; color: var(--text-soft); margin: 16px 0 28px; max-width: 30em; }
.price { margin: 18px 0 0; color: var(--text-soft); font-size: .95rem; }

/* Letter tiles (the wheel's tiles) in the hero */
.tiles { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; }
.tile {
  display: grid; place-items: center; width: 72px; height: 72px; border-radius: 18px;
  background: var(--tile); color: var(--tile-text); border: 2px solid var(--tile-edge);
  font-family: var(--native); font-weight: 700; font-size: 2.2rem; line-height: 1;
  box-shadow: 0 4px 0 var(--tile-edge), 0 10px 22px rgba(0, 0, 0, .10);
}
.tile.on { background: var(--accent); color: var(--on-accent); border-color: var(--accent-deep); box-shadow: 0 4px 0 var(--accent-deep), 0 10px 22px rgba(224, 87, 62, .3); }
.tile.big { width: 96px; height: 96px; font-size: 3rem; border-radius: 22px; }
.tiles .op { font-weight: 800; font-size: 1.5rem; color: var(--text-soft); }
.tiles-caption { text-align: center; margin: 18px 0 0; color: var(--text-soft); font-weight: 700; }
.tiles-caption b { color: var(--text); }
.js .tile.drop { opacity: 0; transform: translateY(-14px); animation: drop .45s cubic-bezier(.2, .8, .3, 1.2) forwards; }
@keyframes drop { to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .js .tile.drop { animation: none; opacity: 1; transform: none; } }

/* Store buttons */
.stores { display: flex; flex-wrap: wrap; gap: 12px; }
.store {
  display: inline-flex; align-items: center; gap: 12px; min-height: 56px; min-width: 190px; padding: 8px 20px;
  border-radius: 14px; background: var(--text); color: var(--paper); text-decoration: none;
  font-weight: 800; font-size: 1.2rem; line-height: 1.1;
}
.store:hover { transform: translateY(-1px); }
.store svg { width: 26px; height: 26px; flex: none; }
.store small { display: block; font-size: .72rem; font-weight: 700; opacity: .8; }

/* Sections */
.section { padding: 64px 0; }
.section.alt { background: var(--paper-2); }
.section h2 { text-align: center; }
.section-lead { text-align: center; color: var(--text-soft); max-width: 34em; margin: 12px auto 0; font-size: 1.08rem; }

/* Screenshots: phones in a row, scroll sideways on narrow screens */
.shots { list-style: none; margin: 36px 0 0; padding: 4px 16px 16px; display: flex; gap: 20px; overflow-x: auto; scroll-snap-type: x mandatory; justify-content: flex-start; }
.shots li { flex: 0 0 auto; scroll-snap-align: center; }
.shots figure { margin: 0; }
.shots img { width: 220px; border-radius: 28px; border: 6px solid var(--phone-edge); box-shadow: var(--shadow); background: var(--surface); }
.shots figcaption { text-align: center; margin-top: 12px; font-weight: 700; color: var(--text-soft); max-width: 220px; }
@media (min-width: 760px) { .shots { justify-content: center; overflow: visible; } .shots img { width: 250px; } .shots figcaption { max-width: 250px; } }

/* Features */
.features { display: grid; gap: 16px; margin-top: 36px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.card p { margin: 8px 0 0; color: var(--text-soft); }
.card-icon { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; margin-bottom: 14px; background: var(--accent-tint); color: var(--accent-text); }
.card-icon.indigo { background: var(--indigo-tint); color: var(--indigo); }
.card-icon.sage { background: var(--sage-tint); color: var(--sage-text); }
.card-icon.gold { background: var(--gold-tint); color: var(--gold-text); }
.card-icon svg { width: 26px; height: 26px; }
@media (min-width: 700px) { .features { grid-template-columns: repeat(2, 1fr); } }

@media (min-width: 1000px) { .features { grid-template-columns: repeat(3, 1fr); } }
.card h3 { margin-bottom: 4px; }
.ticks { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; color: var(--text-soft); }
.ticks li { position: relative; padding-left: 22px; line-height: 1.45; }
.ticks li::before { content: ""; position: absolute; left: 2px; top: .5em; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }

/* Nav anchors (hidden on narrow phones: only Download stays) */
.nav-links { display: flex; align-items: center; gap: 4px 18px; }
.nav-links a:not(.nav-link) { color: var(--text); font-weight: 700; text-decoration: none; }
.nav-links a:not(.nav-link):hover { color: var(--accent-text); }
@media (max-width: 699px) { .nav-links a:not(.nav-link) { display: none; } }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
section[id] { scroll-margin-top: 12px; }

/* How it plays */
.steps { list-style: none; margin: 36px 0 0; padding: 0; display: grid; gap: 16px; counter-reset: step; }
.step { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); counter-increment: step; }
.step::after { content: counter(step); position: absolute; top: 18px; right: 22px; font-weight: 800; font-size: 2rem; line-height: 1; color: var(--line); }
.step p { margin: 8px 0 0; color: var(--text-soft); }
.step-icon { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; margin-bottom: 14px; background: var(--accent); color: var(--on-accent); }
.step-icon svg { width: 26px; height: 26px; }
@media (min-width: 760px) { .steps { grid-template-columns: repeat(3, 1fr); } }

/* Levels */
.levels { display: grid; gap: 16px; margin: 36px auto 0; max-width: 760px; }
.level { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.level.free { border: 2px solid var(--accent); }
.level-tag { display: inline-block; margin: 0 0 10px; padding: 2px 12px; border-radius: 999px; background: var(--indigo-tint); color: var(--text); font-weight: 800; font-size: .8rem; letter-spacing: .06em; text-transform: uppercase; }
.level.free .level-tag { background: var(--accent-tint); color: var(--accent-text); }
.level-count { margin: 6px 0 0; font-weight: 800; color: var(--text); }
.level p:last-child { margin: 8px 0 0; color: var(--text-soft); }
@media (min-width: 700px) { .levels { grid-template-columns: 1fr 1fr; } }
.section-lead.small { font-size: .98rem; margin-top: 24px; }
.shots picture { display: block; }

/* Levels note */
.note { max-width: 760px; margin: 32px auto 0; padding: 16px 20px; border-radius: 16px; background: var(--surface); border: 1px dashed var(--line); color: var(--text-soft); font-size: .95rem; }
.note strong { color: var(--text); }

/* Download */
.download { text-align: center; }
.download .stores { justify-content: center; margin-top: 28px; }
.download-icon { width: 112px; height: 112px; border-radius: 26px; margin: 0 auto 22px; box-shadow: var(--shadow); }

/* Sister app */
.sister { display: flex; align-items: center; gap: 18px; max-width: 640px; margin: 0 auto; padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--text); box-shadow: var(--shadow); }
.sister:hover { border-color: var(--accent); }
.sister img { width: 72px; height: 72px; border-radius: 18px; flex: none; }
.sister b { display: block; font-size: 1.15rem; }
.sister span { color: var(--text-soft); }
.sister .arrow { margin-left: auto; font-size: 1.6rem; color: var(--accent-text); }

/* Footer */
.footer { border-top: 1px solid var(--line); padding: 24px 0 32px; color: var(--text-soft); font-size: .95rem; }
.footer-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 24px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 6px 20px; }
.footer a { color: var(--text); }
.social-links { list-style: none; margin: 0 0 20px; padding: 0 0 20px; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 10px; }
/* Icon-only buttons: the network's name is in aria-label and title. 44 px touch target. */
.social-links a {
  display: grid; place-items: center; width: 44px; height: 44px;
  border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--text);
}
.social-links a:hover { border-color: var(--accent); }
.social-links svg { width: 20px; height: 20px; flex: none; }

/* Text pages (privacy, licenses) */
.doc { padding: 24px 0 72px; }
.doc .wrap { max-width: 760px; }
.doc h1 { font-size: clamp(2rem, 6vw, 2.7rem); margin-bottom: 6px; }
.doc h2 { font-size: 1.35rem; margin: 34px 0 8px; }
.doc h3 { margin: 22px 0 6px; }
.doc p, .doc li { color: var(--text-soft); }
.doc a { overflow-wrap: anywhere; }
.doc .updated { color: var(--accent-text); font-weight: 700; margin: 0 0 22px; }
.summary { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 22px; box-shadow: var(--shadow); }
.summary p { margin: 0; color: var(--text); font-weight: 700; font-size: 1.1rem; }
.credits { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.credits li { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px 18px; }
.credits b { color: var(--text); }
.credits p { margin: 4px 0 0; font-size: .95rem; }

@media (min-width: 860px) {
  .hero { padding: 40px 0 80px; }
  .hero-grid { grid-template-columns: 1.1fr .9fr; gap: 48px; }
  .section { padding: 88px 0; }
  .hero-art .tile { width: 104px; height: 104px; font-size: 3.2rem; border-radius: 24px; }
  .hero-art .tile.big { width: 132px; height: 132px; font-size: 4.2rem; border-radius: 30px; }
  .hero-art .tiles { gap: 16px; flex-wrap: nowrap; }
  .app-ko .hero-art .tiles { gap: 10px; }
  .app-ko .hero-art .tile { width: 80px; height: 80px; font-size: 2.5rem; border-radius: 20px; }
  .app-ko .hero-art .tile.big { width: 112px; height: 112px; font-size: 3.6rem; border-radius: 26px; }
  .hero-art .tiles-caption { font-size: 1.2rem; }
}
@media (max-width: 859px) {
  .hero-text { text-align: center; }
  .hero-icon { margin-left: auto; margin-right: auto; }
  .lead { margin-left: auto; margin-right: auto; }
  .hero .stores { justify-content: center; }
}
@media (max-width: 420px) {
  .store { width: 100%; justify-content: center; }
  .tile { width: 60px; height: 60px; font-size: 1.85rem; }
  .tile.big { width: 80px; height: 80px; font-size: 2.5rem; }
}
/* ㅎ + ㅏ + ㄴ → 한 stays on one line on phones */
@media (max-width: 859px) {
  .app-ko .hero-art .tiles { flex-wrap: nowrap; gap: 6px; }
  .app-ko .hero-art .tile { width: 52px; height: 52px; font-size: 1.6rem; border-radius: 14px; }
  .app-ko .hero-art .tile.big { width: 72px; height: 72px; font-size: 2.3rem; border-radius: 18px; }
  .app-ko .hero-art .op { font-size: 1.1rem; }
}

/* "Coming soon" holding page (index_incomming.html) */
.soon { padding: 24px 0 56px; }
.soon-grid { display: grid; gap: 36px; align-items: center; min-height: min(calc(100vh - 300px), 640px); }
.soon-promise { margin: 0 0 22px; font-weight: 700; color: var(--text); }
.readout { margin: 0; font-weight: 800; font-size: .95rem; letter-spacing: .1em; text-transform: uppercase; color: var(--accent-text); }
.spell { display: grid; justify-items: center; gap: 18px; min-height: 260px; align-content: center; }
.spell .tiles { flex-wrap: nowrap; gap: 10px; }
.spell .tile { transition: background-color .2s ease, color .2s ease, border-color .2s ease, box-shadow .2s ease, transform .2s ease; }
.spell .tile.on { transform: translateY(-2px); }
.spell-word { min-height: 96px; }
.spell .tiles-caption { min-height: 1.6em; margin: 0; transition: opacity .3s ease; }
.spell .tiles-caption.hide { opacity: 0; }
.soon-sister { margin-top: 48px; }
@media (min-width: 860px) {
  .soon { padding: 40px 0 72px; }
  .soon-grid { grid-template-columns: 1.1fr .9fr; gap: 48px; }
  .spell .tile { width: 88px; height: 88px; font-size: 2.7rem; border-radius: 22px; }
  .spell .tile.big { width: 112px; height: 112px; font-size: 3.6rem; border-radius: 26px; }
  /* Korean words have up to 6 letter tiles (친구, 사과: 5) */
  .app-ko .spell .spell-tiles .tile { width: 68px; height: 68px; font-size: 2.1rem; border-radius: 18px; }
}
@media (max-width: 859px) {
  .soon-text { text-align: center; }
  .soon-text .lead { margin-left: auto; margin-right: auto; }
}
@media (max-width: 420px) {
  .spell .tiles { gap: 6px; }
  .spell .tile { width: 52px; height: 52px; font-size: 1.6rem; border-radius: 14px; }
  .spell .tile.big { width: 72px; height: 72px; font-size: 2.3rem; border-radius: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .spell .tile, .spell .tiles-caption { transition: none; }
}
