:root {
  --navy: #1b2a4a;
  --navy-2: #24365c;
  --ink: #1a1c24;
  --muted: #5c6478;
  --paper: #f4efe6;
  --card: #fffdf8;
  --line: #d9d1c3;
  --ochre: #c45c26;
  --ochre-2: #a3491c;
  --chrome-h: 56px;
  --page-gutter: 48px;
  --landing-bg:
    radial-gradient(1200px 500px at 10% -10%, rgba(196, 92, 38, 0.18), transparent 55%),
    linear-gradient(180deg, #15233f 0%, var(--navy) 42%, #121c33 100%);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: "Noto Sans KR", "Pretendard", sans-serif;
  color: var(--ink);
  background: var(--landing-bg);
  background-attachment: fixed;
}

[hidden] { display: none !important; }

body[data-view="landing"] { height: auto; min-height: 100%; background-attachment: scroll; background-color: var(--navy); }

#view-landing {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: visible;
  padding: 80px 20px;
  background: var(--landing-bg);
}

.landing-stack {
  width: fit-content;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.landing-mark {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: #f4efe6;
  margin-bottom: 14px;
}
.landing-brand {
  display: block;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 72px;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin-bottom: 32px;
  white-space: nowrap;
}
.landing-mark strong {
  font-size: 42px;
  letter-spacing: -0.045em;
  font-weight: 800;
  text-align: center;
  line-height: 1.25;
  white-space: nowrap;
}
.landing-lead {
  text-align: center;
  color: rgba(244, 239, 230, 0.82);
  font-size: 16px;
  line-height: 1.65;
  margin: 0 0 40px;
}

.mode-grid {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-auto-rows: auto;
  gap: 16px;
  overflow: visible;
}
.mode-card {
  appearance: none;
  position: relative;
  isolation: isolate;
  overflow: visible;
  border: 1px solid rgba(255, 253, 248, 0.18);
  background: var(--card);
  color: var(--ink);
  border-radius: 18px;
  padding: 28px 26px 32px;
  min-height: 248px;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.18);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.mode-card::before,
.mode-card::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  border: 2px solid rgba(255, 90, 31, 0.4);
  pointer-events: none;
  opacity: 0;
}
.mode-card:hover {
  transform: translateY(-2px);
  border-color: #ff5a1f;
  box-shadow:
    0 22px 46px rgba(0, 0, 0, 0.22),
    0 0 0 4px rgba(255, 90, 31, 0.14),
    0 16px 48px rgba(255, 90, 31, 0.22);
}
.mode-card:hover::before,
.mode-card:hover::after {
  animation: card-ring 1.05s ease-out;
}
.mode-card:hover::after {
  animation-delay: 0.2s;
}
@keyframes card-ring {
  0% { transform: scale(1); opacity: 0.5; }
  100% { transform: scale(1.07); opacity: 0; }
}
.mode-card:focus-visible {
  outline: 3px solid var(--ochre);
  outline-offset: 3px;
}
.mode-kicker {
  display: inline-block;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--ochre);
  margin-bottom: 10px;
}
.mode-card h2 {
  margin: 0 0 14px;
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -0.04em;
}
.mode-card p {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.65;
}
.mode-card.combo {
  background: #1f3156;
  color: #f7f1e8;
  border-color: rgba(255, 255, 255, 0.08);
}
.mode-card.combo p { color: rgba(247, 241, 232, 0.72); }
.mode-card.combo .mode-kicker { color: #e7a078; }

.landing-settings {
  width: 100%;
  margin-top: 28px;
  background: rgba(255, 253, 248, 0.06);
  border: 1px solid rgba(255, 253, 248, 0.1);
  border-radius: 14px;
  color: #f4efe6;
  padding: 8px 16px 12px;
}
.landing-settings summary {
  cursor: pointer;
  font-size: 13px;
  padding: 8px 0;
}
.landing-settings label {
  display: block;
  font-size: 12px;
  opacity: 0.8;
  margin: 10px 0 4px;
}
.landing-settings input,
.landing-settings select {
  width: 100%;
  border: 1px solid rgba(255, 253, 248, 0.16);
  background: rgba(0, 0, 0, 0.18);
  color: #fff;
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
}
.landing-settings select option {
  color: #111;
}
.landing-key-btn {
  display: block;
  width: 100%;
  margin-top: 12px;
  box-sizing: border-box;
  text-align: center;
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  background: #ff5a1f;
  border-radius: 12px;
  padding: 12px 16px;
}
.landing-key-btn:hover {
  background: #e04e18;
}
body[data-view="analyzer"],
body[data-view="maker"] {
  background: #f8f9ff;
}

#app-chrome {
  position: fixed;
  top: 0; left: 0; right: 0;
  min-height: 56px;
  z-index: 20;
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  grid-template-rows: 56px auto;
  align-items: center;
  gap: 0 12px;
  padding: 0 var(--page-gutter);
  background: var(--navy);
  color: #f4efe6;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.chrome-brand {
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-right: 8px;
}
.chrome-tabs {
  display: flex;
  gap: 6px;
}
.chrome-tabs button {
  border: 0;
  background: transparent;
  color: rgba(244, 239, 230, 0.72);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 999px;
  cursor: pointer;
}
.chrome-tabs button[aria-current="page"] {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}
.chrome-tabs button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
#blueprint-chip {
  grid-column: 1 / -1;
  grid-row: 2;
  min-width: 0;
  width: 100%;
  line-height: 1.4;
  padding: 14px 18px 12px;
  margin-bottom: 12px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  background: rgba(255, 255, 255, 0.045);
  border-radius: 14px;
}
.preparation-overview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 5px 16px;
  margin-bottom: 14px;
}
.preparation-overview > strong { font-size: 13px; color: #fff4ed; }
#blueprint-chip-text { font-size: 12px; color: #f9c7ae; overflow-wrap: anywhere; }
.preparation-path { position: relative; }
.preparation-track { position: absolute; left: 12.5%; right: 12.5%; top: 9px; height: 6px; border-radius: 6px; background: #42516c; overflow: hidden; }
#blueprint-fill { width: 0; height: 100%; border-radius: inherit; background: #ff7846; transition: width 650ms ease; }
.preparation-steps { position: relative; list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.preparation-steps li { display: flex; flex-direction: column; align-items: center; gap: 5px; min-width: 0; color: #adb8ca; text-align: center; }
.preparation-dot { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; border: 2px solid #5b6b84; background: #273856; font-size: 11px; font-weight: 800; }
.preparation-steps strong { font-size: 13px; font-weight: 600; }
.preparation-step-state { font-size: 10px; }
.preparation-steps [data-state="complete"] { color: #ffd9c6; }
.preparation-steps [data-state="complete"] .preparation-dot { background: #ff7846; border-color: #ff7846; color: #172440; }
.preparation-steps [data-state="current"] { color: #fff; }
.preparation-steps [data-state="current"] strong { color: #ffb88f; font-weight: 800; }
.preparation-steps [data-state="current"] .preparation-dot { border-color: #ff9c70; background: #ff7846; color: #172440; animation: preparation-pulse 1.8s ease-in-out infinite; }
.preparation-steps [data-state="attention"] { color: #ffd0b3; }
.preparation-steps [data-state="attention"] .preparation-dot { border-color: #ffb88f; color: #ffcfb0; }
@keyframes preparation-pulse { 50% { box-shadow: 0 0 0 6px rgba(255, 120, 70, 0.2); } }
@media (prefers-reduced-motion: reduce) {
  #blueprint-fill { transition: none; }
  .preparation-steps [data-state="current"] .preparation-dot { animation: none; }
}
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.chrome-right {
  grid-column: 3;
  grid-row: 1;
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}
#app-version { font-size: 11px; opacity: 0.55; }
#btn-home {
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 12px;
  border-radius: 999px;
  padding: 6px 10px;
  cursor: pointer;
}

/* display:none iframe은 가로가 0이라 기존 분석기 CSS·미디어쿼리가 깨진다.
   숨길 때도 화면 크기 그대로 두고 보이기만 끈다. */
.stage {
  position: fixed;
  top: var(--chrome-h);
  left: var(--page-gutter);
  right: var(--page-gutter);
  bottom: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 0;
  background: #f8f9ff;
}
.stage.is-active {
  visibility: visible;
  pointer-events: auto;
  z-index: 5;
}
body[data-view="landing"] .stage { top: 0; }
.stage iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

#work-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(16, 25, 44, 0.48);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
#work-overlay[hidden] { display: none !important; }
.work-overlay-card {
  width: min(420px, 100%);
  background: #fff;
  color: #111;
  border-radius: 20px;
  padding: 28px 24px 24px;
  text-align: center;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.22);
}
.work-spinner {
  width: 36px;
  height: 36px;
  margin: 0 auto 14px;
  border: 3px solid #f3e7e1;
  border-top-color: #ff5a1f;
  border-radius: 50%;
  animation: work-spin 0.8s linear infinite;
}
/* Keep the compact status indicator smaller than the blocking loading icon. */
.work-spinner.work-spinner-sm {
  flex: 0 0 14px;
  width: 14px;
  height: 14px;
  margin: 0;
  border-width: 2px;
}
@media (prefers-reduced-motion: reduce) {
  .work-spinner { animation: none; }
}
@keyframes work-spin { to { transform: rotate(360deg); } }
#work-overlay-title {
  margin: 0 0 6px;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.03em;
}
#work-overlay-status {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: #6b6b6b;
}

@media (max-width: 720px) {
  :root { --page-gutter: 24px; }
  .mode-grid { grid-template-columns: 1fr; }
  .landing-brand { font-size: 44px; white-space: normal; }
  .landing-mark strong { font-size: 28px; white-space: normal; }
  .mode-card { min-height: 200px; }
  .mode-kicker { font-size: 15px; }
  .mode-card h2 { font-size: 28px; }
  #view-landing { padding: 48px 16px; }
}

/* Keep the complete path visible on narrow screens; JS measures the wrapped header. */
@media (max-width: 900px) {
  #app-chrome {
    gap: 0 8px;
    padding: 0 16px;
  }
  .chrome-brand { grid-column: 1; grid-row: 1; margin-right: 0; font-size: 14px; }
  .chrome-tabs { grid-column: 2; grid-row: 1; gap: 2px; }
  .chrome-tabs button { padding: 7px 9px; }
  .chrome-right { grid-column: 3; grid-row: 1; justify-self: end; margin-left: 0; }
  #app-version { display: none; }
  #blueprint-chip { padding: 12px 10px; }
  .preparation-overview { flex-direction: column; align-items: flex-start; gap: 6px; }
  #blueprint-chip-text { font-size: 11px; }
  .preparation-steps strong { font-size: 11px; }
  .preparation-steps li { gap: 4px; }
}

/* 세 번째 카드(학교 틀)는 두 카드 아래 한 줄 전체를 쓴다. */
.mode-card.template { grid-column: 1 / -1; min-height: 0; }

/* 첫 화면 버전 표시 */
.landing-version { display: block; margin-top: 8px; font-size: 14px; font-weight: 500; letter-spacing: 0.04em; opacity: 0.55; }
