/* =========================================================
   KeyBattle design layer (brand look, header, footer, landing page).
   Loaded after site.css: rules here override the earlier, simpler ones on purpose.
   ========================================================= */
body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
h1, h2, h3 { letter-spacing: -.02em; line-height: 1.2; }
::selection { background: #c7d2fe; }

/* header */
.top { position: sticky; top: 0; z-index: 50; background: rgba(255,255,255,.88); backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--line); padding: .65rem clamp(1rem, 3vw, 2rem); gap: 1.6rem; }
.logo { display: inline-flex; align-items: center; gap: .55rem; font-size: 1.28rem; font-weight: 800; letter-spacing: -.03em; }
.logo .mark { width: 34px; height: 34px; flex: none; filter: drop-shadow(0 3px 6px rgba(79,70,229,.25)); }
.logo span { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.nav a, .nav summary { font-weight: 500; font-size: .95rem; padding: .35rem .2rem; border-radius: 8px; }
.nav a.on, .nav a:hover, .nav summary:hover { color: var(--accent); }
.langs .menu { border-radius: 12px; box-shadow: var(--shadow); padding: .4rem; }
.tools a.btn { color: #fff; }
.pro-link { background: linear-gradient(135deg, #f59e0b, #f97316); -webkit-background-clip: text; background-clip: text; color: transparent !important; }

/* buttons */
.btn { background: var(--grad); border-radius: 10px; padding: .7rem 1.3rem; box-shadow: 0 4px 14px rgba(79,70,229,.25); transition: transform .12s, box-shadow .12s; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(79,70,229,.32); filter: none; }
.btn-alt { background: var(--night); box-shadow: 0 4px 14px rgba(15,18,34,.2); }
.btn-ghost { background: #fff; color: var(--accent); border: 1px solid #c7d2fe; box-shadow: none; }
.btn-ghost:hover { background: #eef2ff; box-shadow: none; }
.btn-danger { background: var(--bad); box-shadow: none; }
.btn-small { padding: .4rem .85rem; font-size: .9rem; }
.btn-lg { padding: .95rem 1.7rem; font-size: 1.08rem; border-radius: 12px; }
.btn-white { background: #fff; color: var(--accent); box-shadow: 0 6px 20px rgba(0,0,0,.18); }
.btn-white:hover { box-shadow: 0 10px 26px rgba(0,0,0,.24); }

/* surfaces */
.stage, .result, .card, .plan, .form, .room, .rh-stage, .class-slots, .join-box, .lessons li, .board, .compare, .msg { border-color: var(--line); box-shadow: var(--shadow); border-radius: var(--radius); }
.board, .compare { overflow: hidden; }
.modes button { font-weight: 500; }
.modes button.on, .tabs a.on { background: var(--accent); border-color: var(--accent); }
.stats span { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.wrap { max-width: 1080px; }

/* footer */
.foot { background: var(--night); color: #a3abc6; text-align: left; padding: 3rem clamp(1rem, 4vw, 3rem) 2rem; margin-top: 4rem; }
.foot-grid { max-width: 1080px; margin: 0 auto; display: grid; grid-template-columns: 1.6fr repeat(3, 1fr); gap: 2rem; }
.foot h3 { color: #fff; font-size: .95rem; margin: 0 0 .7rem; }
.foot nav { display: flex; flex-direction: column; gap: .45rem; justify-content: flex-start; }
.foot a { color: #a3abc6; text-decoration: none; }
.foot a:hover { color: #fff; }
.foot .logo { color: #fff; }
.foot-brand p { max-width: 22rem; margin: .8rem 0 0; font-size: .92rem; }
.foot-langs { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.foot-langs a { border: 1px solid #2c3352; border-radius: 999px; padding: .15rem .65rem; font-size: .85rem; }
.foot-bottom { max-width: 1080px; margin: 2.2rem auto 0; padding-top: 1.2rem; border-top: 1px solid #232946; display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem; font-size: .85rem; }
@media (max-width: 760px) { .foot-grid { grid-template-columns: 1fr 1fr; } .foot-brand { grid-column: 1 / -1; } }

/* ---------- landing: hero ---------- */
.hero { position: relative; margin: -1.5rem calc(50% - 50vw) 0; padding: 3.2rem clamp(1rem, 4vw, 3rem) 2.6rem; color: #fff; overflow: hidden;
  background: radial-gradient(60rem 30rem at 85% -10%, rgba(6,182,212,.35), transparent 60%), radial-gradient(50rem 30rem at 0% 0%, rgba(99,102,241,.45), transparent 60%), var(--night); }
.hero::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 36px 36px; -webkit-mask-image: linear-gradient(180deg, #000 30%, transparent); mask-image: linear-gradient(180deg, #000 30%, transparent); }
.hero-in { position: relative; z-index: 1; max-width: 1080px; margin: 0 auto; }
.hero-badge { display: inline-flex; gap: .5rem; align-items: center; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.18); color: #e0e7ff; border-radius: 999px; padding: .3rem .85rem; font-size: .85rem; }
.hero-badge b { color: #fde68a; }
.hero h1 { font-size: clamp(2.2rem, 5.2vw, 3.9rem); margin: .9rem 0 .6rem; color: #fff; max-width: 18ch; letter-spacing: -.035em; }
.hero h1 em { font-style: normal; background: linear-gradient(90deg, #a5b4fc, #67e8f9); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.sub { color: #c7d2fe; font-size: clamp(1.02rem, 1.6vw, 1.22rem); max-width: 42rem; margin: 0 0 1.2rem; }
.hero-langs { display: flex; gap: .45rem; flex-wrap: wrap; margin-bottom: 1.6rem; }
.hero-langs a { color: #fff; text-decoration: none; border: 1px solid rgba(255,255,255,.22); border-radius: 999px; padding: .25rem .8rem; font-size: .9rem; background: rgba(255,255,255,.06); }
.hero-langs a.on { background: #fff; color: var(--night); border-color: #fff; font-weight: 700; }
.hero .modes button { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.2); color: #e0e7ff; }
.hero .modes button.on { background: #fff; color: var(--night); border-color: #fff; }
.hero .stats small { color: #a5b4fc; }
.hero .stats span { background: linear-gradient(90deg, #fff, #c7d2fe); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero .stage { box-shadow: 0 30px 60px rgba(0,0,0,.35); border: 0; }
.hero .tools-bar .tool { color: #c7d2fe; }
.hero .result { color: var(--ink); }
.hero .note-small, .hero .lead { color: #a5b4fc; }

/* ---------- landing: sections ---------- */
.eyebrow { color: var(--accent); font-weight: 700; text-transform: uppercase; letter-spacing: .1em; font-size: .78rem; margin: 0 0 .5rem; }
.section { padding-top: 4.2rem; }
.section-head { text-align: center; max-width: 44rem; margin: 0 auto 2.2rem; }
.section-head h2 { font-size: clamp(1.7rem, 3.4vw, 2.5rem); margin: 0 0 .6rem; }
.section-head p { color: var(--soft); font-size: 1.08rem; margin: 0; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1rem; }
.feature { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.3rem; box-shadow: var(--shadow); text-decoration: none; color: var(--ink); transition: transform .15s, box-shadow .15s; display: flex; flex-direction: column; }
.feature:hover { transform: translateY(-3px); box-shadow: 0 16px 40px rgba(15,18,34,.12); }
.feature .ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 1.35rem; margin-bottom: .8rem; background: #eef2ff; }
.feature h3 { margin: 0 0 .35rem; font-size: 1.08rem; }
.feature p { margin: 0; color: var(--soft); font-size: .94rem; flex: 1; }
.feature .go { margin-top: .8rem; color: var(--accent); font-weight: 600; font-size: .9rem; }

.banner { display: grid; grid-template-columns: 1.05fr 1fr; gap: clamp(1.5rem, 4vw, 3.5rem); align-items: center; margin-top: 4.5rem; }
.banner.flip .banner-art { order: -1; }
.banner h2 { font-size: clamp(1.6rem, 3vw, 2.3rem); margin: 0 0 .7rem; }
.banner p { color: var(--soft); font-size: 1.05rem; }
.banner ul { padding: 0; list-style: none; margin: 1rem 0 1.4rem; }
.banner li { padding-left: 1.8rem; position: relative; margin: .5rem 0; }
.banner li::before { content: "✓"; position: absolute; left: 0; top: .1rem; width: 1.2rem; height: 1.2rem; border-radius: 50%; background: #dcfce7; color: var(--ok); font-size: .72rem; display: grid; place-items: center; font-weight: 800; }
.banner-art { border-radius: 22px; padding: 1.8rem; min-height: 290px; display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative; overflow: hidden; box-shadow: var(--shadow); }
.art-race { background: linear-gradient(160deg, #eef2ff, #ecfeff); }
.art-learn { background: linear-gradient(160deg, #f0fdf4, #ecfeff); }
.art-boss { background: linear-gradient(180deg, #1d2030, #2f3352); color: #fff; }
.art-scripture { background: linear-gradient(160deg, #fffbeb, #fef3c7); }
.art-pet { background: linear-gradient(160deg, #fdf2f8, #eef2ff); }

.mock-lanes { width: 100%; max-width: 26rem; display: flex; flex-direction: column; gap: .75rem; }
.mock-lane { display: grid; grid-template-columns: 5.5rem 1fr 3.8rem; gap: .6rem; align-items: center; font-weight: 600; font-size: .9rem; }
.mock-lane .t { height: .8rem; background: #fff; border-radius: 999px; overflow: hidden; box-shadow: inset 0 0 0 1px var(--line); }
.mock-lane .t i { display: block; height: 100%; background: var(--grad); border-radius: 999px; animation: grow 3.5s ease-in-out infinite alternate; }
.mock-lane.me .t i { background: linear-gradient(90deg, #fbbf24, #f97316); }
.mock-lane b { text-align: right; color: var(--soft); font-variant-numeric: tabular-nums; }
@keyframes grow { from { width: 12%; } }
.mock-kb { display: flex; flex-direction: column; gap: .35rem; align-items: center; }
.mock-kb div { display: flex; gap: .35rem; }
.mock-kb div:nth-child(2) { margin-left: 1.2rem; } .mock-kb div:nth-child(3) { margin-left: 2.2rem; }
.mock-kb span { width: 2.3rem; height: 2.3rem; background: #fff; border-radius: 8px; box-shadow: 0 2px 0 #d7dbe7, 0 0 0 1px #e4e7f0; display: grid; place-items: center; font-weight: 600; color: var(--soft); font-size: .92rem; }
.mock-kb span.hl { background: var(--accent); color: #fff; box-shadow: 0 2px 0 #3730a3; animation: press 1.6s infinite; }
@keyframes press { 50% { transform: translateY(2px); box-shadow: 0 0 0 #3730a3; } }
.mock-caption { margin-top: 1rem; font-size: .88rem; color: var(--soft); }
.mock-map { display: grid; grid-template-columns: repeat(11, 1fr); gap: 4px; width: 100%; max-width: 24rem; }
.mock-map i { aspect-ratio: 1.6; border-radius: 4px; background: #fde68a; }
.mock-map i.d { background: #15803d; } .mock-map i.p { background: linear-gradient(90deg, #15803d 55%, #fde68a 55%); }
.art-boss .monster { width: 170px; height: 170px; }
.art-boss .hp { width: 14rem; margin-top: .6rem; }
.boss-hits { position: absolute; top: 1.4rem; right: 1.8rem; color: #ffb4a8; font-weight: 800; font-size: 1.4rem; animation: rise 1.8s infinite; }
.pets-row { display: flex; align-items: flex-end; justify-content: center; gap: .2rem; flex-wrap: wrap; }

.lang-band { margin: 4.5rem calc(50% - 50vw) 0; padding: 3.2rem clamp(1rem, 4vw, 3rem); background: var(--panel); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.lang-band .in { max-width: 1080px; margin: 0 auto; }
.lang-cards { display: grid; grid-template-columns: repeat(5, 1fr); gap: .8rem; }
.lang-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; text-decoration: none; color: var(--ink); background: var(--ground); transition: border-color .15s, transform .15s; }
.lang-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.lang-card .sample { font-size: 1.3rem; font-weight: 700; margin: .25rem 0; }
.lang-card small { color: var(--muted); }

.stat-band { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-top: 4.5rem; text-align: center; }
.stat-band div { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem 1rem; box-shadow: var(--shadow); }
.stat-band strong { display: block; font-size: 2.3rem; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; font-variant-numeric: tabular-nums; }
.stat-band span { color: var(--soft); }

.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 4.5rem; }
.promo { border-radius: 22px; padding: 2rem; color: #fff; position: relative; overflow: hidden; }
.promo h2 { margin: .5rem 0 .6rem; font-size: 1.6rem; color: #fff; }
.promo p { color: rgba(255,255,255,.88); }
.promo-pro { background: linear-gradient(135deg, #4f46e5, #7c3aed); }
.promo-teach { background: linear-gradient(135deg, #0e7490, #0891b2); }
.promo .tag { display: inline-block; background: rgba(255,255,255,.18); border-radius: 999px; padding: .2rem .7rem; font-size: .8rem; font-weight: 700; }
.promo .price-line { font-size: 1.05rem; font-weight: 700; margin: .4rem 0 1.2rem; }

.cta-final { margin-top: 4.5rem; text-align: center; background: var(--grad); color: #fff; border-radius: 26px; padding: 3rem 1.5rem; box-shadow: 0 20px 50px rgba(79,70,229,.3); }
.cta-final h2 { color: #fff; font-size: clamp(1.7rem, 3.4vw, 2.4rem); margin: 0 0 .5rem; }
.cta-final p { color: #e0f2fe; margin: 0 0 1.4rem; }

@media (max-width: 860px) {
  .banner, .duo { grid-template-columns: 1fr; }
  .banner.flip .banner-art { order: 0; }
  .stat-band { grid-template-columns: 1fr; }
  .lang-cards { grid-template-columns: repeat(2, 1fr); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
.logo .wm { font-weight: 800; }

/* mobile header: not sticky, compact; Korean/Chinese headings break between words */
.hero h1, .section-head h2, .banner h2 { word-break: keep-all; overflow-wrap: anywhere; }
@media (max-width: 760px) {
  .top { position: static; gap: .4rem .9rem; padding: .55rem .9rem; }
  .logo { font-size: 1.15rem; } .logo .mark { width: 30px; height: 30px; }
  .tools { order: 2; margin-left: auto; width: auto; gap: .6rem; font-size: .9rem; }
  .nav { order: 3; width: 100%; gap: .2rem 1rem; flex-wrap: wrap; font-size: .9rem; }
  .hero { padding-top: 2rem; }
  .hero h1 { font-size: 2rem; }
}
.kb-debug { background: #0f1222; color: #a5f3fc; font-size: .75rem; padding: .6rem .8rem; border-radius: 10px; max-height: 14rem; overflow: auto; white-space: pre-wrap; }

/* hero background art (tools/make_hero_bg.py): keycaps on the right, faded behind the text on the left */
.hero { background-image: url("/img/hero-bg.svg"), radial-gradient(60rem 30rem at 85% -10%, rgba(6,182,212,.35), transparent 60%), radial-gradient(50rem 30rem at 0% 0%, rgba(99,102,241,.45), transparent 60%); background-color: var(--night); background-repeat: no-repeat; background-size: cover, auto, auto; background-position: right center, 0 0, 0 0; }
.hero::before { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(15,18,34,.92) 0%, rgba(15,18,34,.6) 45%, rgba(15,18,34,0) 75%); pointer-events: none; }
@media (max-width: 760px) { .hero::before { background: rgba(15,18,34,.78); } }

.minibar { display: inline-block; width: 7rem; height: .5rem; background: var(--line); border-radius: 999px; overflow: hidden; vertical-align: middle; margin-right: .4rem; }
.minibar span { display: block; height: 100%; background: var(--grad); }
.boss-top { margin: -.3rem 0 .9rem; font-size: .9rem; }
.boss-top summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.boss-top ol { margin: .5rem 0 0; padding-left: 1.4rem; max-width: 24rem; }
.boss-top li { display: flex; justify-content: space-between; padding: .15rem 0; }
.boss-top li b { font-variant-numeric: tabular-nums; }
