:root {
  color-scheme: light;
  --ink: #203e34;
  --ink-soft: #4a6759;
  --line: #d5e2d5;
  --paper: #fffefa;
  --focus: #174b80;
  --shadow: 0 10px 35px rgba(42, 69, 47, .1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: #f4f8ed; color: var(--ink); font-family: 'Apple SD Gothic Neo', 'Noto Sans KR', 'Malgun Gothic', system-ui, sans-serif; -webkit-text-size-adjust: 100%; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
[hidden] { display: none !important; }
:focus-visible { outline: 4px solid var(--focus); outline-offset: 3px; }

.skip-link { position: absolute; left: -9999px; top: 8px; z-index: 100; padding: 10px 16px; background: #fff; color: var(--ink); border-radius: 10px; }
.skip-link:focus { left: 8px; }
.site-head { min-height: 66px; padding: 9px max(20px, calc((100vw - 1160px)/2)); display: flex; align-items: center; justify-content: space-between; gap: 16px; background: #fffefa; border-bottom: 1px solid #dde8d7; }
.site-head a { color: #245740; font-weight: 750; text-decoration: none; }
.site-head a:hover { text-decoration: underline; }
.home-link { display: inline-flex; min-height: 44px; min-width: 44px; align-items: center; white-space: nowrap; font-size: 15px; }
.site-name { font-size: 18px; font-weight: 900; letter-spacing: -.04em; text-align: center; }
.choose-link { display: inline-flex; align-items: center; gap: 5px; min-height: 44px; border: 1.5px solid #77a77c; border-radius: 100px; padding: 7px 15px; background: #edf7e9; font-size: 14px; text-align: center; }

.forest-hero { min-height: 225px; background: linear-gradient(90deg, rgba(255,252,241,.96) 0%, rgba(255,252,241,.86) 40%, rgba(255,252,241,.13) 72%), url('/art/garden.webp') center 53% / cover no-repeat; border-bottom: 1px solid #dbe5cd; }
.hero-inner { max-width: 1120px; margin: 0 auto; padding: 34px 20px 74px; }
.eyebrow, .section-kicker { display: block; color: #3a6d4e; font-size: 13px; font-weight: 900; letter-spacing: .035em; }
.hero-inner h1 { max-width: 580px; margin: 8px 0 8px; color: #1e4a38; font-size: clamp(31px, 4.2vw, 49px); line-height: 1.18; letter-spacing: -.065em; }
.hero-inner p { margin: 0; color: #365d49; font-size: clamp(16px, 2vw, 19px); font-weight: 650; line-height: 1.55; }
.page-shell { max-width: 1120px; margin: -52px auto 0; padding: 0 20px 112px; position: relative; }

.speech-panel { position: sticky; top: 8px; z-index: 10; display: flex; align-items: center; gap: 20px; justify-content: space-between; min-height: 136px; padding: 18px 22px; background: var(--paper); border: 2px solid #a8c9ab; border-radius: 24px; box-shadow: 0 14px 35px rgba(36, 69, 46, .16); }
.settings-open .speech-panel { position: relative; top: auto; }
.speech-panel-main { display: flex; align-items: center; gap: 17px; min-width: 0; }
.selected-icon { width: 85px; height: 85px; flex: none; display: grid; place-items: center; border-radius: 20px; background: #e8f2e5; }
.selected-icon svg { width: 69px; height: 69px; }
.speech-copy { min-width: 0; }
.speech-copy h2 { margin: 0 0 3px; color: #56735e; font-size: 13px; font-weight: 850; }
.selected-phrase { margin: 0; color: #143e31; font-size: clamp(23px, 2.9vw, 32px); line-height: 1.3; font-weight: 900; letter-spacing: -.055em; overflow-wrap: anywhere; }
.speech-status { margin: 6px 0 0; color: #526959; font-size: 13px; line-height: 1.4; }
.repeat-button { flex: none; min-height: 50px; padding: 11px 16px; border-radius: 13px; border: 2px solid #467851; background: #e8f5e6; color: #245038; font-size: 15px; font-weight: 850; }
.repeat-button:hover:not(:disabled) { background: #d9ebd6; }
.repeat-button:disabled { opacity: .48; }

.board-footer-controls { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin: 22px 0 12px; font-size: 14px; font-weight: 800; color: #41624e; }
.segmented-control { display: flex; padding: 4px; border: 1px solid #b8d3b5; background: #e5f1e1; border-radius: 13px; }
.segmented-control button { min-height: 40px; border: 0; border-radius: 9px; padding: 6px 14px; background: transparent; color: #3d644b; font-weight: 800; }
.segmented-control button[aria-pressed="true"] { background: #fff; color: #194d32; box-shadow: 0 2px 7px rgba(24, 63, 37, .16); }

.board-section { margin-top: 31px; }
.board-section.essentials { margin-top: 19px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin: 0 0 15px; }
.section-heading h2 { margin: 4px 0 0; color: #1c4a36; font-size: clamp(24px, 3.2vw, 30px); line-height: 1.2; letter-spacing: -.05em; }
.fixed-note { display: inline-block; padding: 8px 12px; border: 1px solid #cee0c7; border-radius: 100px; background: #fffefa; color: #4b6c50; font-size: 13px; font-weight: 750; white-space: nowrap; }
.section-intro { margin: -5px 0 14px; color: #486358; font-size: 15px; line-height: 1.6; }
.section-intro strong { color: #194d32; }
.play-context { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 12px; padding: 11px 16px; border: 1px solid #a8cda8; border-radius: 12px; background: #e8f4e6; color: #24553c; font-weight: 800; line-height: 1.5; }
.play-context button { flex: none; min-height: 40px; border: 1px solid #70a87a; border-radius: 9px; padding: 5px 10px; background: #fff; color: #24553c; font-size: 13px; font-weight: 800; }

.card-grid { display: grid; gap: 13px; }
.essential-grid, .extra-grid, .custom-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.play-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.comm-card { --tone-bg: #eef4e9; --tone-border: #b9d3b3; --tone-ink: #254d36; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 0; min-height: 162px; padding: 13px 9px 14px; border: 2px solid var(--tone-border); border-radius: 21px; background: var(--tone-bg); color: var(--tone-ink); text-align: center; box-shadow: 0 5px 0 rgba(40, 70, 47, .06); transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease; -webkit-tap-highlight-color: transparent; }
.comm-card:hover { transform: translateY(-2px); box-shadow: 0 9px 20px rgba(38, 69, 47, .11); }
.comm-card:active { transform: translateY(1px); box-shadow: 0 2px 0 rgba(40, 70, 47, .08); }
.comm-card.is-selected { border-color: #205d43; box-shadow: 0 0 0 3px #82b893; }
.tone-blue { --tone-bg: #eaf6fb; --tone-border: #b9dbe8; --tone-ink: #214e67; }
.tone-gold { --tone-bg: #fff3db; --tone-border: #e7d2a6; --tone-ink: #644923; }
.tone-green { --tone-bg: #eaf5e4; --tone-border: #bed8ae; --tone-ink: #2d563a; }
.tone-rose { --tone-bg: #fff0e9; --tone-border: #ecc9b8; --tone-ink: #684238; }
.tone-lavender { --tone-bg: #f2effa; --tone-border: #d8cdee; --tone-ink: #4e466a; }
.tone-custom { --tone-bg: #fffdf3; --tone-border: #d8d8ba; --tone-ink: #4a5739; }
.card-symbol { display: grid; place-items: center; width: 76px; height: 76px; flex: none; margin-bottom: 6px; }
.card-symbol svg { width: 100%; height: 100%; }
.card-word { display: block; width: 100%; font-size: clamp(19px, 2.1vw, 23px); line-height: 1.25; letter-spacing: -.045em; overflow-wrap: anywhere; }
.card-full { display: block; width: 100%; margin-top: 3px; color: #41584c; font-size: 12px; font-weight: 650; line-height: 1.35; overflow-wrap: anywhere; }
.play-grid .comm-card { min-height: 154px; }
.play-grid .card-symbol { width: 66px; height: 66px; }
.play-grid .card-word { font-size: 19px; }

.caregiver-section { margin-top: 38px; }
.caregiver-section details { overflow: hidden; border: 1.5px solid #c3d9c3; border-radius: 19px; background: #fffefa; box-shadow: var(--shadow); }
.caregiver-section summary { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 62px; padding: 16px 20px; color: #244d37; font-size: 18px; font-weight: 900; cursor: pointer; list-style: none; }
.caregiver-section summary::-webkit-details-marker { display: none; }
.caregiver-section details[open] summary { border-bottom: 1px solid var(--line); }
.summary-arrow { font-size: 27px; line-height: .5; transition: transform .2s ease; }
details[open] .summary-arrow { transform: rotate(180deg); }
.caregiver-body { padding: 20px; }
.guide-card { padding: 18px 20px; border: 1px solid #c9dcc6; border-radius: 15px; background: #f2f8eb; }
.guide-card h3, .custom-editor h3 { margin: 0 0 8px; font-size: 19px; color: #244c36; }
.guide-card p, .custom-editor > p { margin: 8px 0; color: #3c5747; font-size: 15px; line-height: 1.68; }
.guide-card a { display: inline-block; margin-top: 5px; color: #245c46; font-weight: 850; text-underline-offset: 3px; }
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin: 20px 0 10px; }
.settings-choices { display: grid; gap: 17px; }
.switch-label { display: flex; align-items: center; gap: 16px; cursor: pointer; }
.switch-label span { display: grid; gap: 4px; }
.switch-label strong { font-size: 16px; }
.switch-label small { color: #617167; font-size: 13px; line-height: 1.4; }
.switch-label input { width: 24px; height: 24px; accent-color: #386f48; flex: none; }
.plain-button, .manager-actions button { min-height: 42px; border: 1.5px solid #a6c0a8; border-radius: 10px; padding: 8px 13px; background: #fff; color: #285640; font-weight: 800; }
.plain-button:hover, .manager-actions button:hover { background: #edf5ec; }
.privacy-note { margin: 6px 0 22px; color: #5c6e5e; font-size: 13px; line-height: 1.5; }
.custom-editor { padding-top: 20px; border-top: 1px solid var(--line); }
.form-grid { display: grid; grid-template-columns: 1fr 1.5fr .8fr; gap: 12px; margin-top: 15px; }
.form-grid label { display: grid; gap: 6px; color: #3a5543; font-size: 14px; font-weight: 800; }
.form-grid input, .form-grid select { width: 100%; min-height: 47px; padding: 9px 11px; border: 1.5px solid #a9c4ac; border-radius: 10px; background: #fff; color: #203e34; font-size: 15px; }
.form-grid input::placeholder { color: #788a7c; }
.form-message { min-height: 21px; margin: 8px 0 0; color: #25593f; font-size: 14px; font-weight: 750; }
.form-actions { display: flex; gap: 9px; margin-top: 10px; }
.save-button { min-height: 44px; border: 0; border-radius: 10px; padding: 9px 17px; background: #37734d; color: #fff; font-weight: 850; }
.save-button:hover { background: #285f3b; }
.card-manager { margin-top: 20px; }
.card-manager h4 { margin: 0 0 8px; color: #31513d; }
.manager-empty { margin: 0; color: #647466; font-size: 14px; }
.manager-row { display: flex; align-items: center; gap: 11px; padding: 9px 0; border-top: 1px solid #e0e8dd; }
.manager-icon { width: 45px; height: 45px; flex: none; }
.manager-icon svg { width: 100%; height: 100%; }
.manager-copy { display: grid; min-width: 0; flex: 1; gap: 2px; }
.manager-copy strong { font-size: 15px; }
.manager-copy small { color: #566c5b; overflow-wrap: anywhere; }
.manager-actions { display: flex; gap: 5px; }
.manager-actions button { min-height: 38px; padding: 5px 10px; font-size: 13px; }
.local-note { margin: 24px 0 0; color: #5b705b; font-size: 13px; text-align: center; line-height: 1.5; }
.action-dock { position: fixed; z-index: 15; right: max(15px, calc((100vw - 1120px) / 2)); bottom: 14px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); width: min(480px, calc(100vw - 28px)); gap: 7px; padding: 8px; border: 1.5px solid #a6c9a8; border-radius: 17px; background: rgba(255, 254, 250, .97); box-shadow: 0 9px 30px rgba(28, 65, 39, .22); backdrop-filter: blur(10px); }
.settings-open .action-dock { display: none; }
.action-dock button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; min-width: 0; min-height: 62px; padding: 3px; border: 1.5px solid #c5d9c5; border-radius: 11px; background: #f4f9ef; color: #244934; font-size: 13px; font-weight: 900; letter-spacing: -.045em; }
.action-dock button:nth-child(2) { background: #eaf5e4; }
.action-dock button:nth-child(3) { background: #fff0e9; }
.action-dock button:nth-child(4) { background: #f2effa; }
.action-dock button.is-selected { border-color: #245d42; box-shadow: 0 0 0 2px #86b895; }
.dock-symbol { display: block; width: 29px; height: 29px; }
.dock-symbol svg { width: 100%; height: 100%; }

@media (max-width: 760px) {
  .site-head { padding: 8px 14px; gap: 7px; }
  .site-name { font-size: 16px; }
  .home-link { font-size: 13px; }
  .choose-link { max-width: 146px; padding: 5px 9px; font-size: 12px; line-height: 1.2; }
  .forest-hero { min-height: 190px; background-position: 62% center; }
  .hero-inner { padding: 25px 15px 65px; }
  .hero-inner h1 { max-width: 310px; font-size: 34px; }
  .hero-inner p { max-width: 300px; font-size: 15px; }
  .page-shell { margin-top: -45px; padding: 0 13px 110px; }
  .speech-panel { top: 0; gap: 8px; min-height: 98px; padding: 9px 12px; border-radius: 17px; }
  .speech-panel-main { gap: 9px; }
  .selected-icon { width: 58px; height: 58px; border-radius: 13px; }
  .selected-icon svg { width: 49px; height: 49px; }
  .speech-copy h2 { font-size: 11px; }
  .selected-phrase { font-size: 21px; line-height: 1.2; }
  .speech-status { max-width: 250px; margin-top: 2px; font-size: 10px; line-height: 1.25; }
  .repeat-button { min-height: 47px; max-width: 76px; padding: 5px 6px; font-size: 11px; line-height: 1.2; }
  .repeat-button span { display: none; }
  .board-footer-controls { margin: 15px 0 7px; }
  .board-section { margin-top: 27px; }
  .section-heading h2 { font-size: 23px; }
  .fixed-note { padding: 5px 8px; font-size: 11px; }
  .card-grid { gap: 9px; }
  .essential-grid, .extra-grid, .custom-grid, .play-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .comm-card, .play-grid .comm-card { min-height: 139px; padding: 7px 5px 8px; border-radius: 16px; }
  .card-symbol, .play-grid .card-symbol { width: 67px; height: 67px; margin-bottom: 2px; }
  .card-word, .play-grid .card-word { font-size: 20px; }
  .card-full { font-size: 11px; }
  .form-grid { grid-template-columns: 1fr; }
  .settings-row { align-items: start; flex-direction: column; }
  .manager-row { flex-wrap: wrap; }
  .play-context { align-items: start; flex-direction: column; }
  .action-dock { right: 0; bottom: 0; width: 100%; gap: 4px; padding: 6px max(7px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(7px, env(safe-area-inset-left)); border-radius: 14px 14px 0 0; }
  .action-dock button { min-height: 62px; font-size: 12px; }
}

@media (max-width: 360px) {
  .site-name { display: none; }
  .speech-status { font-size: 9px; }
  .selected-phrase { font-size: 18px; }
  .card-word { font-size: 18px; }
  .fixed-note { white-space: normal; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .comm-card, .summary-arrow { transition: none; }
}

@media print {
  @page { margin: 12mm; size: A4 portrait; }
  body { background: #fff; color: #111; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .skip-link, .site-head, .forest-hero, .speech-panel, .board-footer-controls, .caregiver-section, .local-note, .section-intro, .play-context, .fixed-note, .action-dock { display: none !important; }
  .page-shell { max-width: none; margin: 0; padding: 0; }
  .page-shell::before { content: '내 마음 말하기 · 의사소통판'; display: block; margin: 0 0 8mm; font-size: 22pt; font-weight: 900; }
  .board-section, .board-section.essentials { margin: 0 0 8mm; }
  .section-heading { margin: 0 0 3mm; }
  .section-kicker { display: none; }
  .section-heading h2 { font-size: 15pt; color: #111; }
  .card-grid, .essential-grid, .play-grid, .extra-grid, .custom-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 3mm; }
  .comm-card, .play-grid .comm-card { min-height: 29mm; padding: 2mm; border-radius: 3mm; border: 1.3pt solid #555; box-shadow: none; background: #fff; color: #111; break-inside: avoid; }
  .card-symbol, .play-grid .card-symbol { width: 15mm; height: 15mm; margin: 0; }
  .card-word, .play-grid .card-word { font-size: 12pt; }
  .card-full { font-size: 8pt; }
}
