/* ==== reset / base ==== */
*,*::before,*::after{box-sizing:border-box}
html,body{margin:0;padding:0}
html{
  -webkit-text-size-adjust:100%;
  -webkit-tap-highlight-color:transparent;
}
body{
  font-family:-apple-system,BlinkMacSystemFont,"Pretendard","Apple SD Gothic Neo","Noto Sans KR",system-ui,sans-serif;
  background:
    radial-gradient(at 20% -10%, #ffe6d4 0%, transparent 45%),
    radial-gradient(at 90% 110%, #ffd9e6 0%, transparent 50%),
    #fff7ef;
  color:#1f1d1b;
  line-height:1.55;
  min-height:100vh;
  min-height:100dvh;
  overflow-x:hidden;
  font-feature-settings:"ss01","ss02";
  letter-spacing:-0.01em;
}
button{font-family:inherit;border:none;background:none;color:inherit;cursor:pointer;-webkit-tap-highlight-color:transparent}
ol,ul{margin:0;padding:0;list-style:none}
h1,h2,h3,p{margin:0}

/* ==== layout ==== */
#app{
  width:100%;
  max-width:480px;
  margin:0 auto;
  padding:24px 20px calc(28px + env(safe-area-inset-bottom));
  padding-top:calc(20px + env(safe-area-inset-top));
  min-height:100dvh;
  display:flex;
  flex-direction:column;
}
.screen{
  display:flex;
  flex-direction:column;
  gap:18px;
  flex:1;
  animation:fade .35s ease both;
}
@keyframes fade{
  from{opacity:0;transform:translateY(6px)}
  to{opacity:1;transform:none}
}
.center{align-items:center;justify-content:center;text-align:center}

/* ==== topbar ==== */
.topbar{
  display:flex;align-items:center;justify-content:space-between;
  margin-bottom:4px;
}
.topbar .back{
  width:36px;height:36px;border-radius:50%;
  background:rgba(0,0,0,.05);font-size:20px;line-height:1;
  display:flex;align-items:center;justify-content:center;
}
.topbar .step{
  font-size:12px;color:#7a7570;font-weight:600;letter-spacing:.04em;
}

/* ==== home / hero ==== */
.hero{padding:24px 4px 0}
.emoji-row{
  font-size:38px;display:flex;align-items:center;justify-content:center;gap:14px;
  margin-bottom:8px;
}
.emoji-row .vs{
  font-size:14px;font-weight:800;color:#ff6b35;
  background:#fff;border-radius:999px;padding:6px 10px;
  box-shadow:0 2px 6px rgba(255,107,53,.2);
}
h1{
  font-size:30px;line-height:1.25;font-weight:800;letter-spacing:-0.03em;
  margin-bottom:14px;
}
h2{font-size:22px;line-height:1.3;font-weight:800;letter-spacing:-0.02em}
h3{font-size:14px;font-weight:700;color:#7a7570;text-transform:uppercase;letter-spacing:.06em;margin-bottom:10px}
.lead{font-size:16px;color:#3d3a37;line-height:1.55}
.sub{font-size:14px;color:#7a7570;line-height:1.55}
.footnote{font-size:12px;color:#a8a39e;text-align:center;margin-top:6px}

/* ==== card ==== */
.card{
  background:#fff;
  border-radius:20px;
  padding:18px;
  box-shadow:0 2px 12px rgba(54,40,30,.05),0 0 0 1px rgba(54,40,30,.03);
}
.card.subtle{
  background:rgba(255,255,255,.55);
  backdrop-filter:blur(12px);
  -webkit-backdrop-filter:blur(12px);
  border:1px dashed rgba(255,107,53,.3);
}
.card .hint{
  font-size:14px;color:#5a5550;line-height:1.6;text-align:center;
  font-style:italic;
}

/* ==== buttons ==== */
.btn{
  width:100%;
  border-radius:16px;
  padding:16px 18px;
  font-size:16px;font-weight:700;
  display:flex;align-items:center;justify-content:center;gap:8px;
  transition:transform .12s ease, box-shadow .2s ease, background .2s ease;
  user-select:none;
}
.btn:active{transform:scale(.98)}
.btn.primary{
  background:#1f1d1b;color:#fff;
  box-shadow:0 6px 22px rgba(31,29,27,.18);
}
.btn.primary:hover{background:#2c2926}
.btn.ghost{
  background:#fff;color:#1f1d1b;
  box-shadow:0 0 0 1px rgba(31,29,27,.08), 0 1px 3px rgba(31,29,27,.04);
}
.btn.full{margin-top:8px}
.row{display:flex;align-items:center}
.row.gap{gap:10px}
.flex{flex:1}
.bottom-cta{margin-top:auto;display:flex;flex-direction:column;gap:10px;padding-top:24px}
.bottom-cta.two{flex-direction:row;gap:10px}
.bottom-cta.two .btn{flex:1}

/* ==== chips ==== */
.chips{display:flex;flex-wrap:wrap;gap:10px;margin-top:8px}
.chip{
  padding:12px 16px;border-radius:999px;
  background:#fff;
  box-shadow:0 0 0 1px rgba(31,29,27,.08);
  font-size:15px;font-weight:600;color:#3d3a37;
  display:inline-flex;align-items:center;gap:6px;
  transition:all .15s ease;
}
.chip[aria-pressed="true"]{
  background:#1f1d1b;color:#fff;
  box-shadow:0 4px 14px rgba(31,29,27,.2);
}
.chips.single{flex-direction:column}
.chips.single .chip{
  width:100%;justify-content:center;padding:18px;font-size:16px;
}

/* ==== quiz ==== */
.progress{
  height:6px;border-radius:999px;background:rgba(31,29,27,.08);overflow:hidden;
}
.progress .bar{
  height:100%;width:0%;background:linear-gradient(90deg,#ff6b35,#ff9966);
  transition:width .4s ease;
  border-radius:999px;
}
.context{
  font-size:18px;font-weight:700;text-align:center;
  margin:18px 0 6px;letter-spacing:-0.02em;
}
.vs-grid{
  display:flex;flex-direction:column;gap:12px;margin-top:8px;
  position:relative;
}
.food-card{
  background:#fff;border-radius:24px;
  padding:32px 20px;
  display:flex;flex-direction:column;align-items:center;gap:10px;
  box-shadow:0 4px 20px rgba(54,40,30,.07),0 0 0 1px rgba(54,40,30,.03);
  transition:transform .15s ease, box-shadow .2s ease, background .2s ease;
}
.food-card:active{transform:scale(.97)}
.food-card .food-emoji{font-size:56px;line-height:1}
.food-card .food-name{font-size:24px;font-weight:800;letter-spacing:-0.02em}
.food-card .food-tags{
  display:flex;flex-wrap:wrap;gap:6px;justify-content:center;
}
.food-card .food-tags span{
  font-size:12px;font-weight:600;color:#7a7570;
  background:rgba(31,29,27,.05);padding:4px 10px;border-radius:999px;
}
.vs-mid{
  align-self:center;font-size:13px;font-weight:800;
  color:#ff6b35;letter-spacing:.1em;
  background:#fff;border-radius:999px;padding:4px 12px;
  box-shadow:0 2px 6px rgba(255,107,53,.2);
  margin:-6px 0;z-index:1;
}
.alt-actions{
  display:flex;gap:10px;margin-top:12px;
}
.alt-actions .btn{padding:13px 14px;font-size:14px;font-weight:600;color:#7a7570}

/* picked highlight */
.food-card.picked{
  background:linear-gradient(135deg,#1f1d1b,#3a3633);color:#fff;
  box-shadow:0 8px 28px rgba(31,29,27,.3);
}
.food-card.picked .food-tags span{background:rgba(255,255,255,.12);color:rgba(255,255,255,.8)}

/* ==== alert / cycle ==== */
.alert{justify-content:center;align-items:stretch}
.alert-card{
  background:#fff;border-radius:24px;padding:28px 22px;
  text-align:center;
  box-shadow:0 12px 40px rgba(255,107,53,.18);
  border:2px solid rgba(255,107,53,.2);
  display:flex;flex-direction:column;gap:14px;align-items:center;
}
.alert-emoji{font-size:48px}
.alert-sub{font-size:14px;color:#7a7570;line-height:1.55}
.alert-note{
  font-size:14px;color:#3d3a37;
  background:rgba(255,107,53,.08);padding:12px 14px;border-radius:14px;
  margin-top:4px;font-weight:600;
}
.cycle-graph{
  display:flex;flex-wrap:wrap;justify-content:center;align-items:center;
  gap:6px;font-size:15px;font-weight:700;
}
.cycle-graph span{
  background:#1f1d1b;color:#fff;padding:6px 12px;border-radius:999px;
}
.cycle-graph .arrow{background:transparent;color:#ff6b35;padding:0}

/* ==== loader ==== */
.loader{
  width:48px;height:48px;border-radius:50%;
  border:4px solid rgba(31,29,27,.1);
  border-top-color:#ff6b35;
  animation:spin 1s linear infinite;
  margin-bottom:8px;
}
@keyframes spin{to{transform:rotate(360deg)}}

/* ==== result ==== */
.result-hero{padding:8px 4px 0;text-align:center}
.badge{
  display:inline-block;
  font-size:12px;font-weight:800;letter-spacing:.1em;
  background:#1f1d1b;color:#fff;padding:6px 12px;border-radius:999px;
  margin-bottom:14px;text-transform:uppercase;
}
.score-card{
  background:linear-gradient(135deg,#1f1d1b,#322d29);color:#fff;
  border-radius:24px;padding:22px;text-align:center;
  box-shadow:0 8px 28px rgba(31,29,27,.18);
}
.score-num{font-size:56px;font-weight:800;letter-spacing:-0.04em;line-height:1}
.score-num small{font-size:20px;color:rgba(255,255,255,.5);font-weight:600}
.score-label{font-size:13px;color:rgba(255,255,255,.7);margin:6px 0 14px;letter-spacing:.05em}
.meter{height:8px;border-radius:999px;background:rgba(255,255,255,.12);overflow:hidden}
.meter-bar{
  height:100%;width:0%;
  background:linear-gradient(90deg,#ff6b35,#ffb88a);
  transition:width .8s ease;
  border-radius:999px;
}
.ranking li{
  display:flex;align-items:center;gap:12px;
  padding:10px 4px;
  border-bottom:1px solid rgba(31,29,27,.06);
  font-size:15px;
}
.ranking li:last-child{border-bottom:none}
.ranking .rank-num{
  width:24px;font-weight:800;color:#ff6b35;
}
.ranking .rank-emoji{font-size:22px;line-height:1}
.ranking .rank-name{flex:1;font-weight:700}
.ranking .rank-elo{font-size:12px;color:#a8a39e;font-variant-numeric:tabular-nums}

.cycle-row{
  background:rgba(255,107,53,.06);
  border-left:3px solid #ff6b35;
  padding:12px 14px;border-radius:10px;
  margin-bottom:8px;font-size:14px;font-weight:600;
  display:flex;flex-wrap:wrap;align-items:center;gap:6px;
}
.cycle-row:last-child{margin-bottom:0}
.cycle-row .arrow{color:#ff6b35;font-weight:800}

.features{display:flex;flex-direction:column;gap:10px}
.feat{
  display:grid;grid-template-columns:90px 1fr 36px;align-items:center;gap:10px;
  font-size:13px;
}
.feat-name{font-weight:700;color:#3d3a37}
.feat-val{
  font-variant-numeric:tabular-nums;color:#7a7570;text-align:right;
}
.feat-bar{height:6px;background:rgba(31,29,27,.08);border-radius:999px;overflow:hidden}
.feat-bar > span{
  display:block;height:100%;background:linear-gradient(90deg,#ff6b35,#ffb88a);
  border-radius:999px;transition:width .8s ease;
}

.stated{
  font-size:14px;line-height:1.6;color:#3d3a37;
}
.stated b{color:#ff6b35}

/* ==== preference graph ==== */
.graph-desc{margin-bottom:12px}
.graph-wrap{
  width:100%;max-width:360px;margin:0 auto;
  aspect-ratio:1/1;
  background:rgba(31,29,27,.025);
  border-radius:14px;
  overflow:hidden;
}
.graph-wrap svg{width:100%;height:100%;display:block}
.graph-edge{stroke:#bdb6af;stroke-width:1.5;fill:none}
.graph-edge.cycle{stroke:#ff6b35;stroke-width:2.4}
.graph-edge.rev{stroke:#9c5fff;stroke-width:2.2;stroke-dasharray:4 3}
.graph-node-circle{fill:#fff;stroke:#1f1d1b;stroke-width:1.5}
.graph-node-circle.in-cycle{stroke:#ff6b35;stroke-width:2.5}
.graph-node-emoji{font-size:18px;text-anchor:middle;dominant-baseline:central}
.graph-node-name{
  font-size:11px;font-weight:700;text-anchor:middle;
  fill:#1f1d1b;
  paint-order:stroke;stroke:#fff;stroke-width:3;
}
.graph-legend{
  display:flex;justify-content:center;gap:14px;
  font-size:11px;color:#7a7570;margin-top:12px;flex-wrap:wrap;
}
.graph-legend span{display:inline-flex;align-items:center;gap:4px}
.graph-legend .dot{
  width:14px;height:3px;border-radius:2px;background:#bdb6af;display:inline-block;
}
.graph-legend .dot.cycle{background:#ff6b35;height:3px}
.graph-legend .dot.rev{background:#9c5fff}
.graph-empty{
  display:flex;align-items:center;justify-content:center;height:100%;
  color:#a8a39e;font-size:13px;
}

.share-preview{
  background:linear-gradient(135deg,#1f1d1b,#3a3633);
  color:#fff;border-radius:18px;padding:22px;
  margin-bottom:14px;
  font-size:14px;line-height:1.6;
  white-space:pre-line;
  position:relative;overflow:hidden;
}
.share-preview::before{
  content:"";position:absolute;top:-30px;right:-30px;
  width:120px;height:120px;border-radius:50%;
  background:radial-gradient(circle,rgba(255,107,53,.4),transparent 70%);
}

/* ==== misc ==== */
@media (max-height:700px){
  h1{font-size:26px}
  .food-card{padding:24px 18px}
  .food-card .food-emoji{font-size:48px}
}
@media (min-width:600px){
  .vs-grid{flex-direction:row;align-items:stretch}
  .vs-grid .food-card{flex:1}
  .vs-mid{margin:0;align-self:center}
}
