/* ============================================================
   Wedding Photo Vote — clean & elegant (white × champagne gold)
   Flat, readable UI. Minimal gradients, generous whitespace.
   ============================================================ */

:root{
  --bg:          #ECE4D4;   /* desktop backdrop */
  --paper:       #FCFAF5;   /* app background */
  --card:        #FFFFFF;
  --line:        #EAE1CE;   /* hairline */
  --line-strong: #DBCDAD;
  --gold:        #BE9C4D;   /* primary gold */
  --gold-dark:   #9F7F36;   /* pressed / gold text */
  --gold-tint:   #F5EFE0;   /* light gold fill */
  --ink:         #463C2C;   /* main text */
  --ink-soft:    #6E5F47;
  --muted:       #9A8C72;   /* secondary text */

  --serif-en: "Cormorant Garamond", serif;
  --serif-ja: "Shippori Mincho", "Noto Serif JP", serif;
  --sans:     "Noto Sans JP", sans-serif;

  --r:   14px;   /* base radius */
  --r-lg: 18px;
}

*{ box-sizing:border-box; margin:0; padding:0; -webkit-tap-highlight-color:transparent; }
html,body{ height:100%; }
body{
  font-family:var(--sans);
  color:var(--ink);
  overflow:hidden;
  overscroll-behavior:none;
  background:var(--bg);
  display:flex; align-items:center; justify-content:center;
}
img{ -webkit-user-drag:none; user-select:none; }
button{ font-family:inherit; color:inherit; }
.ic{ width:1em; height:1em; display:inline-block; vertical-align:middle; }

/* ---------- App frame ---------- */
.app{
  position:relative;
  width:100%; max-width:480px; height:100dvh;
  display:flex; flex-direction:column; overflow:hidden;
  background:var(--paper);
}
@media (min-width:520px){
  .app{
    height:min(100dvh, 880px);
    border-radius:26px;
    box-shadow:0 30px 70px rgba(70,52,22,.28), 0 0 0 1px rgba(190,156,77,.16);
  }
}

/* ---------- subtle corner decoration ---------- */
.bg{ position:absolute; inset:0; z-index:0; pointer-events:none; overflow:hidden; }
.corner{ position:absolute; width:min(36%,150px); opacity:.28; }
.corner.tl{ top:-4px; left:-4px; }
.corner.tr{ top:-4px; right:-4px; transform:scaleX(-1); }
.corner.bl{ bottom:-4px; left:-4px; transform:scaleY(-1); }
.corner.br{ bottom:-4px; right:-4px; transform:scale(-1,-1); }

/* ---------- Top toggle ---------- */
.topbar{ position:relative; z-index:2; display:flex; justify-content:center; padding:16px 16px 8px; flex:0 0 auto; }
.toggle{
  display:inline-flex; gap:3px; padding:4px;
  background:#fff; border:1px solid var(--line); border-radius:999px;
  box-shadow:0 2px 8px rgba(120,90,30,.07);
}
.seg{
  padding:9px 20px; border:none; background:transparent; border-radius:999px;
  font-family:var(--sans); font-weight:700; font-size:14px; letter-spacing:.02em;
  color:var(--muted); cursor:pointer; transition:background .18s, color .18s;
}
.seg.is-active{ background:var(--gold); color:#fff; }

/* ---------- Views ---------- */
.views{ position:relative; z-index:1; flex:1; min-height:0; display:flex; }
.view{ flex:1; min-height:0; display:none; flex-direction:column; }
.view.is-active{ display:flex; }

/* ---------- Hero ---------- */
.hero{ flex:0 0 auto; text-align:center; padding:6px 18px 2px; }
.title{
  font-family:var(--serif-en); font-weight:600;
  font-size:clamp(22px, 6vw, 33px); line-height:1.05; letter-spacing:.01em;
  color:#B0883A; white-space:nowrap;
}
.subtitle{
  font-family:var(--serif-ja); font-weight:500;
  font-size:clamp(11px,3.2vw,13px); color:var(--ink-soft); letter-spacing:.04em;
  margin-top:7px;
}

/* ---------- Stage / carousel (browse only) ---------- */
.stage{ flex:1; min-height:0; display:flex; flex-direction:column; padding:10px 0 0; }
.carousel{
  flex:1; min-height:0;
  display:flex; align-items:center; gap:14px;
  overflow-x:auto; overflow-y:hidden;
  scroll-snap-type:x mandatory;
  -webkit-overflow-scrolling:touch; touch-action:pan-x;
  padding-inline:14%;
  scrollbar-width:none;
}
.carousel::-webkit-scrollbar{ display:none; }

/* framed photo — keeps original aspect ratio (portrait OR landscape) */
.card{
  position:relative; flex:0 0 auto;
  height:94%; width:72%; max-width:330px;
  background:#fff; border:1px solid var(--line); border-radius:var(--r-lg);
  box-shadow:0 5px 16px rgba(120,90,30,.10);
  display:grid; place-items:center; overflow:hidden; padding:9px;
  scroll-snap-align:center; cursor:pointer;
  transform:scale(.94); opacity:.72;
  transition:transform .32s cubic-bezier(.2,.8,.25,1), opacity .32s, box-shadow .32s;
}
.card.is-active{ transform:scale(1); opacity:1; height:100%; box-shadow:0 10px 28px rgba(120,90,30,.18); }
.card img{ max-width:100%; max-height:100%; width:auto; height:auto; object-fit:contain; border-radius:9px; display:block; }
.card .num{
  position:absolute; top:9px; left:9px;
  background:rgba(255,255,255,.94); border:1px solid var(--line);
  color:var(--gold-dark); font-family:var(--serif-en); font-style:italic; font-weight:600;
  font-size:19px; line-height:1; padding:3px 10px; border-radius:8px;
  box-shadow:0 1px 4px rgba(120,90,30,.12);
}
.card .ribbon{
  position:absolute; top:9px; right:9px;
  background:var(--gold); color:#fff; font-family:var(--sans); font-weight:700; font-size:11px;
  padding:4px 9px; border-radius:7px; opacity:0; transform:translateY(-3px); transition:.2s;
}
.card.is-chosen .ribbon{ opacity:1; transform:none; }

.stage-foot{ flex:0 0 auto; padding:8px 0 2px; }
.dots{ display:flex; justify-content:center; align-items:center; gap:6px; }
.dot{ width:6px; height:6px; border:none; padding:0; border-radius:99px; background:var(--line-strong); cursor:pointer; transition:.22s; }
.dot.is-active{ width:18px; background:var(--gold); }
.swipe-hint{ text-align:center; font-family:var(--sans); font-size:11.5px; color:var(--muted); margin-top:7px; letter-spacing:.04em; transition:opacity .4s; }
.swipe-hint.gone{ opacity:0; }

/* ============================================================
   Panel
   ============================================================ */
.panel{
  position:relative; z-index:1; flex:0 0 auto;
  margin:8px 12px calc(12px + env(safe-area-inset-bottom));
  padding:13px 18px 11px;
  background:#fff; border:1px solid var(--line); border-radius:var(--r-lg);
  box-shadow:0 -1px 14px rgba(120,90,30,.05);
}
.panel-head{ display:flex; align-items:center; justify-content:space-between; min-height:24px; }

.progress{ display:flex; align-items:center; gap:7px; }
.pd{ width:8px; height:8px; border-radius:99px; background:var(--line-strong); transition:.25s; }
.pd.is-done{ background:var(--gold); }
.pd.is-active{ width:22px; background:var(--gold); }

.name-tag{
  display:inline-flex; align-items:center; gap:6px; max-width:60%;
  background:transparent; border:none; cursor:pointer;
  font-family:var(--sans); font-size:13px; color:var(--muted); white-space:nowrap; overflow:hidden;
}
.name-tag b{ color:var(--ink); font-weight:700; overflow:hidden; text-overflow:ellipsis; }
.name-tag .ic{ width:14px; height:14px; color:var(--gold); flex:0 0 auto; }

.panel-body{ padding-top:14px; }
.ps{ display:flex; flex-direction:column; gap:14px; animation:fade .3s ease; }
@keyframes fade{ from{opacity:0; transform:translateY(5px)} to{opacity:1; transform:none} }

.prize{ text-align:center; font-family:var(--serif-ja); font-weight:700; font-size:23px; color:var(--ink); letter-spacing:.06em; }
.prize.center{ margin-top:4px; }
.sub{ text-align:center; font-family:var(--sans); font-size:12.5px; color:var(--muted); margin-top:-8px; }
.lead{ text-align:center; font-family:var(--sans); font-size:14px; color:var(--ink-soft); }

/* inputs */
.text-input{
  width:100%; padding:14px 16px; border:1px solid var(--line-strong); border-radius:var(--r);
  font-family:var(--sans); font-size:16px; color:var(--ink); text-align:center; background:#fff;
}
.text-input::placeholder{ color:#c4b794; }
.text-input:focus{ outline:none; border-color:var(--gold); box-shadow:0 0 0 3px rgba(190,156,77,.16); }

/* selection tile */
.select-tile{ width:100%; border-radius:var(--r); cursor:pointer; text-align:left; transition:.15s; font-family:var(--sans); }
.select-tile.is-empty{
  display:flex; align-items:center; justify-content:center; gap:8px;
  padding:16px; border:1.5px dashed var(--gold); background:var(--gold-tint);
  color:var(--gold-dark); font-weight:700; font-size:15.5px;
}
.select-tile.is-empty .ic{ width:18px; height:18px; }
.select-tile.is-filled{ display:flex; align-items:center; gap:13px; padding:10px 14px; border:1px solid var(--line); background:#fff; }
.select-tile .st-thumb{ width:50px; height:50px; border-radius:10px; object-fit:cover; flex:0 0 auto; }
.select-tile .st-no{ font-family:var(--serif-en); font-style:italic; font-weight:600; font-size:28px; color:var(--gold-dark); line-height:1; }
.select-tile .st-unit{ font-family:var(--sans); font-weight:700; font-size:14px; color:var(--ink); }
.select-tile .st-re{ margin-left:auto; display:inline-flex; align-items:center; gap:3px; color:var(--gold-dark); font-size:12.5px; font-weight:700; }
.select-tile .st-re .ic{ width:14px; height:14px; }

/* review (confirm) rows */
.review{ display:flex; flex-direction:column; gap:9px; }
.review-row{ width:100%; display:flex; align-items:center; gap:12px; padding:9px 13px; border:1px solid var(--line); border-radius:var(--r); background:#fff; cursor:pointer; transition:.15s; }
.review-row:active{ background:var(--gold-tint); }
.review-row .rr-label{ font-family:var(--serif-ja); font-weight:700; font-size:14px; color:var(--ink); width:92px; text-align:left; flex:0 0 auto; }
.review-row .rr-thumb{ width:42px; height:42px; border-radius:8px; object-fit:cover; flex:0 0 auto; }
.review-row .rr-thumb.empty{ display:grid; place-items:center; background:var(--gold-tint); color:var(--muted); font-size:11px; }
.review-row .rr-no{ margin-left:auto; font-family:var(--serif-en); font-style:italic; font-weight:600; font-size:25px; color:var(--gold-dark); line-height:1; }
.review-row .rr-chev{ width:15px; height:15px; color:var(--muted); flex:0 0 auto; }

/* buttons */
.btn{
  font-family:var(--sans); font-weight:700; font-size:16px;
  border-radius:var(--r); padding:14px 18px; cursor:pointer;
  border:1px solid transparent; transition:background .15s, border-color .15s, color .15s, opacity .15s;
  display:inline-flex; align-items:center; justify-content:center; gap:7px;
}
.btn .ic{ width:17px; height:17px; }
.btn-primary{ background:var(--gold); color:#fff; box-shadow:0 3px 10px rgba(160,120,40,.16); }
.btn-primary:active{ background:var(--gold-dark); }
.btn-primary:disabled{ background:#EEE7D6; color:#BEB196; box-shadow:none; cursor:default; }
.btn-ghost{ background:#fff; color:var(--gold-dark); border-color:var(--line-strong); }
.btn-ghost:active{ background:var(--gold-tint); }

.nav{ display:flex; gap:10px; }
.nav .btn-ghost{ flex:0 0 auto; padding-inline:22px; }
.nav .btn-primary{ flex:1; }

/* done */
.ps-done{ align-items:center; text-align:center; gap:8px; }
.done-emblem{ width:50px; height:50px; border-radius:99px; display:grid; place-items:center; background:var(--gold); margin:2px 0 4px; animation:pop .45s cubic-bezier(.2,1.3,.4,1); }
.done-emblem .ic{ width:26px; height:26px; color:#fff; }
@keyframes pop{ from{transform:scale(.4);opacity:0} to{transform:scale(1);opacity:1} }
.done-title{ font-family:var(--serif-ja); font-weight:700; font-size:18px; color:var(--ink); }
.done-sub{ font-family:var(--sans); font-size:12.5px; color:var(--muted); margin-bottom:4px; }

/* panel footer */
.panel-foot{ display:flex; align-items:center; justify-content:center; gap:5px; margin-top:11px; color:var(--muted); font-size:11px; letter-spacing:.04em; }
.panel-foot .ic{ width:12px; height:12px; }

/* ============================================================
   Photo picker sheet
   ============================================================ */
.sheet-backdrop{
  position:fixed; inset:0; z-index:50; display:flex; align-items:flex-end; justify-content:center;
  background:rgba(60,46,20,.34); opacity:0; pointer-events:none; transition:opacity .22s;
}
.sheet-backdrop.open{ opacity:1; pointer-events:auto; }
.sheet{
  width:100%; max-width:480px; background:#fff;
  border-radius:22px 22px 0 0; padding:10px 18px calc(18px + env(safe-area-inset-bottom));
  transform:translateY(100%); transition:transform .28s cubic-bezier(.2,.8,.25,1);
  box-shadow:0 -10px 30px rgba(80,58,22,.22); max-height:86vh; overflow-y:auto;
}
.sheet-backdrop.open .sheet{ transform:none; }
.sheet-handle{ width:40px; height:4px; border-radius:99px; background:var(--line-strong); margin:0 auto 12px; }
.sheet h3{ text-align:center; font-family:var(--serif-ja); font-weight:700; font-size:16px; color:var(--ink); margin-bottom:4px; }
.sheet .sheet-sub{ text-align:center; font-family:var(--sans); font-size:12px; color:var(--muted); margin-bottom:14px; }
.pick-grid{ display:grid; grid-template-columns:repeat(3,1fr); gap:10px; margin-bottom:14px; }
.pick-cell{ position:relative; aspect-ratio:1; border-radius:12px; overflow:hidden; border:1px solid var(--line); background:#fff; cursor:pointer; padding:0; }
.pick-cell img{ width:100%; height:100%; object-fit:cover; display:block; }
.pick-cell .pc-no{ position:absolute; top:5px; left:5px; background:rgba(255,255,255,.92); border-radius:6px; padding:1px 8px; font-family:var(--serif-en); font-style:italic; font-weight:600; font-size:15px; color:var(--gold-dark); }
.pick-cell.is-sel{ border-color:var(--gold); }
.pick-cell.is-sel::after{ content:""; position:absolute; inset:0; box-shadow:inset 0 0 0 3px var(--gold); border-radius:12px; }
.pick-cell.is-disabled{ cursor:default; }
.pick-cell.is-disabled img{ filter:grayscale(.7) brightness(.96); opacity:.45; }
.pick-cell .pc-lock{ position:absolute; left:0; right:0; bottom:0; background:rgba(70,52,22,.78); color:#fff; font-size:9.5px; padding:2px 0; text-align:center; }

/* ============================================================
   Toast
   ============================================================ */
.toast{
  position:fixed; left:50%; bottom:88px; z-index:60; transform:translate(-50%,16px);
  background:rgba(70,52,22,.93); color:#fff; padding:10px 18px; border-radius:999px;
  font-family:var(--sans); font-size:13px; opacity:0; pointer-events:none; transition:.24s;
  box-shadow:0 8px 20px rgba(60,42,12,.3); max-width:84%; text-align:center;
}
.toast.show{ opacity:1; transform:translate(-50%,0); }

/* ============================================================
   Game view (3連単)
   ============================================================ */
.game-body{ flex:1; min-height:0; overflow:auto; padding:14px 22px 24px; display:flex; align-items:center; }
.game-card{ width:100%; display:flex; flex-direction:column; gap:16px; }
.game-rule{ text-align:center; font-family:var(--serif-ja); font-size:14px; line-height:1.95; color:var(--ink); }
.game-rule b{ color:var(--gold-dark); }
.ticket-card{ padding:18px; border-radius:var(--r-lg); background:#fff; border:1px solid var(--line); box-shadow:0 8px 22px rgba(120,90,30,.10); }
.tc-head{ text-align:center; font-family:var(--serif-en); letter-spacing:.3em; font-size:12px; color:var(--gold-dark); margin-bottom:13px; }
.tc-empty{ text-align:center; font-family:var(--sans); font-size:13px; color:var(--muted); padding:12px 0; line-height:1.8; }
.tc-name{ text-align:right; font-family:var(--serif-ja); font-weight:700; font-size:14px; color:var(--ink); margin-top:12px; }
.game-foot{ text-align:center; font-family:var(--sans); font-size:12px; color:var(--muted); }

/* ---------- short-screen tuning ---------- */
@media (max-height:720px){
  .topbar{ padding-top:11px; }
  .title{ font-size:clamp(20px,5.2vh,28px); }
  .prize{ font-size:21px; }
  .ps{ gap:11px; }
  .btn{ padding:12px 16px; }
}
@media (max-height:620px){
  .subtitle{ display:none; }
  .swipe-hint{ display:none; }
}
