/* 생일 선물 방 공용 스타일 — 모바일(360px) 우선 */
:root {
  --bg: #fff4e0;
  --card: #ffffff;
  --ink: #3a2a20;
  --muted: #6e5b4d;
  --line: #ecd9bd;
  --accent: #b23a26;
  --accent-ink: #ffffff;
  --soft: #fde3c4;
  --gold: #f2b84b;
  --ok: #1f6b45;
  --err: #a8201a;
  --radius: 16px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.page {
  max-width: 480px;
  margin: 0 auto;
  padding: 20px 16px 48px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.stack { display: flex; flex-direction: column; gap: 12px; }
.center { text-align: center; }
.muted { color: var(--muted); margin: 0; }

h1, h2, p { margin: 0; }
.title { font-size: 1.5rem; line-height: 1.35; }
.subtitle { font-size: 1.125rem; }
.lead { font-size: 1.0625rem; }
.step { font-size: 1rem; }

.hero { text-align: center; padding: 8px 0; }
.badge {
  align-self: center;
  background: var(--soft);
  border: 2px solid var(--gold);
  border-radius: 999px;
  padding: 4px 16px;
  font-weight: 700;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}

.thanks { background: var(--soft); border-color: var(--gold); }

/* 안내 문구 */
.notice {
  background: #fff;
  border: 2px dashed var(--gold);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 1rem;
  font-weight: 600;
}

/* 버튼 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 10px 20px;
  border: 2px solid var(--accent);
  border-radius: 999px;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-secondary { background: var(--card); color: var(--accent); }
.btn-wide { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

:focus-visible { outline: 3px solid #1b5fd1; outline-offset: 2px; }

/* 선물 테이블 */
.gift-table {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.gift {
  background: var(--soft);
  border: 1px solid var(--gold);
  border-radius: 12px;
  padding: 10px 12px;
  min-height: 56px;
  display: flex;
  align-items: center;
}
.gift-open { grid-column: 1 / -1; background: #fff; }
.gift-text { font-size: 1rem; }

@media (prefers-reduced-motion: no-preference) {
  .gift { animation: pop 0.3s ease-out both; }
  @keyframes pop { from { transform: scale(0.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }
}

/* 품목 고르기 */
.pick-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.pick {
  width: 100%;
  min-height: 56px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--card);
  color: var(--ink);
  border: 2px solid var(--line);
  border-radius: 14px;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.pick:hover { border-color: var(--gold); }
.pick-phrase { font-weight: 700; }
.pick-price { color: var(--muted); white-space: nowrap; }

/* 입력 */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 700; }
.input {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}
textarea.input { resize: vertical; }
.counter { text-align: right; font-size: 1rem; }
.error-text { color: var(--err); font-weight: 600; }
.error-text:empty { display: none; }

.chosen { font-size: 1.125rem; font-weight: 700; text-align: center; }
.amount { font-size: 2.25rem; font-weight: 800; color: var(--accent); }
.account { font-size: 1.125rem; font-weight: 600; user-select: all; }

/* ---- 방 만들기 · 관리 화면 ---- */
[hidden] { display: none !important; }

h3 { margin: 0; }
fieldset { margin: 0; min-width: 0; }
legend { font-weight: 700; padding: 0 6px; }
.pay-group { border: 1px solid var(--line); }
.notice.warn { border-style: solid; border-color: var(--err); color: var(--err); }

.link-text {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  font-weight: 600;
  user-select: all;
}

.btn-danger { background: var(--err); border-color: var(--err); color: var(--accent-ink); }
.left { text-align: left; }

.gift-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.gift-row-open { border-color: var(--ok); }
.giver { font-weight: 700; }
.gift-message { white-space: pre-wrap; }
.row-meta { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.amount-small { font-weight: 700; }
.badge-open { border-color: var(--ok); background: #e3f4ea; color: var(--ok); }
.badge-closed { align-self: auto; }
.row-meta .badge { align-self: auto; }
.row-actions { display: flex; flex-direction: column; gap: 8px; }
.total { font-size: 1.25rem; font-weight: 800; text-align: center; }
