:root {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --primary: #ea580c;
  --primary-dark: #c2410c;
  --primary-soft: #fff7ed;
  --navy: #1e293b;
  --green: #15803d;
  --green-soft: #f0fdf4;
  --red: #b91c1c;
  --red-soft: #fef2f2;
  --radius: 14px;
  --font-stack: "Noto Sans SC", "Noto Sans JP", "Noto Sans KR", "Noto Sans Devanagari", -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  display: none !important;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-stack);
  font-size: 15px;
  line-height: 1.5;
  overflow-x: hidden;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: 14px;
}

/* Resume Banner */
.resume-banner {
  background: var(--navy);
  color: #fff;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: sticky;
  top: 0;
  z-index: 90;
}
.resume-msg { font-size: 13px; }
.resume-actions { display: flex; gap: 8px; }

/* Sticky Top Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 10px 12px 8px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}
.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.top-brand-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--navy);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 44%;
}
.header-tools {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}
.tool-btn {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--ink);
  border-radius: 999px;
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.tool-btn.accent {
  background: var(--primary-soft);
  border-color: #fdba74;
  color: var(--primary-dark);
}

.lang-switch-wrap { position: relative; }
.lang-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.14);
  padding: 6px;
  min-width: 155px;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.lang-opt {
  text-align: left;
  border: none;
  background: transparent;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
}
.lang-opt.active { background: var(--primary-soft); color: var(--primary-dark); font-weight: 700; }

.progress-wrap {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.progress-text { font-size: 11px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.progress-track {
  flex: 1;
  height: 6px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #f59e0b);
  transition: width 0.25s ease;
}

/* Main Container */
.app-main {
  max-width: 560px;
  margin: 0 auto;
  padding: 14px 12px 28px;
}

/* Landing Screen (Step 0) */
.landing-screen {
  background: var(--surface);
  border-radius: 18px;
  padding: 24px 16px 22px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
  text-align: center;
}
.landing-badge {
  display: inline-block;
  background: var(--navy);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 12px;
}
.landing-title {
  margin: 0 0 8px;
  font-size: 20px;
  line-height: 1.35;
  color: var(--navy);
}
.landing-sub {
  margin: 0 0 18px;
  font-size: 13px;
  color: var(--muted);
}
.landing-prompt {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--primary-dark);
}
.lang-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.lang-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 14px 10px;
  background: #f8fafc;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.lang-card:active, .lang-card:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.lang-flag { font-size: 24px; }
.lang-main { font-size: 15px; font-weight: 700; color: var(--ink); }
.lang-sub { font-size: 11px; color: var(--muted); }

/* Step Card */
.step-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px 14px 20px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.05);
}
.step-card.has-budget-bar { padding-bottom: 92px; }
.step-title { margin: 0 0 6px; font-size: 18px; color: var(--navy); }
.step-desc { margin: 0 0 16px; font-size: 13px; color: var(--muted); }

.field-group { margin-bottom: 16px; }
.field-group.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field-label { display: block; font-size: 13px; font-weight: 700; color: var(--navy); margin-bottom: 8px; }
.field-label.sm { margin-top: 10px; font-size: 12px; }
.field-hint { font-size: 12px; color: var(--red); margin-top: 4px; }

.chip-grid { display: grid; grid-template-columns: 1fr; gap: 8px; }
.chip-grid.cols-2 { grid-template-columns: 1fr 1fr; }

.choice-chip {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 11px;
  border: 1.5px solid var(--border);
  background: #fff;
  color: var(--ink);
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.choice-chip.sm { min-height: 38px; padding: 8px 10px; font-size: 13px; }
.choice-chip.selected {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-dark);
}
.chip-check { font-weight: 700; font-size: 15px; flex-shrink: 0; }

.area-row { display: flex; gap: 8px; }
.text-input, .select-input {
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 10px 11px;
  background: #fff;
  color: var(--ink);
  min-height: 42px;
}
.text-input.full, .select-input.full { width: 100%; }
.select-input.sm { min-height: 34px; padding: 5px 8px; font-size: 12px; }

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 8px;
  font-size: 13px;
  cursor: pointer;
}
.check-row.box {
  background: #f8fafc;
  border: 1px solid var(--border);
  padding: 10px;
  border-radius: 10px;
}
.check-row input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--primary); flex-shrink: 0; }

.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

/* Step 3 Equipment Cards */
.sub-section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--navy);
  margin: 16px 0 8px;
}
.info-callout {
  background: #eff6ff;
  border-left: 3px solid #2563eb;
  color: #1e3a8a;
  padding: 9px 11px;
  border-radius: 8px;
  font-size: 12px;
  margin-bottom: 12px;
}

.equip-list { display: flex; flex-direction: column; gap: 12px; }
.equip-card {
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: #fff;
}
.equip-card.status-new, .equip-card.status-used { border-color: #fed7aa; }
.equip-card.status-skip { opacity: 0.65; }
.equip-head { display: flex; gap: 10px; align-items: flex-start; }
.equip-thumb {
  width: 64px;
  height: 48px;
  object-fit: contain;
  background: #f8fafc;
  border-radius: 8px;
  flex-shrink: 0;
}
.equip-info { flex: 1; min-width: 0; }
.equip-title { font-weight: 700; font-size: 14px; color: var(--navy); }
.equip-jp { font-size: 12px; color: var(--muted); }
.equip-spec {
  margin-top: 5px;
  background: #fef3c7;
  color: #92400e;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 7px;
  border-radius: 6px;
  display: inline-block;
}
.equip-tip { margin-top: 4px; font-size: 11.5px; color: #475569; }
.equip-rel { margin-top: 4px; font-size: 11.5px; color: #0369a1; }

.equip-prices {
  margin: 10px 0 8px;
  padding: 7px 9px;
  background: #f8fafc;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
}
.status-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}
.status-row.cols-3 { grid-template-columns: repeat(3, 1fr); }
.status-btn {
  min-height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.status-btn.active {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}
.equip-footer {
  margin-top: 9px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.picked-badge {
  background: var(--green-soft);
  color: var(--green);
  font-size: 11.5px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 999px;
}

/* Step 4 Package Boxes */
.pkg-box {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 14px;
  background: #fcfdff;
}
.pkg-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.pkg-head h3 { margin: 0; font-size: 14px; color: var(--navy); }

/* Step 6 Hz Badge */
.hz-badge {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 700;
}
.hz-ok { background: var(--green-soft); color: var(--green); border: 1px solid #bbf7d0; }
.hz-mixed { background: var(--red-soft); color: var(--red); border: 1.5px solid #fca5a5; }

/* Buttons */
.nav-actions {
  margin-top: 20px;
  display: flex;
  gap: 10px;
}
.btn-primary, .btn-secondary, .btn-outline-sm {
  min-height: 44px;
  border-radius: 11px;
  font-weight: 700;
  cursor: pointer;
  padding: 10px 14px;
  border: none;
}
.btn-primary {
  flex: 1;
  background: var(--primary);
  color: #fff;
}
.btn-primary:disabled { opacity: 0.6; }
.btn-secondary {
  background: #e2e8f0;
  color: var(--navy);
}
.btn-primary.sm, .btn-secondary.sm { min-height: 34px; padding: 6px 12px; font-size: 12px; flex: 0 0 auto; }
.btn-primary.full, .btn-secondary.full { width: 100%; }
.btn-outline-sm {
  min-height: 34px;
  padding: 5px 10px;
  font-size: 12px;
  background: #fff;
  border: 1.5px solid var(--primary);
  color: var(--primary-dark);
}

/* Bottom Floating Budget Bar */
.budget-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 55;
  background: var(--navy);
  color: #fff;
  padding: 10px 14px;
  box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.18);
}
.budget-inner { max-width: 560px; margin: 0 auto; }
.budget-row-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.budget-label { font-size: 12px; color: #cbd5e1; }
.budget-amount { font-size: 17px; color: #fdba74; }
.budget-meta { font-size: 10.5px; color: #94a3b8; margin-top: 2px; }

/* Step 7 Export Poster & Results */
.save-pill {
  padding: 8px 11px;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 12px;
}
.save-pill.ok { background: var(--green-soft); color: var(--green); }
.save-pill.local { background: #eff6ff; color: #1d4ed8; }

.export-poster {
  background: #fff;
  border: 2px solid var(--navy);
  border-radius: 12px;
  padding: 16px 14px;
  margin-bottom: 14px;
}
.poster-header {
  border-bottom: 2px solid var(--primary);
  padding-bottom: 10px;
  margin-bottom: 12px;
}
.poster-brand { font-size: 11px; font-weight: 700; color: var(--primary-dark); }
.poster-title { margin: 2px 0 4px; font-size: 16px; color: var(--navy); }
.poster-meta { font-size: 11px; color: var(--muted); }

.poster-section { margin-bottom: 12px; }
.poster-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  font-size: 12px;
}
.poster-grid .k { display: block; font-size: 10.5px; color: var(--muted); }
.poster-sec-title { margin: 0 0 6px; font-size: 13.5px; color: var(--navy); }
.poster-sub-title { margin: 10px 0 4px; font-size: 12px; color: var(--primary-dark); }

.alerts-box {
  background: var(--red-soft);
  border: 1px solid #fecaca;
  border-radius: 10px;
  padding: 10px;
}
.alert-item {
  font-size: 12px;
  font-weight: 700;
  color: var(--red);
  margin-bottom: 5px;
}
.alert-item:last-child { margin-bottom: 0; }
.alert-ok { font-size: 12px; color: var(--green); font-weight: 600; }

.poster-list {
  margin: 0;
  padding-left: 18px;
  font-size: 12px;
}
.poster-list li { margin-bottom: 4px; }
.poster-list .muted { color: var(--muted); font-size: 11px; }
.poster-list .tag {
  display: inline-block;
  white-space: nowrap;
  background: var(--primary-soft);
  color: var(--primary-dark);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
}
.poster-total {
  background: var(--navy);
  color: #fff;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 10px;
}
.poster-total-label { font-size: 11.5px; color: #cbd5e1; }
.poster-total-val { font-size: 20px; font-weight: 700; color: #fdba74; }
.poster-total-note { font-size: 10.5px; color: #94a3b8; }

.poster-disclaimer {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 11px;
  color: #475569;
  line-height: 1.45;
}

.result-actions { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.gen-img-wrap {
  background: #f8fafc;
  border: 1.5px dashed var(--primary);
  border-radius: 12px;
  padding: 10px;
  margin-bottom: 14px;
}
.img-tip { margin: 0 0 8px; font-size: 12.5px; font-weight: 700; color: var(--primary-dark); }
.gen-img-wrap img { width: 100%; border-radius: 8px; display: block; }

.jp-slip-box {
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12px;
}
.jp-slip-box summary { cursor: pointer; font-weight: 700; color: #fdba74; }
.jp-slip-box pre {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: monospace;
  font-size: 11px;
  margin: 8px 0 0;
  line-height: 1.45;
}

/* Slide-up Product Drawer */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  z-index: 100;
}
.product-drawer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-width: 560px;
  margin: 0 auto;
  height: 82vh;
  background: #fff;
  border-radius: 18px 18px 0 0;
  z-index: 110;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.drawer-head, .catalog-head {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.drawer-title, .catalog-head h3 { margin: 0; font-size: 14.5px; color: var(--navy); }
.close-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: #f8fafc;
  font-size: 16px;
  cursor: pointer;
}
.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px 24px;
}
.drawer-filters {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
  position: sticky;
  top: 0;
  background: #fff;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.seg-row { display: flex; gap: 6px; }
.seg-btn {
  flex: 1;
  min-height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #f8fafc;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.seg-btn.active { background: var(--navy); color: #fff; border-color: var(--navy); }

/* Product Row (Drawer & Full Catalog) */
.prod-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.prod-row {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px;
  background: #fff;
}
.prod-row img {
  width: 58px;
  height: 58px;
  object-fit: contain;
  background: #f8fafc;
  border-radius: 6px;
  flex-shrink: 0;
}
.prod-meta { flex: 1; min-width: 0; }
.prod-badges { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 3px; }
.badge {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
}
.badge.new { background: #dbeafe; color: #1d4ed8; }
.badge.used { background: #fef3c7; color: #b45309; }
.badge.dim { background: #f1f5f9; color: #475569; }
.prod-name {
  font-size: 12px;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.prod-price { font-size: 13.5px; font-weight: 700; color: var(--primary-dark); margin-top: 3px; }
.btn-pick {
  min-height: 34px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1.5px solid var(--primary);
  background: #fff;
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}
.btn-pick.picked { background: var(--green); border-color: var(--green); color: #fff; }

/* Full Catalog Modal */
.catalog-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: #fff;
  display: flex;
  flex-direction: column;
  max-width: 560px;
  margin: 0 auto;
}
.catalog-controls {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tab-pill-row, .sub-pill-row {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
}
.tab-pill, .sub-pill {
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: #f8fafc;
  color: var(--ink);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.tab-pill.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.sub-pill { padding: 4px 10px; font-size: 11.5px; }
.sub-pill.active { background: var(--primary-soft); color: var(--primary-dark); border-color: var(--primary); }
.catalog-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px 24px;
}

.loading-box, .empty-box {
  text-align: center;
  color: var(--muted);
  padding: 28px 12px;
  font-size: 13px;
}

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 84px;
  transform: translateX(-50%) translateY(16px);
  background: rgba(15, 23, 42, 0.92);
  color: #fff;
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s ease;
  z-index: 200;
  max-width: 90vw;
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
