/* ===== SUIT Web Font ===== */
@font-face {
  font-family: 'SUIT';
  src: url('../assets/fonts/SUIT-Light.woff2') format('woff2');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'SUIT';
  src: url('../assets/fonts/SUIT-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'SUIT';
  src: url('../assets/fonts/SUIT-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'SUIT';
  src: url('../assets/fonts/SUIT-SemiBold.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'SUIT';
  src: url('../assets/fonts/SUIT-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'SUIT';
  src: url('../assets/fonts/SUIT-ExtraBold.woff2') format('woff2');
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

/* ===== RC-2.0.0 Design Tokens ===== */
:root{
  --bg:#f3f5f7;
  --card:#ffffff;
  --line:#e5e7eb;
  --text:#0f172a;
  --muted:#64748b;

  --c-primary:#e53e3e;
  --c-primary-dark:#c53030;
  --c-primary-tint:#fff5f5;
  --c-border:#d1d5db;

  --brand:var(--c-primary);
  --brand2:#fc8181;

  --good:#16a34a;
  --warn:#f59e0b;
  --bad:#ef4444;

  --shadow:0 10px 30px rgba(15,23,42,.08);
  --radius:14px;

  /* Designer tokens (added, do not override existing meanings) */
--white: #FFFFFF;
--black_05: #F7F7F7;
--black_50: #6F6F6F;
--primary_20: #FFE6EB;
--black_30: #BABABA;
--black_20: #E3E3E3;
--black_10: #EFEFEF;
--black: #070707;
--primary-color: #CE0F2D;





}

*{ box-sizing:border-box; }
html{ overflow-x:hidden; }
body{
  margin:0;
  overflow-x:hidden;
  font-family: 'SUIT', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background:var(--bg);
  color:var(--text);
}

/* ===== Phase A: 360px Fixed Shell + Coordinate Root ===== */
.app-shell{
  width:360px;
  min-height:680px;
  margin:0 auto;
  background:var(--white, #FFFFFF);
  overflow-x:hidden;
}
.stage{
  position:relative;
  width:360px;
  min-height:680px;
  padding:0 !important;
  margin:0 !important;
}

/* ===== XD Header (56px, pixel-fixed) ===== */
.xd-header{
  position:relative;
  width:360px;
  height:56px;
  background:var(--white, #FFFFFF);
  border-bottom:1px solid var(--black_20, #E3E3E3);
  z-index:11;
}
.xd-header__logo{
  position:absolute;
  top:14px;
  left:85px;
  width:68px;
  height:28px;
  display:block;
}
.xd-header__title{
  position:absolute;
  top:14px;
  left:157px;
  width:118px;
  height:28px;
  line-height:28px;
  font-family:'SUIT', sans-serif;
  font-weight:700;
  font-size:22px;
  letter-spacing:-0.44px;
  color:#CE0F2D;
  text-align:center;
  white-space:nowrap;
}

/* Legacy topbar: visually hidden, DOM kept for JS refs */
.legacy-topbar{
  position:absolute !important;
  width:1px !important;
  height:1px !important;
  padding:0 !important;
  margin:-1px !important;
  overflow:hidden !important;
  clip:rect(0,0,0,0) !important;
  border:0 !important;
}

/* topbar (legacy, base rules kept for non-hidden contexts) */
.topbar{
  position:sticky;
  top:0;
  z-index:10;
  background:linear-gradient(rgba(243,245,247,1) 78%, rgba(243,245,247,0));
  padding:10px 0 8px;
}

.topbar-inner{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}

.leftGroup{
  display:flex;
  align-items:center;
  gap:10px;
  min-width:0;
  flex:1;
}

.title{
  font-size:14px;
  font-weight:900;
  letter-spacing:-.2px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.versionBadge{
  flex:0 0 auto;
  font-size:11px;
  color:#94a3b8;
  letter-spacing:.2px;
  white-space:nowrap;
  display:flex;
  align-items:center;
  gap:6px;
}
.versionBadge .dotSep{
  color:#cbd5e1;
  margin:0 2px;
}

.progress{
  margin-top:10px;
  width:320px;
  height:8px;
  border-radius:6px;
  background:var(--black_10, #EFEFEF);
  overflow:hidden;
}
.bar{
  height:8px;
  width:0%;
  border-radius:6px;
  background:var(--primary-color, #CE0F2D);
  transition:width 0.3s ease;
}

/* layout primitives */
.sp{ height:10px; }
.row{ display:flex; gap:10px; flex-wrap:wrap; }
.col{ flex:1; min-width:0; }

/* typography */
.small{ font-size:12px; color:var(--muted); line-height:1.45; }
.label{ font-size:12px; color:var(--muted); margin-bottom:6px; }

/* status */
.warn{ color:var(--warn); font-weight:900; }
.err{ color:var(--bad); font-weight:900; }
.ok{ color:var(--good); font-weight:900; }

.hr{ height:1px; background:var(--line); margin:10px 0; }

/* ===== RC-2.2 App Shell (neutralized for Phase A) ===== */
.app{
  width:360px;
  margin:0 !important;
  padding:0 !important;
}
/* App shell inner sections */
.app__header{
  position:sticky;
  top:0;
  z-index:10;
  padding:12px 0 8px;
}
/* .app__progress margin-top: SSOT is .stage > .app__progress { margin:20px auto 0 } in components.css
   (stale 12px rule removed 2026-02-24 — was overridden by higher specificity, never active) */
.app__main{
  margin-top:4px;
  padding:0 16px calc(var(--footer-h, 88px) + env(safe-area-inset-bottom, 0px));
}
/* Footer owned by .btnrow in components.css */
/* ===== Production: hide dev-only panels by default ===== */
.debug-panel,
.json-panel{
  display:none !important;
}
/* Top Back button not in mobile design; nav via bottom "이전" only */
@media (max-width: 640px){
  .topbar-inner .backBtn{
    display:none !important;
  }
}
/* Show dev panels only when ?dev=1 activates is-dev class */
html.is-dev .debug-panel,
html.is-dev .json-panel{
  display:block !important;
}

/* ===== Dev mode: 7-tap logo easter egg — bottom sheet ===== */
/* Un-clip legacy-topbar just enough for fixed children to escape */
body.dev-open .legacy-topbar{
  position:static !important;
  width:0 !important;
  height:0 !important;
  padding:0 !important;
  margin:0 !important;
  overflow:visible !important;
  clip:auto !important;
  border:0 !important;
}
/* Both panels: fixed bottom sheet */
body.dev-open .debug-panel,
body.dev-open .json-panel{
  display:block !important;
  position:fixed !important;
  left:0 !important; right:0 !important; bottom:0 !important;
  top:auto !important;
  max-height:40vh !important;
  overflow-y:auto !important;
  overflow-x:hidden !important;
  margin:0 !important;
  padding:14px 16px !important;
  background:#fff !important;
  border-radius:0 !important;
  border:0 !important;
  border-top:1px solid var(--black_20, #E3E3E3) !important;
  box-shadow:0 -8px 24px rgba(0,0,0,.12) !important;
  z-index:10002 !important;
}
/* json-panel (upload) on top — primary need */
body.dev-open .json-panel{ z-index:10003 !important; }
/* debug-panel behind json — visible only after scrolling json or if json is short */
body.dev-open .debug-panel{ z-index:10002 !important; max-height:25vh !important; }
/* Lift footer buttons above panel */
body.dev-open .btnrow.app__footer{
  bottom:calc(40vh + 8px) !important;
  z-index:10004 !important;
}
/* Push main content above sheet + raised footer */
body.dev-open .app__main{
  padding-bottom:calc(40vh + 90px) !important;
}

/* ==========================================================================
   DEV SLIM FIXED BAR — Mobile Only (360px Phase A)
   ==========================================================================
   Condition : body.dev-open  AND  max-width:640px
   Purpose   : Collapse the full-height JSON bottom-sheet into a single-row
               slim fixed bar sitting directly above the footer.
   Layout    : [ Label ]  [ FileName ···]  [ Version Badge → ]
   z-index   : footer 8000 < json-panel 9000 < versionBadge 9001 < modals 10001+
   ========================================================================== */
@media (max-width: 640px) {

  /* ------------------------------------------------------------------
     json-panel → slim fixed bar (single row, above footer)
     Footer height = 12+52+12 = 76px + safe-area-inset-bottom
     ------------------------------------------------------------------ */
  body.dev-open .json-panel {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    /* sit directly above footer; account for iOS safe area */
    bottom: calc(76px + env(safe-area-inset-bottom, 0px)) !important;
    top: auto !important;
    height: 40px !important;
    max-height: 40px !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 14px !important;
    gap: 10px !important;
    background: #fff !important;
    border-radius: 0 !important;
    border: 0 !important;
    border-top: 1px solid var(--black_20, #E3E3E3) !important;
    box-shadow: 0 -2px 8px rgba(0,0,0,.06) !important;
    z-index: 9000 !important;
  }

  /* ------------------------------------------------------------------
     Hide progress dots on mobile dev-open (not in design)
     ------------------------------------------------------------------ */
  body.dev-open .dots {
    display: none !important;
  }

  /* ------------------------------------------------------------------
     Hide non-essential children inside json-panel on mobile
     .sp (spacers), .small (debug description), .mutedBox (#errorBox)
     ------------------------------------------------------------------ */
  body.dev-open .json-panel > .sp {
    display: none !important;
  }
  body.dev-open .json-panel > .small {
    display: none !important;
  }
  body.dev-open .json-panel > .mutedBox {
    display: none !important;
  }

  /* ------------------------------------------------------------------
     .label — left-aligned, no shrink, single line
     ------------------------------------------------------------------ */
  body.dev-open .json-panel > .label {
    flex: 0 0 auto;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100px;
    margin: 0 !important;
    font-size: 11px;
    line-height: 40px;
  }

  /* ------------------------------------------------------------------
     .fileLine — center section, fills remaining space
     ------------------------------------------------------------------ */
  body.dev-open .json-panel > .fileLine {
    flex: 1 1 0;
    min-width: 0;
    display: flex !important;
    align-items: center;
    gap: 0;
    overflow: hidden;
  }

  /* File <input>: overlay for click target, visually hidden label */
  body.dev-open .json-panel #jsonFile {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 1;
  }

  /* #fileName: single-line ellipsis */
  body.dev-open .json-panel #fileName {
    flex: 1 1 0;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 11px;
    line-height: 40px;
  }

  /* ------------------------------------------------------------------
     .versionBadge — fixed, right-aligned inside the slim bar area
     Reuses existing DOM in .topbar-inner (no new elements created).
     ------------------------------------------------------------------ */
  body.dev-open .versionBadge {
    position: fixed !important;
    left: auto !important;
    right: 14px !important;
    bottom: calc(76px + env(safe-area-inset-bottom, 0px)) !important;
    top: auto !important;
    height: 40px !important;
    display: flex !important;
    visibility: visible !important;
    align-items: center !important;
    z-index: 9001 !important;   /* above json-panel (9000), below modals (10001+) */
    font-size: 10px !important;
    white-space: nowrap !important;
    max-width: 120px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    pointer-events: none !important;
    color: #94a3b8 !important;
  }

  /* ------------------------------------------------------------------
     debug-panel: fully hidden on mobile slim bar mode
     (only the json-panel slim bar is shown)
     ------------------------------------------------------------------ */
  body.dev-open .debug-panel {
    display: none !important;
  }

  /* ------------------------------------------------------------------
     Footer: keep at natural bottom (no lift needed for slim bar)
     Override the desktop dev-open rule that lifts footer by 40vh.
     ------------------------------------------------------------------ */
  body.dev-open .btnrow.app__footer {
    bottom: 0 !important;
    z-index: 8000 !important;
  }

  /* ------------------------------------------------------------------
     Spacing compensation — prevent content from hiding behind
     the fixed slim bar (40px) + footer (76px) + safe-area
     ------------------------------------------------------------------ */
  body.dev-open .app__main {
    padding-bottom: calc(
      76px               /* footer */
      + 40px             /* slim bar */
      + 16px             /* breathing room */
      + env(safe-area-inset-bottom, 0px)
    ) !important;
  }

  /* ------------------------------------------------------------------
     Ensure buttons remain fully clickable — no pointer-event blocking
     from the slim bar or version badge overlay
     ------------------------------------------------------------------ */
  body.dev-open .btnrow.app__footer * {
    pointer-events: auto;
  }

} /* end @media (max-width: 640px) */

/* ==========================================================================
   DEV BAR — html.dev-open (toggled by 7-tap logo OR ?dev=1 auto-open)
   Fixed above footer. No layout coupling to app content.
   ========================================================================== */

/* Logo: hint it's tappable */
.xd-header__logo {
  cursor: pointer;
}

/* #devbar: hidden by default */
#devbar {
  display: none;
}

/* html.dev-open: fixed above real footer, centered over 360px frame */
html.dev-open #devbar {
  display: flex;
  align-items: center;
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  width: 360px;
  height: 44px;
  bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  z-index: 10000;
  padding: 0 10px;
  gap: 8px;
  background: #fff;
  border-top: 1px solid var(--black_20, #E3E3E3);
  box-shadow: 0 -2px 8px rgba(0, 0, 0, .07);
  box-sizing: border-box;
  overflow: hidden;
  border-radius: 12px 12px 0 0;
}

/* Legacy panels: hidden inside devbar to prevent flex collapse */
html.dev-open #devbar .json-panel,
html.dev-open #devbar .debug-panel {
  display: none !important;
}

/* Upload row */
.devbar-upload {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.devbar-upload__btn {
  flex: 0 0 auto;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--black_30, #BABABA);
  border-radius: 8px;
  background: #fff;
  font-family: 'SUIT', sans-serif;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}

.devbar-upload__btn:active {
  background: var(--black_10, #EFEFEF);
}

.devbar-upload__name {
  flex: 1 1 0;
  min-width: 0;
  font-size: 12px;
  color: var(--muted, #64748b);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Ensure main content isn't covered by fixed devbar + footer */
html.dev-open .app__main {
  padding-bottom: calc(
    76px    /* footer */
    + 44px  /* devbar */
    + 16px  /* breathing room */
    + env(safe-area-inset-bottom, 0px)
  ) !important;
}

/* Toast notification */
.share-toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(7,7,7,0.85);
  color: #fff;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  z-index: 10000;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
  white-space: nowrap;
}
.share-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ==========================================================================
   PC LAYOUT — Desktop 3-Column (>= 1200px)
   Spec: docs/answer1.md Zeplin 실측 + design-specs.md
   1920px 기준: left 934 + center 572 + right 414 = 1920
   ========================================================================== */

/* Mobile default: hide PC-only panels */
.pc-left,
.pc-right,
.pc-wave { display: none; }

/* .pc-layout: no flex on mobile — just a transparent wrapper */
.pc-layout { display: block; }

@media (min-width: 1200px) {

  body { background: #F4F4F4; }

  /* --- 3-column flex --- */
  .pc-layout {
    display: flex;
    min-height: 100vh;
    position: relative;
    overflow: hidden;
    background: #F4F4F4;
  }

  /* --- Wave decoration (assets/pc/shape.svg) ---
     XD artboard 1920×1080 기준 절대좌표 → vw/vh 비례 스케일링.
     Shape: left:-56.48, top:665, width:2223, height:644 */
  .pc-wave {
    display: block;
    position: absolute;
    left:   calc(100vw * -56.48 / 1920);
    top:    calc(100vh * 665 / 1080);
    width:  calc(100vw * 2222.96 / 1920);
    height: auto;
    pointer-events: none;
    z-index: 0;
  }

  /* --- Left branding panel ---
     answer1.md: 좌측 여백 414px + 브랜딩 388px + 갭 132px = 934px
     flex-basis:520px = branding(388) + gap(132) → 1920시 flex-grow로 934px */
  .pc-left {
    display: flex;
    flex: 1 1 520px;
    min-width: 388px;
    justify-content: flex-end;
    align-items: flex-start;
    position: relative;
    z-index: 1;
  }

  /* --- Branding stack ---
     answer1.md: 전체 폭 388px (icons 기준), margin-right:132px (center까지 갭) */
  .pc-branding {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 388px;
    flex-shrink: 0;
    padding-top: 192px;
    margin-right: 132px;
  }

  /* --- Individual asset spacing (answer1.md Zeplin margins) ---
     alleva→QR: 40px, QR→icons: 44px, icons→diusapet: 52px */
  .pc-asset {
    display: block;
    flex-shrink: 0;
    object-fit: contain;
  }
  .pc-asset:nth-child(1) { margin-bottom: 40px; }  /* alleva → QR */
  .pc-asset:nth-child(2) { margin-bottom: 44px; }  /* QR → icons */
  .pc-asset:nth-child(3) { margin-bottom: 52px; }  /* icons → diusapet */

  /* --- Center app column (540px fixed) ---
     540 / 360 = 1.5 (정수배 zoom → 폰트 선명) */
  .pc-center {
    flex: 0 0 540px;
    width: 540px;
    background: #FFFFFF;
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
  }

  /* Scale 360px content → 540px frame (540/360 = 1.5) */
  .pc-center > .app-shell {
    flex: 1 1 auto;
    zoom: 1.5;
  }
  .pc-center > .btnrow.app__footer {
    zoom: 1.5;
  }

  /* PC: 모바일용 min-height 해제 — 콘텐츠 높이에 맞춤 */
  .app-shell,
  .stage,
  .step-shell {
    min-height: auto;
  }

  /* --- Right background panel ---
     answer1.md: 414px at 1920 → flex:1 1 0 (fills remaining) */
  .pc-right {
    display: block;
    flex: 1 1 0;
    min-width: 0;
    position: relative;
    z-index: 1;
  }

  /* --- Footer: sticky within .pc-center (not fixed viewport-wide) ---
     Center column is NOT at viewport center, so left:50% is wrong.
     Sticky keeps footer at bottom of .pc-center, naturally 572px wide. */
  .btnrow.app__footer {
    position: sticky;
    bottom: 0;
    left: auto;
    right: auto;
    transform: none;
    width: 100%;
  }

  /* Remove mobile footer-compensation padding on PC
     (sticky footer is in flow, no overlap) */
  .app__main {
    padding-bottom: 16px !important;
  }

} /* end @media (min-width: 1200px) */
