:root {
  --bg: #f7f6f2;
  --surface: #ffffff;
  --surface-2: #f0eee8;
  --text: #1c1b19;
  --muted: #5d5a53;
  --border: #e2dfd6;
  --accent: #c2410c;
  --accent-text: #ffffff;
  --accent-soft: #fdeee4;
  --accent-soft-text: #9a3412;
  --shadow: 0 1px 2px rgba(28, 27, 25, 0.06), 0 6px 20px rgba(28, 27, 25, 0.05);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141412;
    --surface: #1d1c1a;
    --surface-2: #262522;
    --text: #efede8;
    --muted: #a8a49b;
    --border: #33312d;
    --accent: #fb923c;
    --accent-text: #1a0e05;
    --accent-soft: #3a2416;
    --accent-soft-text: #fdba74;
    --shadow: none;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #141412;
  --surface: #1d1c1a;
  --surface-2: #262522;
  --text: #efede8;
  --muted: #a8a49b;
  --border: #33312d;
  --accent: #fb923c;
  --accent-text: #1a0e05;
  --accent-soft: #3a2416;
  --accent-soft-text: #fdba74;
  --shadow: none;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
  line-height: 1.6;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

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

@media (min-width: 640px) {
  .wrap { padding: 0 24px; }
}

.skip {
  position: absolute;
  left: -9999px;
}
.skip:focus {
  left: 16px;
  top: 12px;
  z-index: 10;
  background: var(--surface);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 8px;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Top bar */
.topbar {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 60px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: -0.01em;
  min-width: 0;
}
.brand span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.controls {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}
.chip:hover { background: var(--surface-2); }

.icon-moon { display: none; }
:root[data-theme="dark"] .icon-sun { display: none; }
:root[data-theme="dark"] .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { display: none; }
  :root:not([data-theme="light"]) .icon-moon { display: block; }
}

/* Hero */
.hero {
  padding-top: 56px;
  padding-bottom: 32px;
}
.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.875rem;
  font-weight: 700;
}
h1 {
  margin: 0;
  font-size: clamp(1.75rem, 5vw, 2.75rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
}
.lead {
  margin: 12px 0 0;
  max-width: 36em;
  color: var(--muted);
  font-size: 1.0625rem;
}

/* Cards */
.section-title {
  margin: 16px 0 16px;
  font-size: 1rem;
  color: var(--muted);
  font-weight: 600;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: 16px;
}
.card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  min-width: 0;
}
.card-head {
  display: flex;
  align-items: center;
  gap: 14px;
}
.card h3 {
  margin: 0;
  font-size: 1.1875rem;
  line-height: 1.3;
}
.app-icon {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent-soft-text);
}
.app-icon svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.badge {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-soft-text);
  font-size: 0.75rem;
  font-weight: 700;
}
.badge-muted {
  background: var(--surface-2);
  color: var(--muted);
}
.tagline {
  margin: 0;
  font-size: 1rem;
}
.features {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}
.features li {
  position: relative;
  padding-left: 20px;
  color: var(--muted);
  font-size: 0.9375rem;
}
.features li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 0.65em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}
.note {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.8125rem;
}
.btn {
  margin-top: auto;
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-text);
  text-decoration: none;
  font-weight: 700;
}
.btn:hover { filter: brightness(1.06); }

.card-soon {
  background: transparent;
  border-style: dashed;
  box-shadow: none;
}
.card-soon .app-icon {
  background: var(--surface-2);
  color: var(--muted);
}
.card-soon .tagline { color: var(--muted); }

/* App detail page */
.back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  margin: -24px 0 16px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 600;
}
.back:hover { color: var(--text); }
.app-hero {
  display: flex;
  align-items: center;
  gap: 16px;
}
.app-hero .eyebrow { margin-bottom: 4px; }
.app-icon-lg {
  width: 64px;
  height: 64px;
  border-radius: 16px;
}
.app-icon-lg svg { width: 34px; height: 34px; }
.cta-row { margin-top: 24px; }
.btn-disabled {
  background: var(--surface-2);
  color: var(--muted);
  border: 1px dashed var(--border);
  cursor: default;
}
.btn-disabled:hover { filter: none; }

.section { margin-top: 40px; }
.section-heading {
  margin: 0 0 16px;
  font-size: 1.375rem;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.jamo-figure {
  margin: 0;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.jamo {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
  gap: 6px;
}
.jamo span {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border-radius: 8px;
  background: var(--surface-2);
  font-size: 1.25rem;
  font-weight: 600;
}
.jamo .v {
  background: var(--accent-soft);
  color: var(--accent-soft-text);
}
.jamo-figure figcaption {
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.9375rem;
}

.steps {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
  gap: 16px;
}
.steps li {
  counter-increment: step;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.steps li::before {
  content: counter(step);
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  margin-bottom: 12px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 700;
}
.steps h3, .grid .card > h3 { margin: 0; font-size: 1.0625rem; }
.steps p { margin: 6px 0 0; color: var(--muted); font-size: 0.9375rem; }

.features-lg li { font-size: 1rem; }

/* Footer */
.footer {
  margin-top: 56px;
  padding-top: 20px;
  padding-bottom: 40px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.8125rem;
}
.footer p { margin: 4px 0; }

@media (prefers-reduced-motion: no-preference) {
  .chip, .btn { transition: background-color 0.15s, filter 0.15s; }
}
