:root { font-family: system-ui, -apple-system, sans-serif; color-scheme: light; }
* { box-sizing: border-box; }
body { margin: 0; min-height: 100svh; display: grid; place-items: center; padding: 20px; color: #5c2a46; background: radial-gradient(circle at 50% 35%, #fff2f8 0%, #ffc6de 55%, #ff9ec6 100%); transition: background .35s, color .35s; }
body[data-mood="bright"] { background: radial-gradient(circle at 50% 40%, #fff5fa 0%, #ffb8d8 45%, #ff8bbd 100%); color: #7a2f52; }
body[data-mood="dark"] { background: radial-gradient(circle at 50% 40%, #6b3350, #2a1220 75%); color: #ffe3f0; color-scheme: dark; }
main { width: min(100%, 360px); text-align: center; padding: 26px 22px; border: 1px solid #ffffff80; border-radius: 28px; background: #fff5fa66; box-shadow: 0 10px 30px #d94f8b26; }
h1 { font-size: 22px; margin: 0 0 20px; }
.leds { display: grid; grid-template-columns: repeat(10, 1fr); grid-template-rows: repeat(10, 1fr); gap: clamp(2px, 1.2vw, 5px); width: 100%; aspect-ratio: 1 / 1; padding: 10px; margin: 0 auto 12px; border-radius: 16px; background: #ffd9e8; box-shadow: inset 0 0 0 1px #f6b8d2; }
.leds span { width: 100%; height: 100%; border-radius: 22%; background: #ffd9e8; box-shadow: inset 0 0 2px #f6b8d2; transition: background .25s, box-shadow .25s; }
.leds span.on { background: var(--led, #d81b74); box-shadow: 0 0 9px var(--led, #d81b74); }
output { display: block; font-size: 38px; font-weight: 700; margin: 6px 0 14px; font-variant-numeric: tabular-nums; }
.keycap { margin: 16px 0 7px; padding: 14px 25px; min-height: 48px; border: 1px solid #c5ccda; border-bottom: 4px solid #a5afc1; border-radius: 12px; background: linear-gradient(#fff, #e1e7f1); color: #354158; box-shadow: 0 6px 0 #8894aa, 0 9px 12px #00000025; font: inherit; font-weight: 700; cursor: pointer; touch-action: manipulation; }
.keycap:active:not(:disabled) { transform: translateY(5px); box-shadow: 0 1px 0 #8894aa, 0 3px 5px #00000020; }
.keycap:focus-visible { outline: 3px solid currentColor; outline-offset: 5px; }
.keycap:disabled { opacity: .55; cursor: default; }
.panel { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.panel[hidden] { display: none; }
.panel output { margin: 0; }
.panel .keycap { margin: 4px 0; }
/* ‘점수 등록’과 ‘처음부터’ 버튼을 한 줄에 나란히 배치합니다. */
.panel .action-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; }
.panel .action-row .keycap { margin: 4px 0; }
.panel .toy-key { margin: 4px auto; }
.slider-label { margin: 0; font-size: 16px; font-weight: 700; }
/* 시작 화면: ‘내 기분 점수’ 글자, 막대, 점수, ‘시작’ 버튼을 한 줄에 나란히 표시합니다. */
#start-panel { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; }
#start-panel .slider-label { font-size: 13px; white-space: nowrap; }
#start-panel .start-score { font-size: 22px; }
#start-panel .mood-slider { flex: 1 1 90px; width: auto; min-width: 70px; }
#start-panel .keycap { margin: 0; padding: 10px 14px; white-space: nowrap; }
.mood-slider { width: 100%; height: 34px; margin: 0; background: none; -webkit-appearance: none; appearance: none; cursor: pointer; touch-action: manipulation; }
.mood-slider::-webkit-slider-runnable-track { height: 12px; border-radius: 999px; background: linear-gradient(90deg, #ffe0ee, #ff9ec6, #ff7fb8, #ff4f9a); box-shadow: inset 0 1px 3px #00000033; }
.mood-slider::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 30px; height: 30px; margin-top: -9px; border: 3px solid #fff; border-radius: 50%; background: #ff4f9a; box-shadow: 0 2px 6px #00000055; }
.mood-slider::-moz-range-track { height: 12px; border-radius: 999px; background: linear-gradient(90deg, #ffe0ee, #ff9ec6, #ff7fb8, #ff4f9a); }
.mood-slider::-moz-range-thumb { width: 24px; height: 24px; border: 3px solid #fff; border-radius: 50%; background: #ff4f9a; box-shadow: 0 2px 6px #00000055; }
.mood-slider:focus-visible { outline: 3px solid currentColor; outline-offset: 4px; }
.start-score { font-size: 34px; }
.gained { margin: 0; font-size: 13px; font-variant-numeric: tabular-nums; opacity: .85; }
.ranking-status { margin: 0; font-size: 13px; line-height: 1.5; }
.ranking-status:empty { display: none; }
.keycap[hidden] { display: none; }
/* 인형만 남긴 키캡 버튼 */
.toy-key { position: relative; display: block; width: 132px; height: 128px; margin: 8px auto 4px; padding: 0; border: 0; border-radius: 15px; background: none; box-shadow: none; isolation: isolate; transform-origin: 50% 88%; -webkit-tap-highlight-color: transparent; }
.toy-key:active:not(:disabled) { transform: none; box-shadow: none; }
.key-top { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; border: 0; background: none; box-shadow: none; transition: transform 65ms ease-out; }
.key-doll { display: block; width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 5px 5px #00000033); -webkit-user-drag: none; user-select: none; }
.toy-key:disabled { opacity: .65; }
/* 토끼는 평소에 가만히 있고, 누를 때마다 아래쪽을 축으로 왼쪽·오른쪽으로 번갈아 한 번씩 회전하듯 기웁니다. 위아래로는 움직이지 않습니다. */
.toy-key.shake-left { animation: doll-shake-left 320ms ease-in-out; }
.toy-key.shake-right { animation: doll-shake-right 320ms ease-in-out; }
@keyframes doll-shake-left { 0% { transform: rotate(0deg); } 25% { transform: rotate(-13deg); } 60% { transform: rotate(6deg); } 100% { transform: rotate(0deg); } }
@keyframes doll-shake-right { 0% { transform: rotate(0deg); } 25% { transform: rotate(13deg); } 60% { transform: rotate(-6deg); } 100% { transform: rotate(0deg); } }
@media (max-height: 520px) { .toy-key { width: 106px; height: 104px; } @keyframes doll-shake-left { 0% { transform: rotate(0deg); } 25% { transform: rotate(-11deg); } 60% { transform: rotate(5deg); } 100% { transform: rotate(0deg); } } @keyframes doll-shake-right { 0% { transform: rotate(0deg); } 25% { transform: rotate(11deg); } 60% { transform: rotate(-5deg); } 100% { transform: rotate(0deg); } } }
@media (prefers-reduced-motion: reduce) { .key-top { transition: none; } .toy-key.shake-left, .toy-key.shake-right { animation: none; } }
.leds { max-width: min(100%, max(80px, calc(100svh - 450px))); }
@media (prefers-reduced-motion: reduce) { body { transition: none; } }
@media (max-height: 430px) { body { padding: 12px; } main { padding: 12px 20px; } h1 { margin-bottom: 6px; } .leds { padding: 6px; margin-bottom: 6px; } output { font-size: 26px; margin: 2px 0; } }
@media (prefers-reduced-motion: reduce) { .leds span { transition: none; } }
