:root {
  color-scheme: light;
  --forest: #183d32;
  --forest-deep: #102d25;
  --cream: #f5f2e9;
  --paper: #fffefa;
  --ink: #17231f;
  --muted: #68746e;
  --line: #d8ddd5;
  --orange: #bc6b3b;
  --focus: #d98a54;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body.is-unlocked { overflow: hidden; }

html, body { min-height: 100%; margin: 0; }

body {
  background: var(--cream);
  color: var(--ink);
}

button, input { font: inherit; }

button:focus-visible, a:focus-visible, input:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.gate-shell {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 42px 24px 22px;
  background:
    radial-gradient(ellipse at 50% 39%, rgba(255, 254, 250, .88) 0, rgba(255, 254, 250, 0) 58%),
    var(--cream);
}

.gate-card {
  width: min(100%, 432px);
  padding: 38px 42px 30px;
  border: 1px solid rgba(24, 61, 50, .10);
  border-radius: 14px;
  background: var(--paper);
  box-shadow: 0 22px 60px rgba(33, 47, 40, .08), 0 2px 7px rgba(33, 47, 40, .04);
}

.wordmark, .toolbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--forest);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: -.02em;
  line-height: 1.12;
  text-decoration: none;
}

.wordmark-mark, .toolbar-mark {
  display: grid;
  width: 33px;
  height: 33px;
  flex: none;
  place-items: center;
  border-radius: 8px;
  background: var(--forest);
  color: #fffefa;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 19px;
  font-weight: 400;
  font-style: italic;
}

.gate-copy { margin-top: 43px; }

.eyebrow {
  margin: 0 0 11px;
  color: var(--orange);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: .13em;
  line-height: 1.4;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  color: var(--forest-deep);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(32px, 8vw, 39px);
  font-weight: 400;
  letter-spacing: -.045em;
  line-height: 1.08;
}

.intro {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

.unlock-form { margin-top: 30px; }

.unlock-form label {
  display: block;
  margin-bottom: 9px;
  color: #263b32;
  font-size: 12px;
  font-weight: 650;
}

.password-wrap { position: relative; }

.password-wrap input {
  display: block;
  width: 100%;
  height: 50px;
  padding: 0 92px 0 14px;
  border: 1px solid #cbd3cc;
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 16px;
  letter-spacing: .025em;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.password-wrap input:hover { border-color: #9eafa4; }
.password-wrap input:focus { border-color: var(--forest); box-shadow: 0 0 0 3px rgba(24, 61, 50, .11); outline: 0; }

.visibility-toggle {
  position: absolute;
  top: 50%;
  right: 7px;
  min-width: 67px;
  min-height: 36px;
  padding: 0 9px;
  transform: translateY(-50%);
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--forest);
  cursor: pointer;
  font-size: 11px;
  font-weight: 650;
}

.visibility-toggle:hover { background: #eff2ed; }

.field-hint {
  margin: 8px 0 0;
  color: #7c8780;
  font-size: 11px;
  line-height: 1.4;
}

.unlock-button {
  display: flex;
  width: 100%;
  min-height: 50px;
  align-items: center;
  justify-content: center;
  margin-top: 22px;
  border: 1px solid var(--forest);
  border-radius: 7px;
  background: var(--forest);
  color: white;
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: .01em;
  transition: background .15s ease, transform .15s ease, box-shadow .15s ease;
}

.unlock-button:hover { background: var(--forest-deep); box-shadow: 0 5px 13px rgba(24, 61, 50, .15); }
.unlock-button:active { transform: translateY(1px); }
.unlock-button:disabled { cursor: wait; opacity: .75; }

.status {
  min-height: 18px;
  margin: 10px 0 0;
  color: #a34932;
  font-size: 12px;
  line-height: 1.5;
}

.no-script {
  margin: 5px 0 0;
  padding: 10px 12px;
  border-left: 2px solid var(--orange);
  background: #f8f1e9;
  color: #675348;
  font-size: 12px;
  line-height: 1.5;
}

.privacy-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 17px 0 0;
  color: #78837c;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
  letter-spacing: .025em;
}

.privacy-dot { width: 6px; height: 6px; border-radius: 50%; background: #6d967f; }

.gate-footer {
  margin-top: 23px;
  color: #929b94;
  font-size: 10px;
  letter-spacing: .025em;
}

.gate-footer span { margin: 0 5px; color: var(--orange); }

.workspace[hidden] { display: none !important; }

.workspace {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #f8f7f3;
}

.toolbar {
  position: relative;
  z-index: 2;
  display: flex;
  height: 52px;
  min-height: 52px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 18px;
  border-bottom: 1px solid #e4e6e1;
  background: #fffefa;
}

.toolbar-brand { gap: 8px; font-size: 11px; }
.toolbar-mark { width: 27px; height: 27px; border-radius: 6px; font-size: 16px; }
.toolbar-actions { display: flex; align-items: center; gap: 7px; }

.download-action, .lock-action {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  padding: 0 11px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--forest);
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.download-action { border-color: #d7ded8; background: #fff; }
.download-action:hover { border-color: #9eafa4; background: #f6f8f5; }
.lock-action { background: transparent; cursor: pointer; }
.lock-action:hover { background: #eff2ed; }

.viewer-host {
  min-width: 0;
  min-height: 0;
  flex: 1 1 auto;
  overflow: hidden;
  background: #f8f7f3;
}

.viewer-host iframe {
  display: block;
  width: 100%;
  height: calc(100vh - 52px);
  height: calc(100dvh - 52px);
  border: 0;
  background: #fff;
}

@media (max-width: 540px) {
  .gate-shell { justify-content: center; padding: 24px 16px 18px; }
  .gate-card { padding: 31px 25px 25px; border-radius: 12px; }
  .gate-copy { margin-top: 36px; }
  .unlock-form { margin-top: 26px; }
  .toolbar { height: 52px; min-height: 52px; padding: 0 10px; gap: 5px; }
  .toolbar-brand { gap: 6px; font-size: 10px; }
  .toolbar-mark { width: 24px; height: 24px; font-size: 14px; }
  .toolbar-actions { gap: 2px; }
  .download-action, .lock-action { min-height: 34px; padding: 0 7px; font-size: 10px; }
}

@media (max-width: 365px) {
  .toolbar-brand span:last-child { max-width: 74px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .download-action, .lock-action { padding: 0 5px; font-size: 9px; }
}
