* { box-sizing: border-box; }
:root { --accent: #8b5cf6; --accent2: #ec4899; --ink: #1f1633; --muted: #756c8c; --line: #e9e2f7; --good: #0aa86e; --bad: #e0435a; --gr-accent: #8b5cf6; }
html, body { margin: 0; color: var(--ink); font-family: Pretendard, "Noto Sans KR", system-ui, "Malgun Gothic", sans-serif; }
body { min-height: 100vh; background: radial-gradient(circle at 20% 0%, #fbe7ff, transparent 50%), radial-gradient(circle at 90% 30%, #e3e9ff, transparent 45%), #f8f5ff; }
button, input { font: inherit; }
button { cursor: pointer; color: inherit; }
[hidden] { display: none !important; }

.bar { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 16px; background: #fff; border-bottom: 1px solid var(--line); }
.bar a { color: var(--ink); text-decoration: none; font-weight: 800; white-space: nowrap; }
.bar button { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 6px 12px; white-space: nowrap; }

.shell { max-width: 620px; margin: 0 auto; padding: 20px 16px 48px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 26px; padding: 26px 22px; text-align: center; box-shadow: 0 16px 40px #8b5cf61c; }
h1 { margin: 4px 0 8px; font-size: clamp(28px, 7vw, 38px); }
.lead { color: var(--muted); line-height: 1.6; }
.small { color: var(--muted); font-size: 14px; line-height: 1.6; margin-bottom: 0; }
.example { display: inline-block; margin: 6px 0 16px; padding: 10px 18px; border-radius: 14px; background: #f3edff; font-weight: 800; color: var(--muted); }
.example span { color: var(--accent); font-size: 22px; letter-spacing: 3px; }

.kind-row { display: inline-flex; gap: 4px; padding: 5px; border: 1px solid var(--line); border-radius: 14px; margin-bottom: 16px; }
.kind-btn, .gen-btn { border: 0; background: transparent; border-radius: 10px; padding: 8px 14px; font-weight: 800; color: var(--muted); }
.kind-btn[aria-pressed="true"], .gen-btn[aria-pressed="true"] { background: var(--accent); color: #fff; }

.primary { border: 0; border-radius: 14px; padding: 12px 20px; font-weight: 900; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent2)); }
.primary.big { display: block; width: 100%; max-width: 320px; margin: 0 auto; padding: 15px; font-size: 19px; }

.top-row { display: flex; justify-content: space-between; align-items: center; }
.pill { padding: 5px 12px; border-radius: 999px; background: #f3edff; color: var(--accent); font-weight: 900; }
.score { font-weight: 900; font-size: 18px; }
.timer { height: 10px; margin: 14px 0 4px; border-radius: 99px; background: #f1ebfb; overflow: hidden; }
.timer i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width .1s linear; }
.timer i.low { background: var(--bad); }
.sec-left { margin: 0; color: var(--muted); font-weight: 800; font-variant-numeric: tabular-nums; }
.chosung { margin: 18px 0 6px; font-size: clamp(40px, 12vw, 64px); font-weight: 900; letter-spacing: 6px; color: var(--accent); word-break: keep-all; }
.chosung.good { color: var(--good); letter-spacing: 1px; animation: pop .35s ease-out; }
.chosung.bad { color: var(--bad); letter-spacing: 1px; }
.hint-line { min-height: 1.4em; margin: 0 0 12px; color: #a35c00; font-weight: 800; }
.answer-row { display: flex; gap: 8px; }
.answer-row input { flex: 1; min-width: 0; padding: 13px 14px; border: 2px solid var(--line); border-radius: 14px; font-size: 18px; outline: none; }
.answer-row input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px #8b5cf622; }
.answer-row input.shake { animation: shake .3s; }
.feedback { min-height: 1.5em; margin: 10px 0; font-weight: 900; }
.feedback.good { color: var(--good); }
.feedback.bad { color: var(--bad); }
.tools { display: flex; justify-content: center; gap: 10px; }
.tools button { border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 9px 16px; font-weight: 800; }
.tools button:disabled { opacity: .4; cursor: default; }

.final { margin: 6px 0; font-size: 22px; }
.final b { font-size: 56px; color: var(--accent); }
.end-actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.end-actions button:not(.primary) { border: 1px solid var(--line); background: #fff; border-radius: 14px; padding: 12px 18px; font-weight: 800; }
.review { list-style: none; padding: 0; margin: 0; text-align: left; }
.review li { display: grid; grid-template-columns: 7.5em 1fr auto; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 12px; }
.review li:nth-child(odd) { background: #faf7ff; }
.review .cho { color: var(--muted); font-weight: 800; letter-spacing: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.review li.good .pt { color: var(--good); font-weight: 900; }
.review li.bad .nm { color: var(--bad); }

@keyframes pop { from { transform: scale(.8); } to { transform: scale(1); } }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
@media (prefers-reduced-motion: reduce) { .chosung.good, .answer-row input.shake { animation: none; } .timer i { transition: none; } }
@media (max-width: 480px) { .card { padding: 20px 14px; } .review li { grid-template-columns: 6em 1fr auto; } }
