:root {
  --bg: #FFF7F8;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-2: rgba(255, 255, 255, 0.75);
  --ink: #4A4043;
  --muted: #8F8486;
  --line: #F4EAEB;
  --primary: #FF8E9E;
  --primary-dark: #E27282;
  --primary-soft: #FFE6EA;
  --secondary: #FFB385;
  --secondary-soft: #FFF2EB;
  --accent: #FFCE61;
  --danger: #FF6B6B;
  --radius: 24px;
  --shadow: 0 10px 40px rgba(255, 142, 158, 0.1), 0 16px 50px rgba(255, 142, 158, 0.05);
  --shadow-sm: 0 4px 14px rgba(255, 142, 158, 0.08);
  font-family: 'Pretendard', 'Inter', -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo',
    'Segoe UI', Roboto, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  line-height: 1.55;
}

button {
  font-family: inherit;
  cursor: pointer;
}

a {
  color: var(--primary-dark);
}

/* ---------- Layout ---------- */
.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 24px;
  background: rgba(253, 250, 246, 0.7);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  border-bottom: 1px solid rgba(232, 222, 209, 0.5);
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}
.brand-icon {
  font-size: 28px;
}
.brand-text {
  display: flex;
  flex-direction: column;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.02em;
}
.brand-text small {
  font-weight: 500;
  font-size: 11px;
  color: var(--muted);
}

.nav {
  display: flex;
  gap: 4px;
  background: var(--surface-2);
  padding: 4px;
  border-radius: 12px;
}
.nav-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  border: none;
  background: transparent;
  padding: 8px 14px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  transition: all 0.15s;
}
.nav-btn:hover {
  color: var(--ink);
}
.nav-btn.active {
  background: var(--bg);
  color: var(--primary);
}

.auth-section {
  display: flex;
  align-items: center;
  margin-left: 20px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--primary);
}

.username {
  font-weight: 600;
  font-size: 14px;
}

.plan-badge {
  background: #fff3cd;
  color: #856404;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 12px;
  border: 1px solid #ffeeba;
  letter-spacing: 0.5px;
}

.plan-badge.free {
  background: #e9ecef;
  color: #495057;
  border-color: #dee2e6;
}

.settings-modal {
  max-width: 500px;
}

.settings-section {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.settings-section:last-child {
  border-bottom: none;
}
.settings-section h3 {
  font-size: 16px;
  margin-bottom: 12px;
  color: var(--primary);
}
.section-desc {
  font-size: 13px;
  color: #666;
  margin-bottom: 16px;
}

.plan-info-card, .save-settings-card {
  background: #f8f9fa;
  border: 1px solid var(--line);
  padding: 16px;
  border-radius: 12px;
}
.plan-name { margin-bottom: 8px; font-size: 15px; }
.plan-usage { font-size: 14px; margin-bottom: 12px; }
.plan-notice, .notice-text { font-size: 12px; color: #888; }
.nav-ic {
  font-size: 15px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.school-btn {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 700;
  color: var(--secondary);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.school-btn:hover {
  background: var(--secondary-soft);
  border-color: var(--secondary);
}

.content {
  flex: 1;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 28px 24px 60px;
}

/* 홈 설정 배너 */
.setup-banner {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  background: linear-gradient(100deg, var(--secondary-soft), var(--primary-soft));
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 20px;
  margin-bottom: 20px;
  transition: transform 0.15s;
}
.setup-banner:hover {
  transform: translateY(-1px);
}
.setup-emoji {
  font-size: 30px;
}
.setup-text {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.setup-text strong {
  font-size: 15px;
}
.setup-text span {
  font-size: 13px;
  color: var(--muted);
}
.setup-cta {
  font-weight: 800;
  color: var(--secondary);
  white-space: nowrap;
}

/* 우리 지역 교과서 배지 */
.local-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  background: var(--secondary);
  padding: 2px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

/* 안내 노트 */
.info-note {
  background: var(--secondary-soft);
  border: 1px solid #cfe6df;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 12.5px;
  color: #33574d;
  line-height: 1.6;
  margin-bottom: 18px;
}

.local-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--secondary);
  cursor: pointer;
}
.local-toggle input {
  width: 16px;
  height: 16px;
  accent-color: var(--secondary);
}

.map-btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.course-summary-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.footer {
  border-top: 1px solid var(--line);
  padding: 20px 24px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}
.footer a {
  font-weight: 600;
}

/* ---------- Buttons ---------- */
.btn {
  border: none;
  border-radius: 14px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 700;
  transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
.btn:active {
  transform: translateY(0);
}
.btn-lg {
  padding: 14px 24px;
  font-size: 15px;
  border-radius: 18px;
}
.btn-sm {
  padding: 7px 13px;
  font-size: 13px;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 6px rgba(226, 112, 58, 0.3);
}
.btn-primary:hover {
  background: var(--primary-dark);
}
.btn-secondary {
  background: var(--secondary);
  color: #fff;
}
.btn-secondary:hover {
  filter: brightness(0.95);
}
.btn-ghost {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn-ghost:hover {
  background: var(--surface-2);
}
.btn-outline {
  background: transparent;
  color: var(--primary-dark);
  border: 1.5px solid var(--primary);
}
.btn-outline:hover {
  background: var(--primary-soft);
}
.link-btn {
  border: none;
  background: none;
  color: var(--primary-dark);
  font-weight: 700;
  font-size: 14px;
}

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.page-head {
  margin-bottom: 20px;
}
.page-head h1 {
  margin: 0 0 4px;
  font-size: 26px;
  letter-spacing: -0.02em;
}
.page-sub {
  margin: 0;
  color: var(--muted);
}
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

/* ---------- Home ---------- */
.hero {
  background: linear-gradient(135deg, var(--primary-soft), var(--secondary-soft), #fff9f0);
  background-size: 200% 200%;
  animation: gradientShift 8s ease infinite;
  border-radius: 24px;
  padding: 56px 40px;
  margin-bottom: 40px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: var(--shadow-sm);
}
@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
.hero-text h1 {
  font-size: 38px;
  line-height: 1.2;
  margin: 0 0 14px;
  letter-spacing: -0.03em;
}
.hero-text p {
  font-size: 16px;
  color: #55504a;
  max-width: 620px;
  margin: 0 0 24px;
}
.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.demo-section {
  text-align: center;
  margin-bottom: 60px;
}
.demo-section h2 {
  font-size: 24px;
  color: var(--primary);
  margin-bottom: 20px;
}
.demo-video-wrapper {
  max-width: 800px;
  margin: 0 auto;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 4px solid #fff;
  background: var(--surface);
}
.demo-video-wrapper video,
.demo-video-wrapper img {
  width: 100%;
  height: auto;
  display: block;
}

.pricing-section {
  text-align: center;
  background: var(--surface);
  padding: 48px 24px;
  border-radius: 24px;
  margin: 40px 0 60px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}
.pricing-section h2 {
  font-size: 28px;
  color: var(--primary);
  margin-bottom: 12px;
}
.pricing-section p {
  color: var(--muted);
  margin-bottom: 24px;
}
.pricing-section.premium-active {
  background: linear-gradient(135deg, var(--secondary-soft), #fff);
  border-color: var(--secondary);
}
.pricing-cards {
  display: flex;
  justify-content: center;
  align-items: stretch;
  gap: 20px;
}
.pricing-card {
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 16px;
  padding: 24px;
  flex: 1;
  width: 100%;
  min-width: 250px;
  max-width: 340px;
  box-sizing: border-box;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  position: relative;
  transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), box-shadow 0.3s ease, border-color 0.3s ease;
  cursor: pointer;
}
.pricing-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 16px 40px rgba(43, 58, 85, 0.12);
  border-color: var(--primary);
}

.popular-badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: #fff;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
}
.billing-toggle {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
}
.billing-toggle .active {
  color: var(--primary);
}
.billing-toggle .badge {
  background: var(--accent);
  color: #fff;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  margin-left: 4px;
}
.toggle-switch {
  width: 50px;
  height: 26px;
  background: var(--line);
  border-radius: 13px;
  border: none;
  position: relative;
  cursor: pointer;
  transition: 0.3s;
}
.toggle-switch.on {
  background: var(--primary);
}
.toggle-switch .toggle-knob {
  width: 22px;
  height: 22px;
  background: #fff;
  border-radius: 50%;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: 0.3s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle-switch.on .toggle-knob {
  transform: translateX(24px);
}
.pricing-card h3 {
  font-size: 20px;
  color: var(--primary);
  margin-bottom: 16px;
  word-break: keep-all;
}
.pricing-card .price-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-bottom: 20px;
}
.pricing-card .original-price {
  font-size: 14px;
  color: var(--muted);
  text-decoration: line-through;
  margin-bottom: 4px;
}
.pricing-card .price {
  font-size: 28px;
  font-weight: 800;
  color: var(--accent);
  margin: 0;
}
.pricing-card .price .period {
  font-size: 16px;
  color: var(--muted);
  font-weight: 500;
}
.pricing-card .features {
  list-style: none;
  padding: 0;
  margin: 0 0 24px;
  text-align: left;
  flex: 1;
}
.pricing-card .features li {
  margin-bottom: 12px;
  font-size: 15px;
  color: var(--ink);
  line-height: 1.5;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
/* "이전 플랜 혜택 전부 포함" 안내줄 */
.pricing-card .features li.tier-base {
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
  border-bottom: 1px dashed rgba(0, 0, 0, 0.12);
  padding-bottom: 8px;
}

.btn-toss {
  background: #3182f6;
  color: #fff;
  width: 100%;
  font-weight: 600;
}
.btn-toss:hover {
  background: #1b64da;
}
.btn-toss.loading {
  opacity: 0.7;
  pointer-events: none;
}

.steps {
  margin-bottom: 44px;
}
.steps h2,
.featured h2 {
  font-size: 20px;
  letter-spacing: -0.02em;
  margin: 0 0 16px;
}
.step-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.step-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  position: relative;
}
.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
  margin-bottom: 12px;
}
.step-card h3 {
  margin: 0 0 6px;
  font-size: 16px;
}
.step-card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.mini-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.mini-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  text-align: left;
  transition: all 0.15s;
}
.mini-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
}
.mini-icon {
  font-size: 26px;
}
.mini-name {
  font-weight: 700;
  font-size: 15px;
}
.mini-region {
  font-size: 12px;
  color: var(--muted);
}

/* ---------- Fields ---------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field label {
  font-size: 13px;
  font-weight: 700;
  color: #4a453f;
}
.field label small {
  font-weight: 500;
  color: var(--muted);
}
.field input,
.field select,
.field textarea,
.search {
  font-family: inherit;
  font-size: 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  width: 100%;
}
.field textarea {
  resize: vertical;
}
.field input:focus,
.field select:focus,
.field textarea:focus,
.search:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

/* ---------- Course planner ---------- */
.planner-form {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 18px;
  padding: 22px;
  align-items: end;
}
.field-wide {
  grid-column: 1 / -1;
}
.segmented {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.segmented button {
  flex: 1;
  border: none;
  background: var(--surface);
  padding: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}
.segmented button.on {
  background: var(--primary);
  color: #fff;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.chip.on {
  background: var(--secondary);
  border-color: var(--secondary);
  color: #fff;
}
.generate {
  grid-column: 1 / -1;
  justify-self: start;
}

.course-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  margin: 24px 0 16px;
  gap: 12px;
  flex-wrap: wrap;
}
.day-block {
  margin-bottom: 28px;
}
.day-title {
  font-size: 18px;
  margin: 0 0 14px;
  padding-left: 10px;
  border-left: 4px solid var(--primary);
}
.timeline {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.timeline-item {
  display: flex;
  gap: 16px;
  padding: 18px;
}
.tl-time {
  flex-shrink: 0;
  width: 66px;
  font-weight: 800;
  font-size: 15px;
  color: var(--primary-dark);
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}
.tl-time span {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.tl-body {
  flex: 1;
  min-width: 0;
}
.tl-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.tl-icon {
  font-size: 22px;
}
.tl-head h3 {
  margin: 0;
  font-size: 17px;
}
.tl-era {
  font-size: 12px;
  background: var(--secondary-soft);
  color: var(--secondary);
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 700;
}
.tl-summary {
  margin: 6px 0;
  color: #4a453f;
  font-size: 14px;
}
.tl-meta,
.tl-curr {
  margin: 3px 0;
  font-size: 12.5px;
  color: var(--muted);
}
.tl-curr {
  color: var(--secondary);
  font-weight: 600;
}
.tl-points {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 12px 0;
  padding: 12px;
  background: var(--surface-2);
  border-radius: 10px;
}
.tl-points strong {
  font-size: 12.5px;
  color: var(--ink);
}
.tl-points ul {
  margin: 6px 0 0;
  padding-left: 16px;
  font-size: 13px;
  color: #4a453f;
}
.tl-points li {
  margin-bottom: 3px;
}
.tl-tip {
  font-size: 12.5px;
  color: var(--primary-dark);
  background: var(--primary-soft);
  padding: 8px 12px;
  border-radius: 8px;
  margin: 8px 0 0;
}
.tl-actions {
  margin-top: 12px;
}
.empty {
  padding: 30px;
  text-align: center;
  color: var(--muted);
  margin-top: 20px;
}

/* ---------- Sites browser ---------- */
.filters {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.filter-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.filter-row select {
  flex: 1;
  min-width: 120px;
  font-family: inherit;
  font-size: 14px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}
.result-count {
  color: var(--muted);
  font-size: 13px;
  margin: 16px 2px 10px;
  font-weight: 600;
}
.site-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.site-card {
  text-align: left;
  padding: 18px;
  transition: all 0.15s;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.site-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.site-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.site-icon {
  font-size: 30px;
}
.site-eras {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.era-tag {
  font-size: 11px;
  background: var(--secondary-soft);
  color: var(--secondary);
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 700;
}
.site-card h3 {
  margin: 2px 0;
  font-size: 17px;
}
.site-loc {
  font-size: 12.5px;
  color: var(--muted);
  margin: 0;
}
.site-summary {
  font-size: 13.5px;
  color: #4a453f;
  margin: 6px 0;
  flex: 1;
}
.site-curr {
  font-size: 12px;
  color: var(--secondary);
  font-weight: 600;
  margin: 0;
}

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(40, 30, 20, 0.5);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  z-index: 60;
  overflow-y: auto;
}
.modal {
  max-width: 560px;
  width: 100%;
  padding: 28px;
  position: relative;
}
.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  border: none;
  background: var(--surface-2);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 15px;
  color: var(--muted);
}
.modal-head {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 14px;
}
.modal-icon {
  font-size: 40px;
}
.modal-head h2 {
  margin: 0 0 2px;
  font-size: 22px;
}
.modal-summary {
  color: #4a453f;
  margin: 0 0 14px;
}
.modal-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.dur-tag {
  font-size: 12px;
  background: var(--surface-2);
  color: var(--muted);
  padding: 2px 10px;
  border-radius: 999px;
  font-weight: 700;
}
.modal-section {
  margin-bottom: 16px;
}
.modal-section h4 {
  margin: 0 0 6px;
  font-size: 14px;
}
.modal-section ul {
  margin: 0;
  padding-left: 18px;
  color: #4a453f;
  font-size: 14px;
}
.modal-section li {
  margin-bottom: 4px;
}
.modal-section p {
  margin: 0;
  color: #4a453f;
  font-size: 14px;
}
.tip-box {
  background: var(--primary-soft);
  padding: 12px 14px;
  border-radius: 10px;
}
.tip-box h4 {
  color: var(--primary-dark);
}
.learn-link {
  display: inline-block;
  font-weight: 700;
  font-size: 14px;
  margin-right: 12px;
}
.modal-actions {
  margin-top: 22px;
  display: flex;
  justify-content: flex-end;
}

/* ---------- Result sheet ---------- */
.sheet-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}
.form-card {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.selector-row {
  align-items: start;
  gap: 14px 16px;
}
.selector-row .field {
  min-width: 0;
}
.selector-row .theme-dropdown {
  height: 48px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.template-note {
  grid-column: 1 / -1;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
}
.photo-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.photo-thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.photo-del {
  position: absolute;
  top: 4px;
  right: 4px;
  border: none;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 12px;
}
.photo-add {
  aspect-ratio: 1;
  border: 1.5px dashed var(--line);
  background: var(--surface-2);
  border-radius: 8px;
  color: var(--muted);
  font-size: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.photo-add span {
  font-size: 11px;
}
.form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
  padding-top: 4px;
  border-top: 1px solid var(--line);
  margin-top: 4px;
  padding-top: 16px;
}
.save-hint {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
}
.template-help {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  margin: 0;
}
.template-source-link {
  display: inline-block;
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 700;
  margin-top: 4px;
  text-decoration: none;
}
.template-source-link:hover {
  text-decoration: underline;
}
.saved-list {
  padding: 18px;
  margin-top: 18px;
}
.saved-list h3 {
  margin: 0 0 12px;
  font-size: 15px;
}
.saved-list ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.saved-list li {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.saved-item {
  flex: 1;
  text-align: left;
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
}
.saved-item strong {
  font-size: 14px;
}
.saved-item span {
  font-size: 12px;
  color: var(--muted);
}
.saved-del {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  padding: 0 12px;
}

.sheet-preview-wrap {
  position: sticky;
  top: 84px;
}
.preview-label {
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
  margin: 0 0 8px;
}

/* ---------- Printable paper ---------- */
.sheet-paper {
  background: #fffdf8;
  border: 1px solid #e8ded1;
  border-radius: 16px;
  padding: 32px 36px;
  box-shadow: var(--shadow);
  color: #5c5042;
  font-size: 13px;
  background-image: repeating-linear-gradient(transparent 0px, transparent 27px, rgba(209, 107, 125, 0.1) 28px);
  background-attachment: local;
}
.paper-title {
  text-align: center;
  font-size: 24px;
  letter-spacing: 0.1em;
  margin: 0 0 24px;
  padding-bottom: 16px;
  border-bottom: 2px dashed #d16b7d;
  font-weight: 800;
  color: #d16b7d;
}
.paper-template-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  padding: 3px 10px;
  margin-bottom: 10px;
  border-radius: 999px;
  background: rgba(209, 107, 125, 0.12);
  color: #b85266;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
}
.paper-info {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 18px;
}
.paper-info th,
.paper-info td {
  border: 1px solid rgba(209, 107, 125, 0.2);
  padding: 10px 12px;
  font-size: 13px;
  text-align: left;
  vertical-align: middle;
}
.paper-info th {
  background: #ffeef1;
  color: #d16b7d;
  font-weight: 700;
  width: 84px;
  white-space: nowrap;
}
.paper-section {
  margin-bottom: 16px;
}
.paper-section-label {
  background: #ffcf70;
  color: #5c5042;
  font-weight: 800;
  font-size: 13.5px;
  padding: 6px 14px;
  border-radius: 12px 12px 0 0;
  display: inline-block;
  border: 1px solid rgba(209, 107, 125, 0.2);
  border-bottom: none;
}
.paper-section-body {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(209, 107, 125, 0.2);
  border-radius: 0 12px 12px 12px;
  padding: 14px 16px;
  white-space: pre-wrap;
  word-break: break-word;
}
.paper-section-body p {
  margin: 0;
}
.paper-placeholder {
  display: block;
}
.paper-photos {
  margin-bottom: 12px;
}
.paper-photo-grid {
  display: grid;
  gap: 8px;
  border: 1px solid #cbb99f;
  border-radius: 0 6px 6px 6px;
  padding: 10px;
}
.paper-photo-grid.count-1 {
  grid-template-columns: 1fr;
}
.paper-photo-grid.count-2 {
  grid-template-columns: 1fr 1fr;
}
.paper-photo-grid.count-3,
.paper-photo-grid.count-4 {
  grid-template-columns: 1fr 1fr;
}
.paper-photo {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 4px;
  border: 1px solid #e0d5c2;
}
.paper-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.paper-confirm th {
  width: 84px;
}
.paper-confirm td {
  height: 40px;
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .sheet-layout {
    grid-template-columns: 1fr;
  }
  .sheet-preview-wrap {
    position: static;
  }
  .planner-form,
  .form-row,
  .step-grid,
  .mini-grid {
    grid-template-columns: 1fr;
  }
  .hero {
    padding: 32px 24px;
  }
  .pricing-cards {
    flex-direction: column;
    align-items: center;
  }
  .pricing-card {
    width: min(100%, 340px);
    min-width: 0;
  }
  .pricing-card.pro-card {
    transform: translateY(0);
  }
  .hero-text h1 {
    font-size: 28px;
  }
  .tl-points {
    grid-template-columns: 1fr;
  }
  .nav {
    width: 100%;
    justify-content: space-between;
  }
  .nav-btn {
    padding: 8px 10px;
  }
}

/* ---------- Print / PDF ---------- */
@media print {
  @page {
    margin: 0; /* Remove default headers and footers */
  }
  body {
    background: #fff;
  }
  .app {
    padding: 0;
  }
  .no-print {
    display: none !important;
  }
  .view.sheet-view {
    padding: 0;
  }
  .sheet-layout {
    display: block;
    gap: 0;
  }
  .sheet-preview-wrap {
    width: 100%;
    margin: 0;
  }
  .sheet-paper {
    box-shadow: none !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 15mm !important; /* Add padding to replace the removed page margins */
    width: 100% !important;
    min-height: 100vh !important;
    background: #fff !important;
    margin: 0 !important;
  }
  .theme-modern, .theme-vintage, .theme-nature, .theme-popart, .theme-space, .theme-kids, .theme-traditional, .theme-luxury, .theme-report {
    box-shadow: none !important;
  }
  * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* Theme Dropdown */
.theme-dropdown {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23000%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
  background-repeat: no-repeat;
  background-position: right 16px top 50%;
  background-size: 12px auto;
}
.theme-dropdown:focus {
  border-color: var(--primary);
  outline: none;
}

/* New Themes */
.theme-nature {
  background: #f0fdf4;
  color: #14532d;
  border: 2px solid #bbf7d0;
  font-family: 'Inter', sans-serif;
  background-image: none;
}
.theme-nature .paper-title { color: #166534; border-bottom: 2px dashed #86efac; }
.theme-nature .paper-info th, .theme-nature .paper-section-label { background: #dcfce7; color: #166534; border: none; }
.theme-nature .paper-info td { border-bottom: 1px solid #bbf7d0; }
.theme-nature .paper-section { border-bottom: 1px solid #bbf7d0; }

.theme-popart {
  background: #fff;
  color: #000;
  border: 4px solid #000;
  box-shadow: 8px 8px 0 #fbbf24;
  font-family: 'Inter', sans-serif;
  background-image: none;
}
.theme-popart .paper-title { color: #e11d48; text-shadow: 2px 2px 0 #000; border-bottom: 4px solid #000; font-weight: 900; }
.theme-popart .paper-info th, .theme-popart .paper-section-label { background: #fde047; border: 2px solid #000; color: #000; font-weight: 800; }
.theme-popart .paper-info td, .theme-popart .paper-section { border: 2px solid #000; }

.theme-space {
  background: #0f172a;
  color: #e2e8f0;
  border: 1px solid #334155;
  font-family: 'Inter', sans-serif;
  background-image: none;
}
.theme-space .paper-title { color: #c084fc; border-bottom: 2px solid #3b82f6; text-shadow: 0 0 10px rgba(192,132,252,0.5); }
.theme-space .paper-info th, .theme-space .paper-section-label { background: #1e293b; color: #60a5fa; border: 1px solid #334155; }
.theme-space .paper-info td, .theme-space .paper-section { border: 1px solid #334155; }
.theme-space .paper-template-tag { background: #1e293b; color: #93c5fd; }
.theme-space .paper-placeholder { background: rgba(255,255,255,0.1); }

.theme-kids {
  background: #fffbeb;
  color: #92400e;
  border: 4px dotted #fcd34d;
  border-radius: 32px;
  font-family: 'Inter', sans-serif;
  background-image: none;
}
.theme-kids .paper-title { color: #b45309; border-bottom: 4px dotted #fcd34d; }
.theme-kids .paper-info th, .theme-kids .paper-section-label { background: #fef3c7; color: #b45309; border: none; border-radius: 12px; }
.theme-kids .paper-info td, .theme-kids .paper-section { border-bottom: 1px dashed #fde68a; }

.theme-traditional {
  background: #faf8f5;
  color: #333;
  border: 2px double #8b4513;
  font-family: serif;
  background-image: none;
}
.theme-traditional .paper-title { color: #000; border-bottom: 1px solid #000; font-weight: normal; text-align: center; }
.theme-traditional .paper-info th, .theme-traditional .paper-section-label { border-bottom: 1px solid #ccc; color: #000; font-weight: bold; background: none;}
.theme-traditional .paper-info td, .theme-traditional .paper-section { border: none; }
.theme-traditional .paper-template-tag { background: #efe7dc; color: #5f3b1f; }

.theme-luxury {
  background: linear-gradient(135deg, #18181b, #27272a);
  color: #d4d4d8;
  border: 2px solid #fbbf24;
  font-family: 'Inter', sans-serif;
  background-image: none;
}
.theme-luxury .paper-title { color: #fcd34d; border-bottom: 1px solid #fbbf24; text-transform: uppercase; letter-spacing: 2px; }
.theme-luxury .paper-info th, .theme-luxury .paper-section-label { color: #fbbf24; background: rgba(251,191,36,0.1); border-left: 3px solid #fbbf24; border-bottom: none; }
.theme-luxury .paper-info td, .theme-luxury .paper-section { border-bottom: 1px solid #3f3f46; }
.theme-luxury .paper-template-tag { background: rgba(251,191,36,0.16); color: #fcd34d; }

.theme-report {
  background: #fff;
  color: #000;
  border: 1px solid #000;
  border-radius: 0;
  font-family: 'Inter', sans-serif;
  background-image: none;
}
.theme-report .paper-title { color: #000; border-bottom: 3px solid #000; text-align: left; letter-spacing: 0; margin-bottom: 12px; padding-bottom: 8px;}
.theme-report .paper-info, .theme-report .paper-info th, .theme-report .paper-info td { border: 1px solid #000; }
.theme-report .paper-info th { background: #f4f4f5; color: #000; }
.theme-report .paper-section { border: 1px solid #000; margin-bottom: -1px; }
.theme-report .paper-section-label { background: #f4f4f5; color: #000; border-bottom: 1px solid #000; }
.theme-report .paper-template-tag { background: #f4f4f5; color: #000; border: 1px solid #000; border-radius: 0; }

@keyframes bounce-walk {
  0% { transform: translateY(0) rotate(-3deg); }
  100% { transform: translateY(-4px) rotate(3deg); }
}

@keyframes running-bear {
  0% { transform: translateY(0) rotate(-10deg); }
  50% { transform: translateY(-10px) rotate(10deg); }
  100% { transform: translateY(0) rotate(-10deg); }
}

.bear-idle {
  animation: bounce-walk 1s infinite alternate;
}

.bear-running {
  animation: running-bear 0.25s infinite;
}
