/* 두 페이지(index.html, board.html)가 함께 쓰는 스타일 */

:root {
  color-scheme: light;
  --bg: #FBF3E4;
  --paper: #FFFBF3;
  --sunk: #F3E6CF;
  --well: #FBF3E4;
  --photo-bg: #F7E7C6;
  --photo-dot: #EFD7AB;
  --text: #4A3426;
  --muted: #7A6352;
  --quote: #7A5238;
  --link: #8A5A3B;
  --border: #E6D3B3;
  --border-soft: #EBDDC5;
  --shadow: #EAD9BF;
  --chip-on-bg: #F6D78B;
  --chip-on-border: #E9BE5E;
  --chip-on-text: #4A3426;
  --accent: #B8552F;
  --accent-hover: #A34A28;
  --accent-text: #FFFFFF;
  --accent-soft: rgba(184, 85, 47, 0.28);
  --btn-shadow: rgba(74, 52, 38, 0.45);
  --plate: #F6E6CB;
  --plate-ring: #E6D0AC;
  --note: #FFF4CF;
  --note-text: #5C4332;
  --tape: rgba(242, 196, 109, 0.75);
  --doodle: #E4CFAD;
  --bubble-line: #4A3426;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #241C17;
  --paper: #30261F;
  --sunk: #3B2F26;
  --well: #29201A;
  --photo-bg: #3A2E24;
  --photo-dot: #463829;
  --text: #F4E7D4;
  --muted: #C9B49D;
  --quote: #E8C39A;
  --link: #E8C39A;
  --border: #54432F;
  --border-soft: #45372B;
  --shadow: #17110D;
  --chip-on-bg: #F2C46D;
  --chip-on-border: #F2C46D;
  --chip-on-text: #2A1F18;
  --accent-soft: rgba(184, 85, 47, 0.4);
  --btn-shadow: rgba(0, 0, 0, 0.55);
  --plate: #3A2D23;
  --plate-ring: #54432F;
  --note: #3D3222;
  --note-text: #EAD9BF;
  --tape: rgba(242, 196, 109, 0.45);
  --doodle: #45372B;
  --bubble-line: #E9D8BF;
}

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

body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); color: var(--text); font-family: 'Gowun Dodum', sans-serif; line-height: 1.6; transition: background-color 0.2s, color 0.2s; }
button { font: inherit; color: inherit; }
a { color: var(--link); }
button:focus-visible, a:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ── 일러스트 선과 아이콘 ── */
.ico { width: 20px; height: 20px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ink { stroke: #4A3426; stroke-width: 4; stroke-linejoin: round; stroke-linecap: round; }
.ink3 { stroke: #4A3426; stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.ink-line { fill: none; stroke: #4A3426; stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.ink-thin { fill: none; stroke: #4A3426; stroke-width: 3; stroke-linecap: round; }
.stripe { fill: none; stroke: #D9914A; stroke-width: 6; stroke-linecap: round; }
.pleat { fill: none; stroke: #E6D3B3; stroke-width: 3; stroke-linecap: round; }
.tail-out { fill: none; stroke: #4A3426; stroke-width: 24; stroke-linecap: round; }
.tail-in { fill: none; stroke: #F2B872; stroke-width: 16; stroke-linecap: round; }
.spoon-out { fill: none; stroke: #4A3426; stroke-width: 18; stroke-linecap: round; }
.spoon-in { fill: none; stroke: #C99466; stroke-width: 11; stroke-linecap: round; }
.scarf { fill: var(--accent); }
.steam { fill: none; stroke: #C9A882; stroke-width: 4; stroke-linecap: round; }
.chop { fill: none; stroke: #8A5A3B; stroke-width: 6; stroke-linecap: round; }
.bowl-band { fill: none; stroke: var(--accent); stroke-width: 6; stroke-linecap: round; }

/* ── 식탁보 띠, 페이지 틀, 낙서 ── */
.gingham { flex-shrink: 0; background-color: var(--bg); background-image: linear-gradient(90deg, var(--accent-soft) 50%, transparent 50%), linear-gradient(var(--accent-soft) 50%, transparent 50%); }
.gingham-top { height: 18px; background-size: 24px 24px; }
.gingham-bottom { height: 56px; margin-top: 64px; border-top: 3px solid var(--accent); background-size: 28px 28px; }

.page { position: relative; flex: 1; width: 100%; max-width: 1280px; margin: 0 auto; padding: 0 clamp(16px, 5vw, 64px); }
.doodles { display: none; }
.doodle-svg { position: absolute; fill: none; stroke: var(--doodle); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }

/* ── 머리글 ── */
.site-header { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 22px 0 10px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; color: inherit; text-decoration: none; }
.brand-cat { width: 54px; height: 54px; flex-shrink: 0; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-name { font-family: 'Jua', sans-serif; font-size: 28px; line-height: 1.15; }
.brand-sub { font-size: 14px; color: var(--muted); }
.narrow-only { display: none; }
.header-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.account { display: flex; align-items: center; gap: 10px; }
.account .email { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; color: var(--muted); }
.pill-btn { height: 46px; padding: 0 20px; display: inline-flex; align-items: center; gap: 8px; border: 2px solid var(--border); border-radius: 999px; background: var(--paper); font-family: 'Jua', sans-serif; font-size: 17px; white-space: nowrap; cursor: pointer; }
.icon-btn { width: 46px; height: 46px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border: 2px solid var(--border); border-radius: 50%; background: var(--paper); cursor: pointer; }
.pill-btn:hover, .icon-btn:hover { border-color: var(--text); }
.icon-sun { display: none; }
:root[data-theme="dark"] .icon-sun { display: block; }
:root[data-theme="dark"] .icon-moon { display: none; }

/* ── 냥셰프와 말풍선 (휴대폰 기준: 가로 한 줄) ── */
.chef { position: relative; display: flex; align-items: center; gap: 10px; }
.chef-art { position: relative; order: -1; width: 150px; height: 158px; flex-shrink: 0; }
.plate { position: absolute; left: 4px; top: 12px; width: 142px; height: 142px; border-radius: 50%; background: var(--plate); }
.plate-ring { display: none; }
.chef-cat { position: relative; display: block; width: 100%; height: 100%; }
.bubble { position: relative; flex: 1; margin: 0; padding: 12px 16px; background: var(--paper); border: 3px solid var(--bubble-line); border-radius: 22px; font-family: 'Gaegu', cursive; font-weight: 700; font-size: 23px; line-height: 1.2; word-break: keep-all; }
.bubble::after { content: ""; position: absolute; left: -12px; top: 50%; width: 18px; height: 18px; margin-top: -9px; background: var(--paper); border-left: 3px solid var(--bubble-line); border-bottom: 3px solid var(--bubble-line); transform: rotate(45deg); }

/* ── 카드, 끼니 탭, 태그, 큰 버튼 ── */
.card { display: flex; flex-direction: column; gap: 16px; padding: 20px 18px 22px; background: var(--paper); border: 2px solid var(--border-soft); border-radius: 26px; box-shadow: 0 8px 0 var(--shadow); }
.card h1 { margin: 0; font-family: 'Jua', sans-serif; font-weight: 400; font-size: 30px; line-height: 1.2; }

.meal-tabs { display: flex; gap: 4px; padding: 5px; background: var(--sunk); border-radius: 999px; }
.meal-tabs button { flex: 1; height: 46px; padding: 0 12px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: none; border-radius: 999px; background: transparent; font-family: 'Jua', sans-serif; font-size: 17px; cursor: pointer; }
.meal-tabs button[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); }
.meal-tabs button:disabled { cursor: default; }

.tag { align-self: flex-start; padding: 2px 10px; border-radius: 999px; background: var(--sunk); font-size: 13px; color: var(--muted); }
.tag:empty { display: none; }

.accent-btn { height: 60px; padding: 0 24px; display: flex; align-items: center; justify-content: center; gap: 8px; border: none; border-radius: 18px; background: var(--accent); color: var(--accent-text); font-family: 'Jua', sans-serif; font-size: 22px; box-shadow: 0 5px 0 var(--btn-shadow); cursor: pointer; transition: transform 0.08s, box-shadow 0.08s; }
.accent-btn:hover { background: var(--accent-hover); }
.accent-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--btn-shadow); }
.accent-btn:disabled { opacity: 0.6; cursor: default; transform: none; box-shadow: 0 5px 0 var(--btn-shadow); }
.accent-btn .ico { width: 24px; height: 24px; }

/* ── 로그인 창 ── */
dialog { width: min(380px, calc(100vw - 32px)); padding: 28px 24px 24px; border: 3px solid var(--bubble-line); border-radius: 26px; background: var(--paper); color: var(--text); box-shadow: 0 10px 0 var(--shadow); }
dialog::backdrop { background: rgb(42 30 22 / 0.5); }
dialog form { position: relative; margin: 0; }
dialog h2 { margin: 0 0 4px; font-family: 'Jua', sans-serif; font-weight: 400; font-size: 28px; }
.auth-note { margin: 0 0 16px; font-family: 'Gaegu', cursive; font-weight: 700; font-size: 20px; line-height: 1.3; color: var(--quote); word-break: keep-all; }
dialog label { display: block; margin-bottom: 12px; font-size: 15px; color: var(--muted); }
dialog input { display: block; width: 100%; height: 48px; margin-top: 4px; padding: 0 14px; font: inherit; font-size: 16px; color: var(--text); border: 2px solid var(--border); border-radius: 14px; background: var(--bg); }
dialog input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.auth-message { min-height: 1.5rem; margin: 0 0 10px; font-size: 14px; }
.auth-actions { display: flex; gap: 8px; }
.auth-actions button { flex: 1; height: 48px; border: 2px solid var(--border); border-radius: 14px; background: var(--paper); font-family: 'Jua', sans-serif; font-size: 18px; cursor: pointer; }
.auth-actions button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.auth-actions button:disabled { opacity: 0.6; cursor: default; }
.auth-close { position: absolute; top: -20px; right: -14px; width: 44px; height: 44px; padding: 0; border: none; background: none; color: var(--muted); font-size: 28px; line-height: 1; cursor: pointer; }
.auth-legal { margin: 12px 0 0; font-size: 13px; line-height: 1.5; color: var(--muted); word-break: keep-all; }

/* ── 링크로 쓰는 버튼 ── */
a.pill-btn, a.accent-btn { color: inherit; text-decoration: none; }
a.accent-btn { color: var(--accent-text); }

/* ── 페이지 아래 안내 링크 ── */
.site-footer { position: relative; z-index: 1; margin-top: 56px; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; color: var(--muted); }
.site-footer nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 0 18px; }
.site-footer nav a { min-height: 44px; display: inline-flex; align-items: center; font-family: 'Jua', sans-serif; font-size: 16px; color: var(--link); text-decoration: none; }
.site-footer nav a:hover { text-decoration: underline; }
.site-footer p { margin: 0; font-size: 13px; }

/* ── 쿠팡 파트너스 재료 링크 (파트너스 링크를 넣은 레시피에만 보임) ── */
.shop-box { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 12px 14px; border: 2px dashed var(--border); border-radius: 14px; }
.shop-box .pill-btn .ico { color: var(--accent); }
.ad-note { margin: 0; font-size: 13px; line-height: 1.5; color: var(--muted); word-break: keep-all; }

/* ── 태블릿 이상 ── */
@media (min-width: 700px) {
  .card { gap: 20px; padding: 32px 36px 36px; border-radius: 32px; box-shadow: 0 10px 0 var(--shadow); }
  .card h1 { font-size: 44px; line-height: 1.15; }
  .meal-tabs { align-self: flex-start; gap: 6px; padding: 6px; }
  .meal-tabs button { flex: none; height: 48px; padding: 0 22px; gap: 8px; font-size: 19px; }
  .tag { padding: 2px 12px; font-size: 14px; }
  .accent-btn { height: 66px; border-radius: 20px; font-size: 25px; box-shadow: 0 6px 0 var(--btn-shadow); }
  .accent-btn:disabled { box-shadow: 0 6px 0 var(--btn-shadow); }
  .accent-btn .ico { width: 26px; height: 26px; }
}

/* ── 넓은 화면: 가장자리 낙서 ── */
@media (min-width: 1200px) {
  .doodles { display: block; }
}

/* ── 휴대폰 ── */
@media (max-width: 699px) {
  .gingham-top { height: 12px; background-size: 18px 18px; }
  .gingham-bottom { height: 44px; margin-top: 48px; background-size: 22px 22px; }
  .site-header { padding: 14px 0 6px; }
  .brand { gap: 8px; }
  .brand-cat { width: 42px; height: 42px; }
  .brand-name { font-size: 22px; line-height: 1.1; }
  .brand-sub { font-size: 12px; }
  .wide-only { display: none; }
  .narrow-only { display: inline; }
  .header-actions { gap: 8px; }
  .account .email { display: none; }
  .pill-btn { height: 44px; padding: 0 14px; gap: 6px; font-size: 15px; }
  .pill-btn .ico { width: 18px; height: 18px; }
  .icon-btn { width: 44px; height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  body, .accent-btn { transition: none; }
}
