/* 김재숙 여사님 전용 라디오 — 70대 이상 어르신이 쓰기 쉬운 큰 글씨 / 큰 버튼 디자인 */

:root {
  --bg: #FBF4EA;
  --surface: #FFFFFF;
  --surface-press: #F4ECE2;
  --ink: #231B15;
  --ink-2: #574C43;
  --ink-3: #7D7065;
  --line: #EEE3D6;
  --accent: #D4470C;
  --accent-ink: #A83A0A;
  --accent-soft: #FFEDE1;
  --accent-shadow: #9C3406;
  --go: #2B8A3E;
  --go-shadow: #1E6A2E;
  --star: #F7B500;
  --star-edge: #D69A00;
  --star-ink: #8A5F00;
  --danger: #C92A2A;
  --player: #20304B;
  --player-ink-2: #C8D2E5;
  --radius: 22px;
  --shadow: 0 1px 2px rgba(70, 45, 20, .06), 0 8px 22px rgba(70, 45, 20, .07);
  --player-h: 112px;
  color-scheme: light;
}

html { font-size: 112.5%; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html.big { font-size: 131.25%; }

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
[hidden] { display: none !important; }

body {
  font-family: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, system-ui, 'Apple SD Gothic Neo', 'Noto Sans KR', 'Malgun Gothic', sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.45;
  letter-spacing: -0.01em;
  word-break: keep-all;
  overflow-wrap: anywhere;
  -webkit-tap-highlight-color: transparent;
  padding-bottom: calc(var(--player-h) + 28px);
  min-height: 100vh;
}

button { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; touch-action: manipulation; }
button:focus-visible { outline: 4px solid #1C7ED6; outline-offset: 2px; }
svg { flex: none; }
b { font-weight: 800; }

.app { max-width: 600px; margin: 0 auto; padding: 0 16px; }

/* ------------------------------------------------------------------ 상단 */

.hero {
  position: relative;
  margin-top: calc(12px + env(safe-area-inset-top));
  padding: 16px 18px 22px 20px;
  border-radius: 28px;
  background:
    radial-gradient(120% 90% at 100% 0%, rgba(255, 255, 255, .45), transparent 60%),
    linear-gradient(140deg, #FFDCC2 0%, #FFC4A3 55%, #FFAE88 100%);
  overflow: hidden;
}

.hero-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

.logo { display: flex; align-items: center; gap: 8px; font-size: 1.15rem; font-weight: 800; color: #5B3A29; letter-spacing: -0.02em; }
.logo img { flex: none; border-radius: 10px; box-shadow: 0 2px 6px rgba(91, 58, 41, .25); }
.logo { min-width: 0; }
.logo-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.logo-name { word-break: keep-all; }
.logo-by { margin-top: 2px; font-size: .72rem; font-weight: 600; color: #7A5442; letter-spacing: 0; }

.text-size {
  flex: none;
  display: flex; align-items: center; gap: 6px;
  min-height: 52px; padding: 6px 14px 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .72);
  box-shadow: 0 2px 0 rgba(91, 58, 41, .15);
  color: #4A2E20; font-weight: 800; font-size: .95rem;
}
.text-size:active { transform: translateY(1px); box-shadow: none; }
.text-size-mark { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 50%; background: #5B3A29; color: #fff; font-size: 1rem; line-height: 1; }
.text-size-mark b { font-size: .8em; margin-left: 1px; }

.hero-body { display: flex; align-items: flex-end; gap: 8px; margin-top: 14px; }
.hero-text { flex: 1; min-width: 0; }
.greeting { font-size: 1.62rem; font-weight: 800; line-height: 1.3; letter-spacing: -0.03em; color: #2E1C12; }
.greeting span:first-child { display: block; }
.today { margin-top: 8px; font-size: 1.12rem; font-weight: 600; color: #5B3A29; }
.today .dot { margin: 0 2px; }
.today span { white-space: nowrap; }

.hero-radio { width: 112px; height: 90px; margin-right: -6px; margin-bottom: -4px; }
.hero-radio .waves path { opacity: 0; }
body.is-playing .hero-radio .w1 { animation: wave 1.6s ease-out infinite; }
body.is-playing .hero-radio .w2 { animation: wave 1.6s ease-out .4s infinite; }
body.is-playing .hero-radio { animation: bob 1.6s ease-in-out infinite; }
@keyframes wave { 0% { opacity: 0; } 30% { opacity: 1; } 100% { opacity: 0; } }
@keyframes bob { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-2deg); } }

/* ------------------------------------------------------------------ 섹션 */

.section { margin-top: 30px; }
.section-head { display: flex; align-items: center; gap: 10px; margin: 0 4px 14px; }
.section-head h2 { font-size: 1.4rem; font-weight: 800; letter-spacing: -0.02em; }
.section-icon { width: 30px; height: 30px; color: var(--ink-2); }
.section-icon.star-on { fill: var(--star); stroke: var(--star-edge); stroke-width: 1.4; stroke-linejoin: round; }
.count { min-width: 34px; height: 34px; padding: 0 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); font-weight: 800; font-size: 1rem; display: grid; place-items: center; }

.station-list { list-style: none; padding: 0; display: grid; gap: 12px; }

/* ------------------------------------------------------------------ 방송 카드 */

.station {
  display: flex; align-items: stretch;
  background: var(--surface);
  border: 3px solid transparent;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: border-color .2s, background-color .2s;
}

.station-main {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 14px;
  min-height: 100px;
  padding: 14px 8px 14px 14px;
  text-align: left;
  transition: background-color .15s;
}
.station-main:active { background: var(--surface-press); }

.badge {
  flex: none;
  width: 54px; height: 54px;
  display: grid; place-items: center;
  border-radius: 17px;
  background: var(--c, #555);
  color: #fff;
  font-size: .8rem; font-weight: 800; letter-spacing: 0;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .18);
}

.info { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.name { font-size: 1.45rem; font-weight: 800; line-height: 1.25; letter-spacing: -0.025em; }
.meta { font-size: 1.02rem; font-weight: 500; color: var(--ink-2); line-height: 1.35; }
.freq { font-weight: 700; color: var(--ink); }

.live { display: none; align-items: center; gap: 8px; margin-top: 4px; font-size: 1.02rem; font-weight: 800; color: var(--accent-ink); }

.station.is-playing,
.station.is-loading { border-color: var(--accent); background: var(--accent-soft); }
.station.is-playing .station-main:active,
.station.is-loading .station-main:active { background: #FFE2CF; }
.station.is-error { border-color: var(--danger); }
.station.is-playing .live,
.station.is-loading .live,
.station.is-error .live { display: inline-flex; }
.station.is-error .live { color: var(--danger); }

.fav {
  flex: none;
  width: 78px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  border-left: 2px solid var(--line);
  color: var(--ink-3);
  transition: background-color .15s;
}
.station.is-playing .fav, .station.is-loading .fav { border-left-color: #F6D3BD; }
.fav:active { background: var(--surface-press); }
.fav svg { width: 38px; height: 38px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; transition: transform .15s; }
.fav:active svg { transform: scale(.86); }
.fav-label { font-size: .78rem; font-weight: 700; letter-spacing: -0.02em; }
.fav[aria-pressed="true"] { color: var(--star-ink); }
.fav[aria-pressed="true"] svg { fill: var(--star); stroke: var(--star-edge); }
.fav.pop svg { animation: pop .45s ease-out; }
@keyframes pop { 0% { transform: scale(.6); } 55% { transform: scale(1.25); } 100% { transform: scale(1); } }

/* 소리 막대 (재생 중 표시) */
.eq { display: inline-flex; align-items: flex-end; gap: 3px; width: 19px; height: 18px; }
.eq i { display: block; width: 4px; height: 40%; border-radius: 2px; background: currentColor; }
.is-playing .eq i, .player[data-state="playing"] .eq i { animation: eq .9s ease-in-out infinite; }
.is-playing .eq i:nth-child(2), .player[data-state="playing"] .eq i:nth-child(2) { animation-delay: -.3s; }
.is-playing .eq i:nth-child(3), .player[data-state="playing"] .eq i:nth-child(3) { animation-delay: -.6s; }
.is-loading .eq i, .player[data-state="loading"] .eq i { animation: blink 1.2s ease-in-out infinite; height: 4px; }
.is-loading .eq i:nth-child(2), .player[data-state="loading"] .eq i:nth-child(2) { animation-delay: .2s; }
.is-loading .eq i:nth-child(3), .player[data-state="loading"] .eq i:nth-child(3) { animation-delay: .4s; }
.is-error .eq { display: none; }
@keyframes eq { 0%, 100% { height: 25%; } 50% { height: 100%; } }
@keyframes blink { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }

/* 즐겨찾기가 비었을 때 */
.empty {
  padding: 22px 18px;
  border: 3px dashed #E3D2BF;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .55);
  text-align: center;
  font-size: 1.1rem; color: var(--ink-2); line-height: 1.6;
}
.empty strong { display: block; margin-bottom: 6px; font-size: 1.25rem; color: var(--ink); }
.star-inline { display: inline-flex; align-items: center; gap: 2px; font-weight: 800; color: var(--star-ink); }
.star-inline svg { width: 1.25em; height: 1.25em; fill: var(--star); stroke: var(--star-edge); stroke-width: 1.4; stroke-linejoin: round; }

.load-error { padding: 20px; border-radius: var(--radius); background: #FFF0F0; color: var(--danger); font-size: 1.1rem; font-weight: 600; text-align: center; }

/* ------------------------------------------------------------------ 도움말 */

.help { margin-top: 34px; padding: 22px 20px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.help h2 { font-size: 1.3rem; font-weight: 800; }
.help ol { list-style: none; padding: 0; margin-top: 14px; display: grid; gap: 14px; counter-reset: step; }
.help li { display: flex; align-items: flex-start; gap: 12px; font-size: 1.1rem; line-height: 1.5; color: var(--ink-2); }
.help li b { color: var(--ink); }
.help li::before {
  counter-increment: step; content: counter(step);
  flex: none; width: 34px; height: 34px; margin-top: -2px;
  display: grid; place-items: center;
  border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink);
  font-weight: 800; font-size: 1rem;
}
.install { margin-top: 20px; }
.install-btn {
  width: 100%; min-height: 64px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  border-radius: 18px; background: #5B3A29; color: #fff;
  font-size: 1.15rem; font-weight: 800;
  box-shadow: 0 4px 0 #3B2419;
}
.install-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 #3B2419; }
.install-btn svg { width: 28px; height: 28px; }
.install-ios { margin-top: 18px; padding: 14px 16px; border-radius: 16px; background: var(--bg); font-size: 1.05rem; color: var(--ink-2); line-height: 1.55; }

.credit { margin: 22px 4px 0; text-align: center; font-size: .9rem; color: var(--ink-3); }
.credit .made-by { display: inline-block; margin-top: 6px; font-weight: 700; }

/* ------------------------------------------------------------------ 아래 재생 바 */

.player {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
  border-radius: 26px 26px 0 0;
  background: var(--player);
  color: #fff;
  box-shadow: 0 -10px 30px rgba(20, 28, 45, .22);
}
.player-inner { max-width: 568px; min-height: 76px; margin: 0 auto; display: flex; align-items: center; gap: 14px; }

.player-hint { display: none; flex: 1; text-align: center; font-size: 1.2rem; font-weight: 700; color: var(--player-ink-2); }
.player[data-state="idle"] .player-hint { display: block; }
.player[data-state="idle"] .player-badge,
.player[data-state="idle"] .player-text,
.player[data-state="idle"] .player-btn { display: none; }

.player-badge { width: 50px; height: 50px; border-radius: 15px; font-size: .74rem; }
.player-text { flex: 1; min-width: 0; }
.player-status { display: flex; align-items: center; gap: 8px; font-size: 1rem; font-weight: 700; color: var(--player-ink-2); }
.player[data-state="playing"] .player-status { color: #FFC9A8; }
.player[data-state="error"] .player-status { color: #FFB3B3; }
.player[data-state="stopped"] .player-status .eq,
.player[data-state="error"] .player-status .eq { display: none; }
.player-name { font-size: 1.38rem; font-weight: 800; line-height: 1.25; letter-spacing: -0.025em; }

.player-btn {
  flex: none;
  display: flex; align-items: center; gap: 6px;
  height: 70px; padding: 0 22px 0 16px;
  border-radius: 999px;
  background: var(--accent); color: #fff;
  font-size: 1.3rem; font-weight: 800;
  box-shadow: 0 4px 0 var(--accent-shadow);
}
.player-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--accent-shadow); }
.player-btn svg { width: 32px; height: 32px; fill: currentColor; }
.player[data-state="stopped"] .player-btn { background: var(--go); box-shadow: 0 4px 0 var(--go-shadow); }
.player[data-state="error"] .player-btn { background: #fff; color: var(--player); box-shadow: 0 4px 0 #9AA7C0; }

/* ------------------------------------------------------------------ 알림 */

.toast {
  position: fixed; left: 16px; right: 16px; z-index: 30;
  bottom: calc(var(--player-h) + 12px);
  max-width: 568px; margin: 0 auto;
  display: flex; align-items: center; gap: 12px;
  padding: 16px 18px;
  border-radius: 18px;
  background: #2A211B; color: #fff;
  font-size: 1.1rem; line-height: 1.4;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
  opacity: 0; transform: translateY(14px);
  pointer-events: none;
  transition: opacity .25s, transform .25s;
}
.toast.show { opacity: 1; transform: none; pointer-events: auto; }
.toast strong { display: block; font-size: 1.15rem; }
.toast-text { flex: 1; min-width: 0; }
.toast-action { flex: none; min-height: 52px; padding: 0 16px; border-radius: 14px; background: #fff; color: #2A211B; font-size: 1.05rem; font-weight: 800; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .eq i { height: 70% !important; }
}
