:root {
  color-scheme: light;
  font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans CJK KR", system-ui, sans-serif;
  color: #231b44;
  background: #f8f7fd;
  font-synthesis: none;
  --ink: #231b44;
  --muted: #625978;
  --purple: #5838d3;
  --purple-dark: #4126b0;
  --line: #e7e2f1;
  --paper: #fff;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 280px; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
svg { display: block; }
:is(.icon, .tile-star, .result-star-icon) { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #7956ef; outline-offset: 4px; }
.icon { width: 20px; height: 20px; flex: 0 0 auto; }
.frame { max-width: 1176px; margin-inline: auto; padding-inline: 28px; }

.site-header { background: #fff; border-bottom: 1px solid #ece8f5; }
.header-content { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 11px; font-size: 1.4rem; font-weight: 850; letter-spacing: -.065em; white-space: nowrap; }
.brand img { display: block; }
.header-actions { display: flex; align-items: center; gap: 10px; }

.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 0 16px; min-height: 46px; border: 1px solid transparent; border-radius: 12px; font-weight: 750; line-height: 1.25; white-space: nowrap; transition: background-color .16s, box-shadow .16s, transform .16s; }
.button:active { transform: translateY(1px); }
.button:disabled { opacity: .55; }
.button-primary { background: var(--purple); color: white; }
.button-primary:hover:not(:disabled) { background: var(--purple-dark); }
.button-outline, .resume-button { background: white; color: #493b62; border-color: var(--line); }
.button-outline:hover, .resume-button:hover { background: #f5f0ff; }
.resume-button { padding-inline: 12px; font-size: .875rem; }
.resume-button .icon { color: var(--purple); width: 17px; height: 17px; }
.star-chip { min-height: 43px; display: inline-flex; align-items: center; gap: 7px; padding: 0 11px; border-radius: 12px; background: #fff3ce; color: #694410; font-size: .875rem; font-weight: 650; white-space: nowrap; }
.star-chip .icon { width: 17px; height: 17px; fill: #ffca4c; color: #96591f; }
.star-chip strong { margin-left: 2px; font-variant-numeric: tabular-nums; }

.home-main { padding-block: 30px 52px; }
.hero { min-height: 352px; position: relative; isolation: isolate; display: grid; align-items: center; overflow: hidden; border-radius: 26px; background: #20194e url('/assets/rocket.webp') center 53% / cover no-repeat; box-shadow: 0 16px 40px #30236d22; color: white; }
.hero::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, #1d164a 0%, #1d164ae0 24%, #1d164a20 65%, #1d164a00 100%); pointer-events: none; }
.hero-content { position: relative; z-index: 1; padding: 36px 43px; }
.hero-sky { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.hero-sky span { position: absolute; width: 17px; height: 17px; color: #ffe7a1; filter: drop-shadow(0 0 6px currentColor); opacity: .55; }
.hero-sky span::before, .hero-sky span::after { content: ""; position: absolute; inset: 0; margin: auto; background: currentColor; border-radius: 50%; }
.hero-sky span::before { width: 100%; height: 2px; }
.hero-sky span::after { width: 2px; height: 100%; }
.hero-sky span:nth-child(1) { top: 17%; right: 34%; }
.hero-sky span:nth-child(2) { top: 15%; right: 7%; width: 11px; height: 11px; color: #d4bdff; }
.hero-sky span:nth-child(3) { bottom: 21%; right: 41%; width: 13px; height: 13px; }
.hero-sky span:nth-child(4) { bottom: 14%; right: 7%; }
.hero-sky span:nth-child(5) { top: 28%; right: 46%; width: 9px; height: 9px; color: #d4bdff; }
.hero-label { display: inline-flex; align-items: center; gap: 7px; color: #ddd3ff; font-size: .9rem; font-weight: 750; margin-bottom: 12px; }
.hero-label .icon { width: 16px; height: 16px; fill: #e8d397; color: #ffe5a2; }
.hero h1 { font-size: clamp(2.75rem, 5.6vw, 4.25rem); line-height: 1.04; letter-spacing: -.08em; font-weight: 900; }
.hero h1 em { color: #ffda75; font-style: normal; }
.hero-description { margin: 17px 0 22px; line-height: 1.55; color: #e5ddfc; font-size: 1.04rem; word-break: keep-all; }
.button-sun { min-height: 47px; padding-inline: 16px 20px; background: #ffda75; color: #2d2045; box-shadow: 0 4px 0 #bb8039; }
.button-sun:hover { background: #ffe398; }
.button-sun .icon { width: 21px; height: 21px; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.button-hero-guide { min-height: 47px; background: #21194cbd; color: #fff; border-color: #b6a3e0; }
.button-hero-guide:hover { background: #463077; }
.button-hero-guide .icon { width: 18px; height: 18px; color: #e4d4ff; }

.games-section { margin-top: 40px; }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 18px; }
.section-heading h2 { font-size: clamp(1.5rem, 3vw, 2.04rem); font-weight: 850; letter-spacing: -.065em; }
.topic-chip { font-size: .875rem; background: #eeebfc; color: #554384; padding: 7px 12px; border-radius: 999px; font-weight: 750; white-space: nowrap; }
.game-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.game-card { overflow: hidden; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 21px; background: white; box-shadow: 0 4px 11px #34265a09; transition: transform .2s, box-shadow .2s, border-color .2s; }
.game-card:hover { transform: translateY(-4px); box-shadow: 0 12px 22px #34265a14; border-color: #cbbbef; }
.card-art { height: 182px; background-image: url('/assets/games.webp'); background-size: 300% auto; background-repeat: no-repeat; }
.art-group { background-color: #e9e0ff; background-position: left center; }
.art-equation { background-color: #fff1cd; background-position: center; }
.art-quiz { background-color: #dff5ea; background-position: right center; }
.card-content { display: flex; justify-content: space-between; align-items: center; gap: 9px; flex: 1; padding: 18px 16px 19px; }
.card-content h3 { font-size: 1.22rem; font-weight: 850; letter-spacing: -.045em; }
.card-content p { color: var(--muted); font-size: .9rem; margin-top: 4px; line-height: 1.55; word-break: keep-all; }
.card-play { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; flex-shrink: 0; transition: transform .2s ease; }
.card-play .icon { margin-left: 2px; width: 22px; height: 22px; }
.game-card:is(:hover, :focus-visible) .card-play { transform: scale(1.09) rotate(-8deg); }
.card-group .card-play { background: #eee8ff; color: #5b39c7; }
.card-equation .card-play { background: #fff2c9; color: #80521b; }
.card-quiz .card-play { background: #dff5e9; color: #20624f; }

.resume-dialog { width: min(430px, calc(100% - 30px)); max-height: calc(100% - 30px); border: 1px solid var(--line); border-radius: 22px; padding: 24px; background: white; color: var(--ink); box-shadow: 0 16px 60px #220b5447; }
.resume-dialog::backdrop { background: #1e153f82; }
.dialog-heading { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.dialog-heading h2 { font-size: 1.5rem; letter-spacing: -.055em; }
.icon-button { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; border: 0; background: #f2edfc; color: #493274; }
.icon-button:hover { background: #eae0fc; }
.resume-dialog p { color: var(--muted); line-height: 1.55; word-break: keep-all; }
.resume-dialog label { display: block; font-weight: 750; margin: 20px 0 7px; font-size: .95rem; }
.resume-dialog input { width: 100%; min-width: 0; min-height: 46px; padding: 8px 10px; border: 1px solid #cec4e5; border-radius: 10px; background: #fbf9ff; color: var(--ink); }
.code-row { display: flex; gap: 7px; }
.code-row input { font-family: ui-monospace, monospace; font-size: .81rem; }
.code-row button { padding-inline: 10px; }
.restore-form > button { margin-top: 9px; width: 100%; }
.dialog-status { margin-top: 14px; min-height: 1.6em; font-size: .92rem; }

@media (max-width: 800px) {
  .frame { padding-inline: 20px; }
  .card-content { align-items: flex-start; }
  .card-play { width: 33px; height: 33px; }
  .card-art { height: 130px; }
}

@media (max-width: 600px) {
  .frame { padding-inline: 15px; }
  .header-content { min-height: 64px; }
  .brand { gap: 7px; font-size: 1.16rem; }
  .brand img { width: 32px; height: 32px; }
  .header-actions { gap: 5px; }
  .resume-button, .star-chip { padding-inline: 8px; }
  .home-main { padding-block: 16px 34px; }
  .hero { min-height: 380px; border-radius: 20px; align-items: end; background-size: auto 105%; background-position: 91% bottom; }
  .hero::before { background: linear-gradient(0deg, #1d164af7, #1d164abf 42%, #1d164a12 78%); }
  .hero-content { padding: 25px 22px; }
  .hero-description { margin-block: 13px 18px; }
  .hero-actions { gap: 8px; }
  .hero-actions .button { padding-inline: 9px; font-size: .88rem; gap: 4px; }
  .hero-sky span:nth-child(3), .hero-sky span:nth-child(4) { display: none; }
  .games-section { margin-top: 27px; }
  .section-heading { margin-bottom: 13px; }
  .game-cards { grid-template-columns: 1fr; gap: 11px; }
  .game-card { flex-direction: row; min-height: 104px; border-radius: 16px; }
  .card-art { width: min(28%, 115px); height: auto; flex: none; background-size: auto 100%; }
  .card-content { padding: 13px 10px 13px 12px; align-items: center; }
  .card-content h3 { font-size: 1.12rem; }
  .card-content p { margin-top: 3px; }
}

@media (prefers-reduced-motion: no-preference) {
  .hero-sky span { animation: sky-twinkle 2.8s ease-in-out; }
  .hero-sky span:nth-child(2) { animation-delay: .6s; }
  .hero-sky span:nth-child(3) { animation-delay: .18s; }
  .hero-sky span:nth-child(4) { animation-delay: .95s; }
  .hero-sky span:nth-child(5) { animation-delay: .4s; }
}

@keyframes sky-twinkle {
  0%, 100% { opacity: .55; transform: scale(1); }
  30% { opacity: .25; transform: scale(.65); }
  57% { opacity: 1; transform: scale(1.4) rotate(12deg); }
  75% { opacity: .38; transform: scale(.9); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
