:root {
  --forest: #162a25;
  --forest-2: #214139;
  --ink: #19211e;
  --muted: #66736e;
  --cream: #f3f0e8;
  --paper: #fffdf8;
  --line: rgba(25, 33, 30, 0.14);
  --gold: #c9a56c;
  --gold-bright: #e5c58f;
  --shadow: 0 24px 70px rgba(13, 31, 26, 0.16);
  --radius-lg: clamp(24px, 2.2vw, 42px);
  --radius-md: clamp(16px, 1.3vw, 26px);
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--cream);
  color: var(--ink);
  font-family: "Pretendard", "Noto Sans KR", "Apple SD Gothic Neo", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  touch-action: manipulation;
}

button,
a { font: inherit; }

button {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

button:focus-visible,
a:focus-visible {
  outline: 4px solid var(--gold-bright);
  outline-offset: 4px;
}

#app { width: 100%; height: 100%; }

.screen {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 540px;
  overflow: hidden;
}

.ambient {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.ambient::before,
.ambient::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(2px);
}

.ambient::before {
  width: min(50vw, 980px);
  height: min(50vw, 980px);
  right: -15vw;
  top: -27vw;
  border: 1px solid rgba(201, 165, 108, 0.28);
  box-shadow: 0 0 0 6vw rgba(201, 165, 108, 0.035), 0 0 0 13vw rgba(201, 165, 108, 0.025);
}

.ambient::after {
  width: min(40vw, 760px);
  height: min(40vw, 760px);
  left: -24vw;
  bottom: -25vw;
  background: rgba(33, 65, 57, 0.08);
}

.home-screen {
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: clamp(26px, 4vw, 72px) clamp(30px, 5vw, 108px) clamp(22px, 3vw, 54px);
  background: linear-gradient(135deg, #f8f5ee 0%, #efeadf 100%);
}

.brand {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: clamp(12px, 1vw, 20px);
  width: max-content;
  color: var(--forest);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: clamp(50px, 3.9vw, 76px);
  aspect-ratio: 1;
  border: 1px solid rgba(22, 42, 37, 0.3);
  border-radius: 50%;
  font-family: Georgia, serif;
  font-size: clamp(15px, 1.25vw, 25px);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand-copy { display: grid; gap: 3px; }
.brand-name { font-weight: 750; font-size: clamp(18px, 1.35vw, 28px); letter-spacing: 0.08em; }
.brand-sub { color: var(--muted); font-size: clamp(11px, 0.8vw, 16px); letter-spacing: 0.19em; }

.home-content {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(320px, 0.7fr) minmax(600px, 1.3fr);
  align-items: center;
  gap: clamp(40px, 6vw, 120px);
  min-height: 0;
}

.intro { align-self: center; max-width: 720px; }
.eyebrow {
  margin: 0 0 clamp(14px, 1.4vw, 28px);
  color: #8d7044;
  font-size: clamp(13px, 0.9vw, 18px);
  font-weight: 800;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}

h1,
h2,
p { margin-top: 0; }

.intro h1 {
  margin-bottom: clamp(18px, 1.7vw, 34px);
  font-family: Georgia, "Noto Serif KR", serif;
  color: var(--forest);
  font-size: clamp(48px, 5.8vw, 112px);
  font-weight: 500;
  letter-spacing: -0.055em;
  line-height: 0.98;
}

.intro p:last-child {
  max-width: 560px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: clamp(17px, 1.25vw, 25px);
  line-height: 1.65;
}

.primary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(18px, 1.7vw, 34px);
  min-height: min(54vh, 620px);
}

.primary-card,
.option-card,
.language-card {
  position: relative;
  border: 0;
  cursor: pointer;
  text-align: left;
  overflow: hidden;
}

.primary-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 360px;
  padding: clamp(30px, 3vw, 60px);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.primary-card:hover,
.primary-card:active { transform: translateY(-6px); box-shadow: 0 32px 80px rgba(13, 31, 26, 0.22); }
.primary-card.company { background: var(--forest); color: white; }
.primary-card.product { background: #d8c4a0; color: var(--forest); }

.card-index {
  font-family: Georgia, serif;
  font-size: clamp(38px, 4vw, 78px);
  opacity: 0.32;
}

.card-title { display: grid; gap: 10px; }
.card-title strong { font-size: clamp(30px, 3vw, 58px); line-height: 1.1; }
.card-title span { font-size: clamp(14px, 1.05vw, 21px); opacity: 0.72; letter-spacing: 0.09em; }
.card-arrow {
  position: absolute;
  right: clamp(26px, 2vw, 44px);
  top: clamp(26px, 2vw, 44px);
  display: grid;
  place-items: center;
  width: clamp(52px, 4.2vw, 82px);
  aspect-ratio: 1;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: clamp(22px, 1.8vw, 35px);
  opacity: 0.72;
}

.home-footer {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  color: var(--muted);
  font-size: clamp(12px, 0.88vw, 17px);
}

.touch-hint { display: inline-flex; align-items: center; gap: 10px; }
.touch-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 6px rgba(201, 165, 108, 0.17); }

.selection-screen {
  display: grid;
  grid-template-rows: auto 1fr;
  padding: clamp(24px, 3vw, 58px) clamp(28px, 5vw, 104px) clamp(30px, 4vw, 72px);
  background: var(--forest);
  color: white;
}

.screen-header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
}

.screen-header .brand { color: white; }
.screen-header .brand-mark { border-color: rgba(255, 255, 255, 0.32); }
.screen-header .brand-sub { color: rgba(255, 255, 255, 0.6); }
.header-actions { display: flex; align-items: center; gap: 12px; }

.round-button,
.tool-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 54px;
  min-height: 54px;
  padding: 0 22px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  cursor: pointer;
  font-weight: 700;
  backdrop-filter: blur(12px);
  text-decoration: none;
}

.selection-content {
  position: relative;
  z-index: 1;
  display: grid;
  align-content: center;
  gap: clamp(32px, 4vw, 70px);
  min-height: 0;
}

.selection-heading { display: flex; justify-content: space-between; align-items: end; gap: 40px; }
.selection-heading h1 {
  margin-bottom: 0;
  font-family: Georgia, "Noto Serif KR", serif;
  font-size: clamp(48px, 5.3vw, 104px);
  font-weight: 500;
  letter-spacing: -0.05em;
  line-height: 1;
}
.selection-heading p { margin-bottom: 4px; color: rgba(255,255,255,.62); font-size: clamp(16px, 1.15vw, 23px); }

.option-grid,
.language-grid { display: grid; gap: clamp(18px, 1.7vw, 34px); }
.option-grid { grid-template-columns: 1fr 1fr; }
.language-grid { grid-template-columns: repeat(4, 1fr); }

.option-card,
.language-card {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  color: white;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.option-card {
  min-height: clamp(220px, 27vh, 380px);
  padding: clamp(28px, 3vw, 56px);
  background: rgba(255, 255, 255, 0.075);
}
.option-card:hover,
.option-card:active,
.language-card:hover,
.language-card:active { transform: translateY(-5px); background: rgba(255,255,255,.14); border-color: rgba(229,197,143,.7); }

.option-icon {
  display: grid;
  place-items: center;
  width: clamp(64px, 5.3vw, 102px);
  aspect-ratio: 1;
  margin-bottom: clamp(28px, 4vh, 50px);
  border-radius: 50%;
  background: rgba(229, 197, 143, 0.14);
  color: var(--gold-bright);
  font-size: clamp(30px, 2.7vw, 52px);
}
.option-card strong { display: block; margin-bottom: 12px; font-size: clamp(26px, 2.3vw, 44px); }
.option-card span { color: rgba(255,255,255,.62); font-size: clamp(14px, 1vw, 20px); }

.language-card {
  display: grid;
  align-content: space-between;
  min-height: clamp(220px, 31vh, 410px);
  padding: clamp(24px, 2.5vw, 48px);
  background: rgba(255,255,255,.065);
}
.language-code { color: var(--gold-bright); font-family: Georgia, serif; font-size: clamp(48px, 5vw, 96px); opacity: .82; }
.language-name { display: grid; gap: 6px; }
.language-name strong { font-size: clamp(23px, 1.9vw, 38px); }
.language-name span { color: rgba(255,255,255,.54); font-size: clamp(12px, .85vw, 17px); letter-spacing: .12em; }

.viewer-screen {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: #111815;
  color: white;
}

.viewer-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
  min-height: clamp(72px, 7.5vh, 108px);
  padding: 12px clamp(20px, 2.7vw, 52px);
  border-bottom: 1px solid rgba(255,255,255,.09);
  background: #15201c;
}

.viewer-header-left,
.viewer-header-right { display: flex; align-items: center; gap: 12px; }
.viewer-header-right { justify-content: flex-end; }
.viewer-title { text-align: center; }
.viewer-title strong { display: block; font-size: clamp(16px, 1.25vw, 25px); }
.viewer-title span { display: block; margin-top: 3px; color: rgba(255,255,255,.54); font-size: clamp(11px, .75vw, 15px); letter-spacing: .09em; }

.viewer-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 35%, rgba(51, 78, 68, .55), transparent 55%),
    #111815;
}

.viewer-stage.is-fullscreen { width: 100vw; height: 100vh; background: #0a0e0c; }
.viewer-screen:fullscreen,
.viewer-screen:-webkit-full-screen { width: 100vw; height: 100vh; }

.video-wrap {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  padding: clamp(12px, 2vw, 36px);
}

.video-wrap video {
  width: 100%;
  height: 100%;
  max-width: 1920px;
  object-fit: contain;
  background: black;
  box-shadow: 0 22px 80px rgba(0,0,0,.44);
}

.video-fullscreen {
  position: absolute;
  right: clamp(28px, 3vw, 58px);
  top: clamp(28px, 3vw, 58px);
  z-index: 3;
  min-width: 134px;
  background: rgba(10, 14, 12, .78);
}

.pdf-stage { padding: clamp(14px, 2vh, 30px) clamp(24px, 3vw, 64px); }
.pages {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(6px, .65vw, 14px);
  width: 100%;
  height: 100%;
}

.page-shell {
  position: relative;
  display: grid;
  place-items: center;
  max-width: 100%;
  max-height: 100%;
  background: white;
  box-shadow: 0 18px 50px rgba(0,0,0,.38);
  overflow: hidden;
}

.page-shell canvas { display: block; max-width: 100%; max-height: 100%; background: white; }
.image-shell { width: 100%; height: 100%; min-width: 0; min-height: 0; background: transparent; box-shadow: none; }
.pdf-page-image { display: block; width: auto; height: auto; max-width: 100%; max-height: 100%; object-fit: contain; }
.compat-page-frame { position: absolute; top: 0; right: 0; bottom: 0; left: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; padding: 10px; }
.compat-page-frame .pdf-page-image { flex: none; }
.compat-page-frame.portrait-document .pdf-page-image { width: auto; height: 100%; max-width: 100%; }
.compat-page-frame.landscape-document .pdf-page-image { width: 100%; height: auto; max-height: 100%; }
.spread .page-shell:first-child { border-radius: 5px 0 0 5px; box-shadow: -10px 18px 50px rgba(0,0,0,.38); }
.spread .page-shell:last-child { border-radius: 0 5px 5px 0; box-shadow: 10px 18px 50px rgba(0,0,0,.38); }
.spread .page-shell:first-child::after,
.spread .page-shell:last-child::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 4%;
  pointer-events: none;
}
.spread .page-shell:first-child::after { right: 0; background: linear-gradient(to left, rgba(0,0,0,.16), transparent); }
.spread .page-shell:last-child::after { left: 0; background: linear-gradient(to right, rgba(0,0,0,.16), transparent); }

.loading-panel,
.error-panel {
  display: grid;
  justify-items: center;
  gap: 18px;
  padding: 42px;
  text-align: center;
}
.spinner { width: 54px; height: 54px; border: 4px solid rgba(255,255,255,.16); border-top-color: var(--gold-bright); border-radius: 50%; animation: spin 900ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-panel strong,
.error-panel strong { font-size: clamp(19px, 1.35vw, 27px); }
.loading-panel span,
.error-panel span { max-width: 620px; color: rgba(255,255,255,.55); line-height: 1.6; }
.error-actions { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 12px; }

.viewer-toolbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 18px;
  min-height: clamp(76px, 8vh, 112px);
  padding: 12px clamp(20px, 3vw, 56px);
  border-top: 1px solid rgba(255,255,255,.09);
  background: #15201c;
}
.toolbar-side { display: flex; align-items: center; gap: 12px; }
.toolbar-side:last-child { justify-content: flex-end; }
.page-count { min-width: 170px; text-align: center; color: rgba(255,255,255,.76); font-size: clamp(15px, 1.1vw, 22px); font-variant-numeric: tabular-nums; }
.tool-button { min-width: clamp(112px, 8.5vw, 168px); min-height: clamp(52px, 5vh, 68px); background: rgba(255,255,255,.08); }
.tool-button.primary { background: var(--gold); color: #15201c; border-color: var(--gold); }
.tool-button:disabled { opacity: .3; cursor: default; }
.keyboard-hint { color: rgba(255,255,255,.42); font-size: clamp(11px, .75vw, 15px); }

@media (max-width: 1050px), (max-aspect-ratio: 4/3) {
  .home-content { grid-template-columns: 1fr; align-content: center; gap: 32px; }
  .intro h1 { font-size: clamp(44px, 8vw, 76px); }
  .intro p:last-child { display: none; }
  .primary-grid { min-height: 320px; }
  .selection-heading { align-items: start; flex-direction: column; gap: 14px; }
  .language-grid { grid-template-columns: 1fr 1fr; }
  .language-card { min-height: 180px; }
  .keyboard-hint { display: none; }
}

@media (max-width: 720px) {
  .screen { min-height: 100%; }
  .home-screen { overflow: auto; padding: 20px 22px 16px; }
  .brand { gap: 10px; }
  .brand-mark { width: 46px; font-size: 14px; }
  .brand-name { font-size: 17px; }
  .brand-sub { font-size: 10px; letter-spacing: .1em; }
  .home-content { padding: 28px 0 18px; gap: 24px; }
  .intro h1 { margin-bottom: 0; font-size: 44px; line-height: 1; }
  .intro .eyebrow { margin-bottom: 16px; font-size: 11px; }
  .primary-grid,
  .option-grid { grid-template-columns: 1fr; }
  .primary-grid { gap: 16px; min-height: auto; }
  .primary-card { min-height: 230px; padding: 28px; border-radius: 24px; }
  .card-index { font-size: 42px; }
  .card-arrow { width: 52px; right: 24px; top: 24px; }
  .card-title strong { font-size: 29px; }
  .card-title span { font-size: 12px; }
  .home-footer { font-size: 10px; }
  .home-footer > span:first-child { display: none; }
  .home-footer { justify-content: flex-end; }
  .selection-screen { overflow: auto; padding: 20px 22px 28px; }
  .selection-screen .screen-header .brand-sub { display: none; }
  .header-actions { gap: 7px; }
  .selection-content { align-content: start; padding: 30px 0 12px; gap: 26px; }
  .selection-heading { gap: 10px; }
  .selection-heading h1 { font-size: 38px; line-height: 1.08; letter-spacing: -.045em; }
  .selection-heading p { margin-bottom: 0; font-size: 14px; }
  .selection-heading .eyebrow { margin-bottom: 10px; font-size: 11px; }
  .option-grid { gap: 14px; }
  .option-card { min-height: 188px; padding: 28px; }
  .option-icon { width: 58px; margin-bottom: 22px; font-size: 26px; }
  .option-card strong { margin-bottom: 8px; font-size: 25px; }
  .option-card span { font-size: 12px; }
  .language-grid { grid-template-columns: 1fr 1fr; }
  .language-grid { gap: 12px; }
  .language-card { min-height: 142px; padding: 20px; }
  .language-code { font-size: 45px; }
  .language-name strong { font-size: 21px; }
  .language-name span { font-size: 10px; }
  .viewer-header { grid-template-columns: 46px minmax(0, 1fr) auto; gap: 8px; min-height: 66px; padding: 8px 12px; }
  .viewer-header-left,
  .viewer-header-right { gap: 6px; }
  .viewer-title { min-width: 0; text-align: center; }
  .viewer-title strong { overflow: hidden; font-size: 15px; white-space: nowrap; text-overflow: ellipsis; }
  .viewer-title span { display: none; }
  .round-button .button-label { display: none; }
  .round-button { width: 46px; min-width: 46px; min-height: 46px; padding: 0; }
  .viewer-toolbar { grid-template-columns: 1fr auto 1fr; min-height: 64px; padding: 8px 10px; gap: 8px; }
  .tool-button { min-width: 46px; width: 46px; min-height: 46px; padding: 0; }
  .tool-button .button-label { display: none; }
  .page-count { min-width: 82px; font-size: 14px; }
  .pdf-stage { padding-left: 8px; padding-right: 8px; }
  .loading-panel,
  .error-panel { gap: 14px; padding: 24px; }
  .loading-panel strong,
  .error-panel strong { font-size: 18px; }
  .loading-panel span,
  .error-panel span { font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
