/* =============================================
   DRE/DDRA 온보딩 가이드 — 전체 스타일
   모바일 퍼스트 + 동그라미 포인터
   ============================================= */

/* ── 변수 ── */
:root {
  --bg: #07101f;
  --panel: rgba(18,28,48,.82);
  --line: rgba(144,170,217,.18);
  --text: #f4f7ff;
  --muted: #8a9abf;
  --blue: #2f74ff;
  --cyan: #17d5e6;
  --purple: #8d53ff;
  --pink: #ff4b86;
  --green: #19d18f;
  --yellow: #ffd166;
  --shadow: 0 20px 60px rgba(0,0,0,.45);
  --r-xl: 24px;
  --r-lg: 18px;
  --r-md: 12px;
  color-scheme: dark;
}

/* ── 리셋 ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: Pretendard, "Apple SD Gothic Neo", system-ui, -apple-system, sans-serif;
  background:
    radial-gradient(circle at 10% 8%, rgba(47,116,255,.22), transparent 26rem),
    radial-gradient(circle at 88% 4%, rgba(141,83,255,.2), transparent 22rem),
    linear-gradient(180deg, #060b16 0%, var(--bg) 50%, #030711 100%);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}
button, input, select { font: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

/* ── 스킵 링크 ── */
.skip-link {
  position: absolute; left: 1rem; top: -6rem; z-index: 100;
  padding: .7rem 1.2rem; border-radius: 99px;
  background: var(--blue); color: #fff; font-weight: 700;
  transition: top .2s;
}
.skip-link:focus { top: 1rem; }

/* ── 래퍼 ── */
.site-header, main, .site-footer {
  width: min(1200px, 100%);
  padding-left: clamp(12px, 4vw, 24px);
  padding-right: clamp(12px, 4vw, 24px);
  margin: 0 auto;
}

/* =============================================
   TOP BAR
   ============================================= */
.topbar {
  position: sticky; top: 10px; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: .6rem;
  margin-top: 10px;
  padding: .6rem .8rem;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: rgba(6,11,22,.88);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: .7rem; flex-shrink: 0; }
.brand-mark {
  display: grid; place-items: center;
  width: 40px; height: 40px; border-radius: 12px;
  background: linear-gradient(135deg, var(--cyan), var(--blue) 55%, var(--purple));
  font-weight: 900; font-size: .95rem; letter-spacing: -.08em;
  box-shadow: 0 0 22px rgba(23,213,230,.3);
  color: #fff;
}
.brand strong { display: block; font-size: .9rem; line-height: 1.2; }
.brand small { display: block; color: var(--muted); font-size: .65rem; margin-top: .1rem; }
.topbar-actions { display: flex; gap: .4rem; }
.ghost-button {
  display: flex; align-items: center; gap: .4rem;
  padding: .5rem .75rem; border: 1px solid var(--line); border-radius: 99px;
  background: rgba(255,255,255,.05); color: var(--muted);
  font-size: .8rem; font-weight: 700;
  transition: border-color .2s, color .2s, background .2s;
  white-space: nowrap;
}
.ghost-button:hover, .ghost-button:focus-visible {
  border-color: var(--cyan); color: var(--cyan); background: rgba(23,213,230,.08);
}
/* TTS 켜짐 상태 */
.ghost-button.tts-on {
  border-color: var(--green);
  color: var(--green);
  background: rgba(25,209,143,.12);
  box-shadow: 0 0 12px rgba(25,209,143,.2);
}
.ghost-button.tts-on:hover {
  border-color: var(--green); color: var(--green); background: rgba(25,209,143,.18);
}
/* 모바일: 텍스트 숨김, 아이콘만 */
@media (max-width: 480px) {
  .ghost-btn-text { display: none; }
  .ghost-button { padding: .5rem .6rem; }
  .brand small { display: none; }
}

/* =============================================
   HERO
   ============================================= */
.hero {
  display: grid; gap: 1rem;
  padding: clamp(2.5rem,6vw,5.5rem) 0 clamp(1.5rem,4vw,3rem);
}
.eyebrow {
  color: var(--cyan); font-weight: 800;
  font-size: clamp(.75rem,2vw,.85rem); letter-spacing: .06em; text-transform: uppercase;
}
.hero h1 {
  font-size: clamp(1.9rem,6.5vw,5rem);
  line-height: 1; letter-spacing: -.06em; max-width: 820px;
}
.hero h1 span {
  background: linear-gradient(90deg, var(--cyan), var(--blue) 50%, var(--purple));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-copy {
  color: #b8c8e4; font-size: clamp(.9rem,1.8vw,1.1rem); line-height: 1.75;
  max-width: 720px;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: .6rem; }
.primary-link {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .8rem 1.4rem; border-radius: 99px;
  background: linear-gradient(135deg, var(--blue), var(--purple));
  color: #fff; font-weight: 800; font-size: .95rem;
  box-shadow: 0 12px 32px rgba(47,116,255,.3);
  transition: transform .2s, box-shadow .2s;
}
.primary-link:hover { transform: translateY(-2px); box-shadow: 0 18px 40px rgba(47,116,255,.4); }
.secondary-link {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .8rem 1.4rem; border-radius: 99px;
  border: 1px solid var(--line); background: rgba(255,255,255,.06);
  color: var(--text); font-weight: 800; font-size: .95rem;
  transition: border-color .2s, background .2s;
}
.secondary-link:hover { border-color: rgba(47,116,255,.7); background: rgba(47,116,255,.1); }
.secondary-link.active {
  background: rgba(25,209,143,.15); border-color: rgba(25,209,143,.6); color: #adffde;
}

/* =============================================
   JOURNEY SUMMARY
   ============================================= */
.journey-summary {
  margin: 1rem 0;
  padding: clamp(.9rem,2.5vw,1.4rem);
  border: 1px solid var(--line); border-radius: var(--r-xl);
  background: rgba(10,17,31,.75); box-shadow: var(--shadow);
}
.section-heading { margin-bottom: 1rem; }
.section-heading h2 {
  font-size: clamp(1.3rem,3vw,2rem); letter-spacing: -.04em;
  margin-top: .25rem;
}
.section-heading p:not(.eyebrow) { color: var(--muted); line-height: 1.7; margin-top: .4rem; }
.section-heading.compact h2 { font-size: 1.1rem; }

/* 가로 스크롤 가능한 흐름 리스트 */
.flow-list {
  list-style: none;
  display: flex; gap: .6rem;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  padding-bottom: .4rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.1) transparent;
}
.flow-list::-webkit-scrollbar { height: 4px; }
.flow-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 99px; }
.flow-list li {
  flex: 0 0 auto; min-width: 120px; max-width: 148px;
  padding: .9rem .8rem;
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: linear-gradient(160deg, rgba(255,255,255,.07), rgba(255,255,255,.02));
  font-weight: 700; font-size: .82rem; line-height: 1.35; color: #c8d8f0;
  transition: border-color .25s, background .25s;
}
.flow-list span { display: block; color: var(--cyan); font-size: .72rem; font-weight: 800; margin-bottom: .35rem; }
.flow-list li.active {
  border-color: rgba(23,213,230,.65);
  background: rgba(23,213,230,.12);
  color: #e8f8ff;
}

/* =============================================
   TUTORIAL LAYOUT  (2-col → 1-col mobile)
   ============================================= */
.tutorial-layout {
  display: grid;
  grid-template-columns: 300px minmax(0,1fr);
  grid-template-rows: auto;
  gap: 1rem;
  margin: 1rem 0;
  padding: clamp(.9rem,2.5vw,1.4rem);
  border: 1px solid var(--line); border-radius: var(--r-xl);
  background: rgba(8,14,28,.72); box-shadow: var(--shadow);
  align-items: start;
}

/* ── STEP PANEL (좌) ── */
.step-panel {
  position: sticky; top: 78px;
  max-height: calc(100vh - 90px); overflow-y: auto;
  padding: .9rem;
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: rgba(10,18,34,.82);
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.08) transparent;
}
.step-panel::-webkit-scrollbar { width: 4px; }
.step-panel::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 99px; }

.progress-card {
  padding: .8rem; border-radius: var(--r-md);
  background: rgba(255,255,255,.05); border: 1px solid var(--line);
  margin-bottom: .8rem;
}
.progress-meta { display: flex; justify-content: space-between; align-items: center; }
.progress-meta span { color: var(--muted); font-size: .8rem; }
.progress-meta strong { color: var(--cyan); font-size: .95rem; }
.progress-track {
  height: 7px; margin-top: .55rem; border-radius: 99px;
  background: rgba(255,255,255,.08); overflow: hidden;
}
.progress-track span {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--cyan), var(--purple));
  border-radius: inherit; transition: width .4s cubic-bezier(.4,0,.2,1);
}

.step-list { display: grid; gap: .4rem; }
.step-item {
  width: 100%; text-align: left; padding: .7rem .8rem;
  border: 1px solid var(--line); border-radius: 12px;
  background: rgba(255,255,255,.035); color: var(--muted);
  font-size: .8rem; transition: border-color .2s, background .2s;
}
.step-item strong { display: block; color: var(--text); font-size: .82rem; margin-bottom: .15rem; }
.step-item small { line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.step-item.active {
  border-color: rgba(47,116,255,.9);
  background: linear-gradient(135deg, rgba(47,116,255,.2), rgba(141,83,255,.14));
  box-shadow: 0 0 20px rgba(47,116,255,.16);
  color: var(--text);
}
.step-item:hover:not(.active) { border-color: rgba(47,116,255,.4); background: rgba(47,116,255,.07); }

/* ── PHONE WORKSPACE (우) ── */
.phone-workspace {
  min-width: 0;
  padding: .9rem;
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: rgba(5,10,22,.72);
  display: flex; flex-direction: column; gap: .8rem;
}
.phone-toolbar {
  display: flex; align-items: flex-start; justify-content: space-between; gap: .8rem;
}
.screen-kicker { color: var(--cyan); font-weight: 800; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; margin-bottom: .2rem; }
.phone-toolbar h3 { font-size: clamp(1.1rem,2.5vw,1.6rem); letter-spacing: -.04em; line-height: 1.2; }
.badge {
  flex-shrink: 0;
  padding: .35rem .7rem; border-radius: 99px;
  background: rgba(141,83,255,.2); color: #d8c9ff;
  font-weight: 800; font-size: .75rem;
  border: 1px solid rgba(141,83,255,.4);
  white-space: nowrap;
}

/* ── 폰 프레임 ── */
.phone-frame {
  position: relative;
  width: min(400px, 100%);
  margin: 0 auto;
  border-radius: 28px;
  background: #050a14;
  box-shadow:
    0 0 0 1px rgba(255,255,255,.08),
    0 28px 70px rgba(0,0,0,.55);
  overflow: hidden;
}
.phone-frame img {
  width: 100%; height: auto;
  min-height: 520px; object-fit: cover; object-position: top;
  display: block;
  transition: opacity .25s;
}
.phone-frame img.loading { opacity: .4; }

/* ── 동그라미 포인터 ── */
.target-ring {
  --x: 50%; --y: 30%;
  position: absolute;
  left: var(--x); top: var(--y);
  width: 68px; height: 68px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 5;
  /* 이중 링 구조 */
  border: 3px solid var(--yellow);
  box-shadow:
    0 0 0 0 rgba(255,209,102,.5),
    0 0 24px rgba(255,209,102,.6);
  animation: ringPulse 1.4s infinite ease-in-out;
  transition: left .45s cubic-bezier(.4,0,.2,1), top .45s cubic-bezier(.4,0,.2,1);
}
.ring-inner {
  position: absolute; inset: 8px;
  border-radius: 50%;
  border: 2px solid rgba(255,209,102,.55);
  animation: ringInner 1.4s infinite ease-in-out reverse;
}
@keyframes ringPulse {
  0%,100% { transform: translate(-50%,-50%) scale(.88); opacity: .8; box-shadow: 0 0 0 0 rgba(255,209,102,.4), 0 0 22px rgba(255,209,102,.5); }
  50%      { transform: translate(-50%,-50%) scale(1.1);  opacity: 1; box-shadow: 0 0 0 10px rgba(255,209,102,.0), 0 0 34px rgba(255,209,102,.75); }
}
@keyframes ringInner {
  0%,100% { transform: scale(1); opacity: .6; }
  50%      { transform: scale(1.1); opacity: 1; }
}

/* ── 말풍선 카드 ── */
.callout-card {
  position: absolute;
  left: 4%; right: 4%;
  /* 기본: 하단 고정 */
  bottom: 14px;
  top: auto;
  padding: .9rem;
  border: 1px solid rgba(23,213,230,.28);
  border-radius: 18px;
  background: rgba(3,8,18,.9);
  backdrop-filter: blur(16px);
  box-shadow: 0 14px 40px rgba(0,0,0,.5);
  z-index: 6;
  /* 위치 전환 트랜지션 */
  transition:
    bottom .38s cubic-bezier(.4,0,.2,1),
    top    .38s cubic-bezier(.4,0,.2,1),
    opacity .22s ease;
}
/* 동그라미가 하단(y >= 68%)일 때 — JS가 이 클래스를 토글 */
.callout-card.callout-top {
  bottom: auto;
  top: 14px;
}
.callout-label { color: var(--yellow); font-weight: 900; font-size: .72rem; letter-spacing: .05em; }
.callout-card strong { display: block; font-size: 1rem; margin: .22rem 0 .3rem; }
.callout-card p { color: #ccd8ef; line-height: 1.55; font-size: .88rem; }
.callout-card ul {
  margin-top: .55rem; padding-left: 1rem;
  color: #ffe99a; font-size: .82rem; line-height: 1.5;
}

/* ── 컨트롤 바 ── */
.control-bar {
  display: flex; gap: .55rem; justify-content: center;
}
.control-button {
  flex: 1; max-width: 200px;
  display: flex; align-items: center; justify-content: center; gap: .45rem;
  padding: .8rem 1rem; border-radius: 14px;
  border: 1px solid var(--line); background: rgba(255,255,255,.055);
  color: var(--text); font-weight: 800; font-size: .9rem;
  transition: transform .15s, border-color .2s, background .2s;
}
.control-button:hover   { transform: translateY(-1px); border-color: rgba(47,116,255,.7); background: rgba(47,116,255,.1); }
.control-button:active  { transform: scale(.97); }
.control-button.primary {
  border: 0;
  background: linear-gradient(135deg, var(--blue), var(--purple));
  box-shadow: 0 10px 28px rgba(47,116,255,.3);
}
.control-button.primary:hover { box-shadow: 0 14px 36px rgba(47,116,255,.42); }
.control-button.primary.restart {
  background: linear-gradient(135deg, var(--green), var(--cyan));
  box-shadow: 0 10px 28px rgba(25,209,143,.3);
}
.control-button.primary.restart:hover { box-shadow: 0 14px 36px rgba(25,209,143,.42); }
.control-button:disabled { opacity: .35; pointer-events: none; }

/* =============================================
   ANALYSIS SECTION
   ============================================= */
.analysis-section {
  margin: 1rem 0;
  padding: clamp(.9rem,2.5vw,1.4rem);
  border: 1px solid var(--line); border-radius: var(--r-xl);
  background: rgba(8,14,28,.72); box-shadow: var(--shadow);
}
.analysis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: .9rem;
}
.analysis-card {
  border: 1px solid var(--line); border-radius: var(--r-lg);
  overflow: hidden; background: rgba(255,255,255,.04);
}
.analysis-card img { width: 100%; height: 220px; object-fit: cover; object-position: top; }
.analysis-card div { padding: .9rem; }
.analysis-card h3 { font-size: 1rem; margin-bottom: .35rem; }
.analysis-card p { color: var(--muted); font-size: .85rem; line-height: 1.6; }
.analysis-card ul { margin-top: .55rem; padding-left: 1rem; color: #d5e2f8; font-size: .82rem; line-height: 1.5; }

/* =============================================
   FOOTER
   ============================================= */
.site-footer {
  color: var(--muted); text-align: center;
  padding: 1.8rem 0 2.8rem; font-size: .82rem; line-height: 1.7;
}

/* =============================================
   분기 선택 UI
   ============================================= */
.branch-picker {
  margin-bottom: .8rem;
  padding: .85rem;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: rgba(255,255,255,.04);
}
.branch-label {
  color: var(--cyan); font-weight: 800; font-size: .78rem;
  letter-spacing: .04em; margin-bottom: .6rem;
  display: flex; align-items: center; gap: .4rem;
}
.branch-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.branch-btn {
  display: flex; flex-direction: column; align-items: flex-start; gap: .18rem;
  padding: .7rem .75rem;
  border: 1.5px solid var(--line); border-radius: var(--r-md);
  background: rgba(255,255,255,.04); color: var(--muted);
  text-align: left; transition: border-color .2s, background .2s, color .2s;
}
.branch-btn i { font-size: 1rem; margin-bottom: .1rem; }
.branch-btn strong { display: block; font-size: .78rem; color: var(--text); line-height: 1.3; }
.branch-btn small { font-size: .7rem; line-height: 1.35; color: var(--muted); }
.branch-btn:hover { border-color: rgba(47,116,255,.6); background: rgba(47,116,255,.08); }
.branch-btn.active.active {
  border-color: var(--cyan);
  background: rgba(23,213,230,.12);
  color: #e0f9ff;
  box-shadow: 0 0 14px rgba(23,213,230,.18);
}
.branch-btn.active strong { color: var(--cyan); }
#branch-manual.active {
  border-color: var(--yellow);
  background: rgba(255,209,102,.1);
  box-shadow: 0 0 14px rgba(255,209,102,.15);
}
#branch-manual.active strong { color: var(--yellow); }

/* step-item 분기 색상 */
.step-item--wallet  { border-left: 3px solid rgba(23,213,230,.5); }
.step-item--manual  { border-left: 3px solid rgba(255,209,102,.5); }

/* method-tag (폰 화면 상단) */
.method-tag {
  display: inline-flex; align-items: center;
  padding: .28rem .6rem; border-radius: 99px;
  font-size: .72rem; font-weight: 800; white-space: nowrap;
}
.method-tag--wallet {
  background: rgba(23,213,230,.15); color: var(--cyan);
  border: 1px solid rgba(23,213,230,.35);
}
.method-tag--manual {
  background: rgba(255,209,102,.15); color: var(--yellow);
  border: 1px solid rgba(255,209,102,.35);
}

/* flow-list 분기 아이템 */
.flow-list li.flow-branch { border-color: rgba(255,209,102,.35); background: rgba(255,209,102,.07); }
.flow-list li.flow-branch em { display: block; font-style: normal; font-size: .68rem; color: var(--yellow); margin-top: .2rem; }
.flow-list li.flow-branch.active { border-color: var(--yellow); background: rgba(255,209,102,.18); }

/* =============================================
   집중 모드
   ============================================= */
body.compact-mode .hero,
body.compact-mode .journey-summary,
body.compact-mode .site-footer { display: none; }
body.compact-mode .tutorial-layout { margin-top: .6rem; }

/* =============================================
   반응형 — 태블릿 이하 (<= 860px)
   ============================================= */
@media (max-width: 860px) {
  .tutorial-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
  }
  .step-panel {
    position: static;
    max-height: 240px;
    order: 2; /* 폰 화면 아래로 */
  }
  .phone-workspace { order: 1; }
}

/* =============================================
   반응형 — 모바일 (<= 540px)
   ============================================= */
@media (max-width: 540px) {
  /* 사이트 전체 패딩 */
  .site-header, main, .site-footer {
    padding-left: 10px; padding-right: 10px;
  }

  /* 히어로 */
  .hero { padding-top: 2rem; padding-bottom: 1.2rem; }

  /* 탑바 아이콘만 */
  .ghost-button i { pointer-events: none; }

  /* 조직 흐름 */
  .journey-summary { padding: .75rem; }
  .flow-list li { min-width: 100px; font-size: .78rem; }

  /* 튜토리얼 */
  .tutorial-layout { padding: .65rem; gap: .7rem; }
  .phone-workspace { padding: .65rem; }

  /* 폰 프레임 */
  .phone-frame { border-radius: 20px; }
  .phone-frame img { min-height: 460px; }

  /* 말풍선 */
  .callout-card { left: 2.5%; right: 2.5%; bottom: 8px; padding: .75rem; }
  .callout-card strong { font-size: .92rem; }
  .callout-card p { font-size: .82rem; }

  /* 동그라미 크기 */
  .target-ring { width: 54px; height: 54px; }

  /* 컨트롤 바 — 항상 화면 하단에 고정 */
  .control-bar {
    position: sticky; bottom: 8px; z-index: 20;
    background: rgba(5,10,20,.85); backdrop-filter: blur(12px);
    padding: .6rem; border-radius: 16px;
    border: 1px solid var(--line);
    margin: 0 -0.1rem;
  }
  .control-button { max-width: none; padding: .75rem .6rem; font-size: .85rem; }

  /* 뱃지 숨김 */
  .badge { display: none; }

  /* 진행도 카드 */
  .progress-card { padding: .65rem; margin-bottom: .6rem; }

  /* 단계 리스트 높이 줄임 */
  .step-panel { max-height: 200px; padding: .65rem; }
  .step-item { padding: .55rem .65rem; }
  .step-item strong { font-size: .78rem; }

  /* 섹션 패딩 */
  .journey-summary,
  .tutorial-layout,
  .analysis-section { border-radius: 18px; }

  /* 분석 그리드 단열 */
  .analysis-grid { grid-template-columns: 1fr; }
}
