/* moeater.com/eula: EULA's two worlds. Rules live in /DESIGN.md.
   The game's mode button repaints the whole page. Organic is the hand-drawn white
   window of the key art, AI the dark glass window beside it. */

:root {
  --ink: #2b2330;
  --paper: #f7f2ec;
  --lavender: #ead2ea;
  --navy: #1e2547;
  --steel: #8a96ba;
  --blue: #6f97f2;
  --pink: #ef7fa8;
  --pink-ink: #b5446a;
  --leaf: #3f803b;
  --robot: #456dcc;
  --body: 'Noto Sans KR', sans-serif;
  --mono: 'IBM Plex Mono', 'Noto Sans KR', monospace;
  --gutter: clamp(16px, 4vw, 48px);
  --pad: clamp(72px, 9vw, 120px);
  --swap: background-color .35s, color .35s, border-color .35s, border-radius .35s, box-shadow .35s;
}

/* ---------- The two skins ---------- */
body[data-mode="organic"] {
  --bg: #fff;
  --fg: var(--ink);
  --muted: #5a4e66;
  --line: var(--ink);
  --hair: rgba(43, 35, 48, .16);
  --panel: #fff;
  --soft: var(--paper);
  --accent: var(--pink);
  --accent-ink: var(--pink-ink);
  --frame: 3px solid var(--ink);
  --radius: 22px 7px 18px 9px / 9px 18px 7px 22px;
  --radius-s: 12px 4px 10px 5px / 5px 10px 4px 12px;
  --shadow: 5px 6px 0 rgba(43, 35, 48, .12);
  --name-bg: var(--ink);
  --name-fg: #fff;
  --primary-bg: var(--pink);
  --primary-fg: var(--ink);
}
body[data-mode="ai"] {
  --bg: var(--navy);
  --fg: #fff;
  --muted: var(--steel);
  --line: rgba(255, 255, 255, .34);
  --hair: rgba(255, 255, 255, .13);
  --panel: rgba(16, 21, 44, .92);
  --soft: rgba(255, 255, 255, .05);
  --accent: var(--blue);
  --accent-ink: #a9c1f8;
  --frame: 1px solid rgba(255, 255, 255, .34);
  --radius: 8px;
  --radius-s: 6px;
  --shadow: 0 18px 40px rgba(5, 8, 24, .45);
  --name-bg: #fff;
  --name-fg: var(--navy);
  --primary-bg: #fff;
  --primary-fg: var(--navy);
  /* the AI window's dot grid from the key art */
  background-image: radial-gradient(rgba(255, 255, 255, .06) 1px, transparent 1.4px);
  background-size: 16px 16px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 64px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background-color: var(--bg); color: var(--fg);
  font-family: var(--body); font-size: 16px; line-height: 1.7;
  word-break: keep-all; overflow-wrap: anywhere; transition: var(--swap);
}
img, video { max-width: 100%; height: auto; display: block; }
/* media-guard.js closes the context menu on artwork; this keeps it out of drags,
   selection and the iOS long-press save sheet */
img, svg, video, canvas { -webkit-user-drag: none; -webkit-touch-callout: none; user-select: none; }
a { color: inherit; }
button { font: inherit; color: inherit; }
:where(a, button, select, summary, [tabindex]):focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--panel); color: var(--fg); padding: 8px 12px; }
.skip-link:focus { left: 8px; }
[hidden] { display: none !important; }
html:not(.js) .js-only { display: none !important; }

.icon { width: 18px; height: 18px; flex: none; background: currentColor; -webkit-mask: var(--icon) center / contain no-repeat; mask: var(--icon) center / contain no-repeat; }
.icon--leaf { --icon: url('../assets/icons/leaf.svg'); }
.icon--robot { --icon: url('../assets/icons/robot.svg'); }
.icon--steam { --icon: url('../assets/icons/steam.svg'); }
.icon--play { --icon: url('../assets/icons/play.svg'); }
.icon--discord { --icon: url('../assets/icons/discord.svg'); }
.icon--x { --icon: url('../assets/icons/x.svg'); }

/* one outline for every box: a wobbly ink line, or a thin glass edge */
.frame, .vnbox, .choice, .win, .loadscreen, .thumb, .slot a, .click-art {
  border: var(--frame); border-radius: var(--radius); box-shadow: var(--shadow); transition: var(--swap);
}

/* ---------- Top bar and the mode HUD ---------- */
.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  display: flex; align-items: center; gap: 20px; height: 56px;
  padding: max(0px, env(safe-area-inset-top)) var(--gutter) 0;
  background-color: var(--bg); transition: var(--swap);
}
body[data-mode="organic"] .topbar { background-image: url('../assets/eula/ui/rule.svg'); background-repeat: repeat-x; background-position: 0 100%; background-size: 320px 6px; }
body[data-mode="ai"] .topbar { box-shadow: 0 1px 0 var(--hair); }
.topbar__back { display: flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 900; font-size: 17px; }
body[data-mode="ai"] .topbar__back img { filter: invert(1); }
.topbar__links { display: flex; gap: 22px; margin-left: auto; font-weight: 700; font-size: 14px; }
.topbar__links a { text-decoration: none; }
.topbar__links a:hover { color: var(--accent-ink); }
.topbar .lang-btn { border: 2px solid currentColor; border-radius: var(--radius-s); color: var(--fg); background: var(--bg); font-family: var(--mono); font-weight: 600; padding: 2px 8px; }
.topbar .lang-dropdown { background: var(--panel); border: var(--frame); border-radius: var(--radius-s); }
.topbar .lang-option { color: var(--fg); }
.topbar .lang-option:hover, .topbar .lang-option.active { background: var(--accent); color: var(--ink); }

.hud { position: absolute; top: calc(100% + 14px); left: var(--gutter); display: grid; grid-template-columns: auto auto; gap: 6px; }
.hud__btn {
  display: grid; place-items: center; width: 44px; height: 44px; padding: 0; color: #fff; cursor: pointer;
  border: 2px solid rgba(255, 255, 255, .6); border-radius: 6px; transition: var(--swap), transform .15s;
}
body[data-mode="organic"] .hud__btn { border: 3px solid var(--ink); border-radius: var(--radius-s); }
.hud__btn .icon { width: 22px; height: 22px; }
.hud__btn--organic { background: var(--leaf); }
.hud__btn--ai { background: var(--robot); }
.hud__btn:hover { transform: translateY(-2px); }
.hud__btn[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--bg), 0 0 0 6px var(--accent); }
.hud__label { grid-column: 1 / -1; padding: 1px 6px; border-radius: 3px; background: var(--panel); border: var(--frame); font-size: 12px; font-weight: 700; text-align: center; }

/* ---------- Title: key art, logo, the first line ---------- */
.title { padding-top: 56px; }
.title__art img { width: 100%; }
.logo { position: relative; z-index: 2; margin: calc(-1 * clamp(48px, 6.4vw, 104px)) 0 0; text-align: center; line-height: 1; }
.logo__word {
  display: block; font-weight: 900; font-size: clamp(88px, 11vw, 168px); letter-spacing: -.01em;
  -webkit-text-stroke: .09em #fff; paint-order: stroke fill;
  text-shadow: 0 .05em 0 rgba(30, 37, 71, .28);
}
.logo__eu { color: #8eaaf2; }
.logo__la { color: var(--pink); }
.logo__sub { display: block; margin-top: 12px; font-weight: 800; font-size: clamp(17px, 1.6vw, 23px); }
.title__band {
  display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, 1fr); gap: 28px; align-items: start;
  max-width: 1120px; margin: 36px auto 0; padding: 0 var(--gutter) var(--pad);
}

/* ---------- VN box, choices, windows ---------- */
.vnbox { position: relative; margin: 0; padding: 26px 46px 20px 26px; background: var(--panel); }
.vnbox__name {
  position: absolute; left: 18px; top: -16px; padding: 1px 14px;
  background: var(--name-bg); color: var(--name-fg); border-radius: var(--radius-s);
  font-weight: 900; font-size: 14px; transition: var(--swap);
}
.vnbox__text { margin: 0; font-weight: 700; font-size: clamp(16px, 1.4vw, 20px); line-height: 1.7; }
.vnbox__text strong { color: var(--accent-ink); }
.vnbox__meta { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 10px 0 0; font-size: 13px; font-weight: 700; color: var(--muted); }
.vnbox__next { position: absolute; right: 18px; bottom: 12px; font-size: 12px; color: var(--accent-ink); animation: vn-next 1.1s ease-in-out infinite; }
@keyframes vn-next { 50% { transform: translateY(3px); } }

.choices { display: grid; gap: 12px; margin: 0; }
.choice {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 54px; padding: 12px 20px;
  background: var(--panel); font-weight: 700; font-size: 16px; line-height: 1.4; text-align: left; text-decoration: none;
  cursor: pointer;
}
body[data-mode="organic"] .choice:hover { background: var(--lavender); transform: rotate(-.6deg); }
body[data-mode="ai"] .choice:hover { background: rgba(54, 64, 112, .96); border-color: #fff; }
.choice--primary { background: var(--primary-bg); color: var(--primary-fg); }
body .choice--primary:hover { background: var(--primary-bg); filter: brightness(1.04); }
.choice[aria-pressed="true"] { box-shadow: var(--shadow), inset 7px 0 0 var(--accent); }
.choices__also { margin: 2px 0 0; font-size: 13px; font-weight: 700; color: var(--muted); }
.choices__also a { margin-left: 8px; color: var(--fg); }

.win { overflow: hidden; background: var(--panel); }
.win__bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 38px; margin: 0; padding: 0 14px; font-weight: 800; font-size: 13px; }
body[data-mode="organic"] .win__bar { border-bottom: 3px solid var(--ink); }
body[data-mode="ai"] .win__bar { border-bottom: 1px solid var(--hair); }
.win__controls { display: flex; gap: 12px; }
.win__controls i { position: relative; width: 12px; height: 12px; border: 2px solid currentColor; }
.win__controls i + i { border: 0; }
.win__controls i + i::before, .win__controls i + i::after { content: ''; position: absolute; left: 50%; top: -2px; height: 16px; border-left: 2px solid currentColor; }
.win__controls i + i::before { rotate: 45deg; }
.win__controls i + i::after { rotate: -45deg; }
/* HumbleAI is an AI app in either mode */
.win--ai { background: #12172e; color: #fff; border: 1px solid rgba(255, 255, 255, .34); border-radius: 8px; box-shadow: 0 18px 40px rgba(5, 8, 24, .45); }
body[data-mode="organic"] .win--ai .win__bar, .win--ai .win__bar { border-bottom: 1px solid rgba(255, 255, 255, .13); }

/* ---------- Sections ---------- */
.section { padding: var(--pad) var(--gutter); }
body[data-mode="organic"] .section { background-image: url('../assets/eula/ui/rule.svg'); background-repeat: repeat-x; background-position: 0 0; background-size: 320px 6px; }
body[data-mode="ai"] .section { box-shadow: inset 0 1px 0 var(--hair); }
.section__inner { max-width: 1120px; margin: 0 auto; }
.section__head { margin: 0 0 44px; max-width: 760px; }
.section__title { position: relative; display: inline-block; margin: 0; padding-bottom: 12px; font-weight: 900; font-size: clamp(32px, 3.8vw, 48px); line-height: 1.2; }
.section__title::after { content: ''; position: absolute; left: 0; bottom: 0; transition: var(--swap); }
body[data-mode="organic"] .section__title::after { width: 100%; min-width: 110px; height: 12px; background: url('../assets/eula/ui/squiggle.svg') 0 0 / 60px 12px repeat-x; }
body[data-mode="ai"] .section__title::after { width: 44px; height: 3px; background: var(--blue); }
.section__lede { margin: 14px 0 0; color: var(--muted); font-size: 16px; }
.section__lede strong { color: var(--fg); }

/* Story */
.story { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 48px 56px; align-items: center; }
.story__app { margin: 0; }
.clip { width: 100%; aspect-ratio: 800 / 424; object-fit: cover; background: #000; }
.story__terms { margin: 0; justify-self: center; width: min(100%, 470px); }
.story__terms img { width: 100%; border: var(--frame); border-radius: var(--radius); box-shadow: var(--shadow); transition: var(--swap); }
body[data-mode="organic"] .story__terms img { transform: rotate(-1.4deg); }
.story__choice { display: grid; gap: 26px; }

/* Modes */
.modes { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: clamp(28px, 4vw, 56px); align-items: start; }
.modes__art { margin: 0; }
.compare { --cut: 50%; position: relative; overflow: hidden; aspect-ratio: 1920 / 1240; user-select: none; -webkit-user-select: none; touch-action: pan-y; cursor: ew-resize; transition: --cut .7s cubic-bezier(.3, .7, .2, 1), var(--swap); }
.compare.is-dragging { transition: var(--swap); }
.compare__img { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: cover; pointer-events: none; }
.compare__img--organic { background: #fff; }
.compare__img--ai { clip-path: inset(0 0 0 var(--cut)); }
.compare__line { position: absolute; top: 0; bottom: 0; left: var(--cut); width: 3px; margin-left: -1.5px; background: #fff; box-shadow: 0 0 0 1px rgba(30, 37, 71, .5); pointer-events: none; }
.compare__handle {
  position: absolute; top: 50%; left: 50%; width: 40px; height: 40px; margin: -20px 0 0 -20px;
  display: grid; place-items: center; border-radius: 50%; background: #fff; border: 2px solid var(--ink); font-style: normal;
}
.compare__handle::before { content: '◀ ▶'; font-size: 10px; letter-spacing: 2px; color: var(--ink); }
.compare:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
@property --cut { syntax: '<percentage>'; inherits: true; initial-value: 50%; }
.modes__legend { display: grid; gap: 4px; margin: 16px 0 0; font-size: 15px; }
.mode-name { margin-right: 6px; }
.mode-name--organic { color: var(--leaf); }
.mode-name--ai { color: var(--robot); }
body[data-mode="ai"] .mode-name--organic { color: #8fd18a; }
body[data-mode="ai"] .mode-name--ai { color: var(--accent-ink); }
.modes__side { display: grid; gap: 22px; }
.click-art { width: 100%; background: #fff; }
.options { margin: 0; }
.options__row { padding: 16px 2px; border-top: 1px solid var(--hair); }
.options__row:first-child { border-top: 0; padding-top: 4px; }
.options__row dt { font-weight: 900; font-size: 18px; }
.options__row dd { margin: 4px 0 0; color: var(--muted); font-size: 15px; line-height: 1.7; }
.spec { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 56px 0 0; border-top: 2px solid var(--line); border-bottom: 2px solid var(--line); }
.spec > div { padding: 16px 18px; border-left: 1px solid var(--hair); }
.spec > div:first-child { border-left: 0; padding-left: 2px; }
.spec dt { color: var(--muted); font-size: 13px; font-weight: 700; }
.spec dd { margin: 2px 0 0; font-weight: 900; font-size: 20px; }
.spec dd.spec__langs { display: flex; flex-wrap: wrap; gap: 0 12px; font-size: 17px; }

/* Screens */
.viewer__stage { position: relative; aspect-ratio: 16 / 9; background: #000; }
.viewer__video, .viewer__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.viewer__thumbs { list-style: none; margin: 16px 0 0; padding: 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.thumb { position: relative; display: block; width: 100%; padding: 0; overflow: hidden; background: #000; cursor: pointer; aspect-ratio: 16 / 9; box-shadow: none; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb:hover { transform: translateY(-2px); }
.thumb[aria-pressed="true"] { outline: 3px solid var(--accent); outline-offset: 3px; }
.thumb__play { position: absolute; left: 50%; top: 50%; width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%; background: rgba(255, 255, 255, .92); }
.thumb__play::before { content: ''; position: absolute; left: 13px; top: 10px; border-left: 11px solid var(--ink); border-block: 7px solid transparent; }

/* Devlog: the load screen */
.loadscreen { background: var(--panel); overflow: hidden; }
.loadscreen__bar { display: flex; justify-content: space-between; align-items: center; padding: 10px 18px; font-weight: 900; }
body[data-mode="organic"] .loadscreen__bar { border-bottom: 3px solid var(--ink); }
body[data-mode="ai"] .loadscreen__bar { border-bottom: 1px solid var(--hair); }
.loadscreen__count { font-family: var(--mono); font-size: 13px; color: var(--muted); }
.slots { list-style: none; margin: 0; padding: 20px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; min-height: 180px; }
.slot a {
  display: grid; grid-template-columns: 172px minmax(0, 1fr); gap: 16px; align-items: center; height: 100%;
  padding: 10px; background: var(--panel); text-decoration: none; box-shadow: none;
}
body[data-mode="organic"] .slot a { border-width: 2px; }
.slot a:hover { background: var(--soft); transform: translateY(-2px); }
body[data-mode="organic"] .slot a:hover { background: var(--lavender); }
.slot img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 3px; background: #000; }
.slot__meta { display: block; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.slot__ep { margin-right: 8px; color: var(--accent-ink); font-weight: 600; }
.slot__title { display: -webkit-box; margin-top: 3px; font-weight: 800; font-size: 16px; line-height: 1.45; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pages { display: flex; justify-content: center; gap: 8px; padding: 0 20px 20px; }
.pages button { min-width: 42px; height: 42px; border: var(--frame); border-radius: var(--radius-s); background: var(--panel); font-family: var(--mono); font-weight: 600; cursor: pointer; transition: var(--swap); }
.pages button[aria-current="page"] { background: var(--fg); color: var(--bg); }
.slots-plain { columns: 2; padding: 20px 20px 20px 40px; margin: 0; }

/* Community */
.choices--community { max-width: 520px; }

/* ---------- Footer ---------- */
.footer { padding: 36px var(--gutter) max(36px, env(safe-area-inset-bottom)); color: var(--muted); font-size: 13px; }
body[data-mode="organic"] .footer { background-image: url('../assets/eula/ui/rule.svg'); background-repeat: repeat-x; background-size: 320px 6px; }
body[data-mode="ai"] .footer { box-shadow: inset 0 1px 0 var(--hair); background-color: rgba(0, 0, 0, .18); }
.footer__links { display: flex; flex-wrap: wrap; gap: 4px 6px; justify-content: center; }
.footer__links a { display: inline-flex; align-items: center; min-height: 32px; padding: 0 8px; color: var(--fg); text-decoration: none; font-weight: 700; }
.footer__links a:hover { color: var(--accent-ink); }
.footer__legal { margin: 10px 0 0; text-align: center; }

/* ---------- Trailer ---------- */
.trailer { width: min(1100px, 92vw); padding: 0; border: 2px solid #fff; border-radius: 6px; background: #000; overflow: visible; }
.trailer::backdrop { background: rgba(10, 14, 32, .86); }
.trailer video { width: 100%; aspect-ratio: 16 / 9; }
.trailer__error { margin: 0; padding: 14px 18px; background: var(--navy); color: #fff; font-weight: 700; }
.trailer__error a { color: var(--pink); }
.trailer__close { position: absolute; top: -46px; right: -3px; width: 40px; height: 40px; border: 2px solid #fff; border-radius: 4px; background: var(--navy); color: #fff; font-size: 22px; cursor: pointer; }

/* ---------- Responsive ---------- */
@media (max-width: 1040px) {
  .topbar__links { gap: 14px; }
}
@media (max-width: 960px) {
  .modes, .story { grid-template-columns: 1fr; }
  .slots { grid-template-columns: 1fr; }
  .viewer__thumbs { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .topbar { gap: 12px; height: 54px; }
  .topbar__links { display: none; }
  .topbar__back span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .hud { position: static; grid-template-columns: auto auto; gap: 6px; margin-right: auto; }
  .hud__label { display: none; }
  .hud__btn { width: 38px; height: 38px; }
  .title { padding-top: 54px; }
  /* the portrait capsule already carries the logo */
  .logo { margin-top: 18px; }
  .logo__word { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .logo__sub { margin-top: 0; }
  .title__band { grid-template-columns: 1fr; margin-top: 30px; gap: 24px; }
  .vnbox { padding: 24px 36px 18px 18px; }
  .spec { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .spec > div:nth-child(3) { border-left: 0; padding-left: 2px; }
  .spec > div:nth-child(n + 3) { border-top: 1px solid var(--hair); }
  .viewer__thumbs { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .slot a { grid-template-columns: 120px minmax(0, 1fr); gap: 12px; }
  .slots { padding: 12px; }
  .slots-plain { columns: 1; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
