:root {
  --ink: #2a211c;
  --ink-soft: #5f5048;
  --muted: #8a7a70;
  --line: rgba(42, 33, 28, 0.12);
  --line-strong: rgba(42, 33, 28, 0.85);
  --card: rgba(255, 252, 249, 0.62);
  --card-on: rgba(255, 253, 251, 0.95);
  --serif: "EB Garamond", "Times New Roman", serif;
  --sans: "Jost", "Segoe UI", system-ui, sans-serif;
  --panel-h: clamp(318px, 43svh, 372px);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: radial-gradient(130% 75% at 50% 28%, #fdf7f1 0%, #f6eadf 46%, #eedccd 100%) fixed;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}
button, input, a { font: inherit; color: inherit; }
button { cursor: pointer; }

.app {
  height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr var(--panel-h);
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "top" "stage" "panel";
}

/* ---------- üst ---------- */
.top {
  grid-area: top;
  display: flex; align-items: center; justify-content: center;
  height: 54px;
  padding-top: env(safe-area-inset-top);
  border-bottom: 1px solid var(--line);
}
.brand {
  font-family: var(--serif);
  font-size: 23px; font-weight: 500;
  letter-spacing: 0.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 88vw;
}

/* ---------- sahne ---------- */
.stage { grid-area: stage; position: relative; min-height: 0; min-width: 0; overflow: hidden; }
#c { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }
.stage-head {
  position: absolute; left: 0; right: 0; top: 14px;
  text-align: center; pointer-events: none; padding: 0 20px;
}
.stage-head h1 {
  font-family: var(--serif); font-weight: 400;
  font-size: 27px; line-height: 1.1; margin: 0;
}
.stage-sub {
  margin: 6px 0 0; font-size: 14px; color: var(--ink-soft);
  transition: opacity .3s;
}
.hint {
  position: absolute; left: 0; right: 0; bottom: 10px; margin: 0;
  text-align: center; font-size: 12.5px; color: var(--muted);
  pointer-events: none; transition: opacity .6s;
}
.hint.off { opacity: 0; }

.loader {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: radial-gradient(120% 80% at 50% 30%, #fdf7f1 0%, #f4e6da 100%);
  transition: opacity .7s ease;
  z-index: 3;
}
.loader.done { opacity: 0; pointer-events: none; }
.loader-in { text-align: center; }
.loader p { font-family: var(--serif); font-size: 21px; margin: 0 0 14px; }
.bar { width: 160px; height: 1px; background: var(--line); margin: 0 auto; overflow: hidden; }
.bar span { display: block; height: 100%; width: 8%; background: var(--ink); transition: width .4s ease; }
.loader.error p { font-size: 17px; max-width: 280px; line-height: 1.4; }

/* ---------- panel ---------- */
.panel {
  grid-area: panel;
  display: flex; flex-direction: column;
  min-height: 0; min-width: 0;
  background: rgba(255, 251, 247, 0.55);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  padding-bottom: env(safe-area-inset-bottom);
}

.steps {
  display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none;
  padding: 0 12px; border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}
.steps::-webkit-scrollbar { display: none; }
.steps button {
  flex: 0 0 auto; background: none; border: 0;
  padding: 12px 9px 11px; font-size: 14.5px; color: var(--muted);
  border-bottom: 1.5px solid transparent; margin-bottom: -1px;
  transition: color .25s, border-color .25s;
}
.steps button.on { color: var(--ink); border-bottom-color: var(--ink); }
.steps button.ok { color: var(--ink-soft); }

.step-body { flex: 1 1 auto; min-height: 0; padding: 14px 18px 0; overflow-y: auto; }
.step-body h2 { font-family: var(--serif); font-weight: 400; font-size: 23px; margin: 0; line-height: 1.15; }
.step-desc { margin: 4px 0 12px; font-size: 14px; color: var(--ink-soft); line-height: 1.4; }

.options { animation: rise .35s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* yatay kart şeridi */
.rail {
  display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory;
  margin: 0 -18px; padding: 2px 18px 6px; scrollbar-width: none;
  scroll-padding-left: 18px;
}
.rail::-webkit-scrollbar { display: none; }
.card {
  flex: 0 0 auto; scroll-snap-align: start;
  width: 112px; padding: 6px 6px 9px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  text-align: left; transition: border-color .25s, background .25s, transform .2s;
  display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start;
}
.card:active { transform: scale(.98); }
.card.on { border-color: var(--line-strong); background: var(--card-on); }
.card .ph {
  display: block; width: 100%; aspect-ratio: 1 / 1; border-radius: 10px;
  background: radial-gradient(90% 90% at 50% 40%, #fbf3ec 0%, #efdfd2 100%);
  object-fit: cover;
}
.card .nm { display: block; font-size: 15px; font-weight: 500; margin: 8px 4px 0; }
.card .ds { display: block; font-size: 12.5px; color: var(--ink-soft); margin: 2px 4px 0; line-height: 1.3; }
.card.wide { width: 132px; }
.card .ds { display: none; }

/* çip ızgarası */
.chips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.chip {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 8px; text-align: center; transition: border-color .25s, background .25s;
}
.chip.on { border-color: var(--line-strong); background: var(--card-on); }
.chip b { display: block; font-weight: 500; font-size: 15.5px; }
.chip small { display: block; font-size: 12.5px; color: var(--ink-soft); margin-top: 2px; }

.chips.sizes { display: flex; overflow-x: auto; gap: 8px; margin: 0 -18px; padding: 2px 18px 6px; scrollbar-width: none; }
.chips.sizes::-webkit-scrollbar { display: none; }
.chips.sizes .chip { flex: 0 0 auto; width: 74px; }
.note { font-size: 13px; color: var(--ink-soft); margin: 10px 0 0; line-height: 1.45; }
.linkish { background: none; border: 0; padding: 0; text-decoration: underline; text-underline-offset: 3px; color: var(--ink); font-size: 13.5px; }
.linkish.on { font-weight: 500; }

/* metal */
.metals { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.metal { background: none; border: 0; padding: 4px 0; text-align: center; }
.metal i {
  display: block; width: 52px; height: 52px; margin: 0 auto 8px; border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.08), 0 2px 6px rgba(80, 50, 30, .12);
  outline: 1px solid transparent; outline-offset: 4px; transition: outline-color .25s;
}
.metal.on i { outline-color: var(--line-strong); }
.metal b { display: block; font-weight: 500; font-size: 14px; }
.metal small { display: block; font-size: 12.5px; color: var(--ink-soft); }

/* yazı */
.field { position: relative; }
.field input {
  width: 100%; padding: 13px 54px 13px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--card-on); font-size: 16px; outline: none;
  font-family: var(--serif); font-size: 19px;
}
.field input:focus { border-color: var(--line-strong); }
.field .count { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font-size: 12.5px; color: var(--muted); }
.suggest { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.suggest button { background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; font-size: 13.5px; }

/* özet */
.summary { margin: 0; padding: 0; list-style: none; }
.summary li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.summary li span { color: var(--ink-soft); }
.summary li b { font-weight: 500; text-align: right; }

/* alt düğmeler */
.actions {
  flex: 0 0 auto; display: flex; gap: 10px; align-items: center;
  padding: 10px 18px 12px;
}
.btn-ghost {
  background: none; border: 1px solid var(--line); border-radius: 999px;
  height: 48px; padding: 0 20px; font-size: 15px;
}
.btn-ghost[disabled] { opacity: .35; cursor: default; }
.btn-primary {
  flex: 1; height: 48px; border-radius: 999px; border: 0;
  background: var(--ink); color: #fbf4ee; font-size: 15.5px; letter-spacing: .01em;
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  text-decoration: none; transition: background .25s;
}
.btn-primary:active { background: #000; }
.btn-wa svg { width: 20px; height: 20px; }
[hidden] { display: none !important; }

/* ---------- masaüstü ---------- */
@media (min-width: 960px) {
  .app {
    grid-template-columns: minmax(0, 1fr) 440px;
    grid-template-rows: auto 1fr;
    grid-template-areas: "top top" "stage panel";
  }
  .top { height: 64px; justify-content: flex-start; padding-left: 36px; }
  .brand { font-size: 26px; }
  .stage-head { text-align: left; left: 36px; top: 30px; padding: 0; }
  .stage-head h1 { font-size: 40px; }
  .stage-sub { font-size: 15px; }
  .hint { bottom: 24px; left: 36px; right: auto; text-align: left; }
  .panel { border-top: 0; border-left: 1px solid var(--line); }
  .steps { padding: 6px 22px 0; }
  .step-body { padding: 26px 30px 0; }
  .step-body h2 { font-size: 30px; }
  .step-desc { font-size: 15px; margin-bottom: 18px; }
  .rail { flex-wrap: wrap; overflow: visible; margin: 0; padding: 0; }
  .card { width: calc(50% - 5px); }
  .card.wide { width: calc(50% - 5px); }
  .rail.three .card { width: calc(33.333% - 7px); }
  .card .ds { display: block; }
  .chips.sizes { flex-wrap: wrap; margin: 0; padding: 0; overflow: visible; }
  .actions { padding: 16px 30px 26px; }
}
