﻿:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #1c2b40;
  background: #f5f7fa;
  font-synthesis: none;
  --blue: #2156cf;
  --muted: #58677c;
  --border: #dce3ed;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button { -webkit-user-select: none; user-select: none; }
[hidden] { display: none !important; }
::selection { background: #dce7ff; color: #1c2b40; }
input { caret-color: var(--blue); }
svg { width: 20px; height: 20px; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
h1, h2, h3, p { margin: 0; }
button:focus-visible, a:focus-visible, input:focus-visible, iframe:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.app-shell { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; padding-inline: env(safe-area-inset-left) env(safe-area-inset-right); padding-bottom: env(safe-area-inset-bottom); }
.site-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: calc(8px + env(safe-area-inset-top)) 16px 8px; background: #fff; border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; background: #edf3ff; border: 1px solid #dce7ff; color: var(--blue); border-radius: 9px; }
.brand-mark svg { width: 22px; height: 22px; }
h1 { font-size: 19px; line-height: 1.3; letter-spacing: -0.03em; font-weight: 750; }
.brand p { color: var(--muted); font-size: 11px; }
.source-label { color: var(--muted); font-size: 12px; }
main { display: flex; flex-direction: column; flex: 1; gap: 10px; min-width: 0; width: 100%; margin-inline: auto; padding: 12px 16px 0; }
.input-card, .viewer-card { background: #fff; border: 1px solid var(--border); border-radius: 10px; }
.input-card { padding: 12px 14px; }
h2 { font-size: 14px; font-weight: 650; line-height: 1.5; }
label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 6px; }
.form-controls { display: flex; gap: 8px; }
.input-wrap { display: flex; position: relative; flex: 1; min-width: 0; }
.input-wrap > svg { position: absolute; left: 13px; top: 12px; color: #63738a; pointer-events: none; }
input { width: 100%; min-width: 0; height: 44px; border: 1px solid #b4c1d3; border-radius: 7px; padding: 10px 12px 10px 41px; color: #1c2b40; background: #fff; font-size: 16px; }
input::placeholder { color: #63738a; opacity: 1; }
input[aria-invalid="true"] { border-color: #b22a32; }
.button { min-width: 44px; min-height: 44px; display: inline-flex; justify-content: center; align-items: center; gap: 8px; border: 1px solid transparent; border-radius: 7px; padding: 8px 12px; font-size: 13px; line-height: 1.5; font-weight: 600; text-decoration: none; white-space: nowrap; cursor: pointer; }
.button-primary { background: var(--blue); color: #fff; }
.button-secondary { background: #fff; color: #36445a; border-color: #b4c1d3; }
.button:active:not(:disabled):not([aria-disabled="true"]) { background: #e0e8f5; }
.button-primary:active { background: #1945ac !important; }
.button:disabled, .drive-link[aria-disabled="true"] { color: #667388; background: #f5f7fa; border-color: var(--border); cursor: default; }
@media (hover: hover) and (pointer: fine) {
  .button-primary:hover { background: #1945ac; }
  .button-secondary:hover:not(:disabled) { background: #f0f4f9; }
  .drive-link:hover:not([aria-disabled="true"]) { background: #edf3ff; }
}
.field-help { color: var(--muted); font-size: 12px; line-height: 1.5; margin-top: 6px; }
.field-error { color: #a4202b; font-size: 13px; line-height: 1.5; margin-top: 6px; overflow-wrap: anywhere; }
.viewer-card { flex: 1; display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.viewer-toolbar { flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 12px; border-bottom: 1px solid #e7ecf3; }
.viewer-heading { display: flex; align-items: center; gap: 10px; min-width: 0; flex-wrap: wrap; }
.viewer-actions { display: flex; align-items: center; gap: 8px; }
.state-badge { display: inline-flex; align-items: center; gap: 6px; background: #f0f3f7; color: #526176; padding: 3px 8px; border-radius: 5px; font-size: 11px; line-height: 1.5; font-weight: 600; }
.state-badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.drive-link { color: var(--blue); font-size: 12px; padding-inline: 8px; }
.drive-link svg { width: 16px; height: 16px; }
.collapse-icon { display: none; }
.viewer-status { flex-shrink: 0; padding: 6px 12px; font-size: 12px; line-height: 1.5; color: var(--muted); background: #fbfcfe; border-bottom: 1px solid #e7ecf3; }
.viewer-card[data-state="preparing"] .state-badge, .viewer-card[data-state="shown"] .state-badge, .viewer-card[data-state="delayed"] .state-badge { color: #214ba4; background: #edf3ff; }
.viewer-card[data-state="invalid"] .state-badge { color: #a4202b; background: #fff0f1; }
.viewer-surface { position: relative; flex: 1; display: flex; min-height: 240px; background: #f8fafc; }
.viewer-surface iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #f8fafc; }
.empty-state { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; text-align: center; }
.empty-icon { display: grid; place-items: center; width: 68px; height: 76px; color: #6d88b0; margin-bottom: 14px; background: #edf2fa; border-radius: 16px; }
.empty-icon svg { width: 46px; height: 46px; stroke-width: 1.5; }
.empty-state h3 { font-size: 21px; font-weight: 600; letter-spacing: -0.03em; line-height: 1.4; }
.empty-state p { max-width: 330px; color: var(--muted); font-size: 13px; line-height: 1.6; margin-top: 8px; }
.empty-caption { color: #63738a; font-size: 11px; margin-top: 16px; }
footer { display: flex; justify-content: space-between; gap: 12px; padding: 8px 16px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.noscript-notice { padding: 12px; background: #fff0f1; color: #a4202b; border-radius: 8px; }

/* Keep the same DOM subtree, even during native fullscreen transitions. */
body.is-reading { position: fixed; width: 100%; overflow: hidden; overscroll-behavior: none; }
.is-reading .site-header, .is-reading .input-card, .is-reading footer { display: none; }
.viewer-card[data-reading-mode]:not([data-reading-mode="normal"]), .viewer-card:fullscreen {
  position: fixed; inset: 0; z-index: 10; width: 100%; height: 100vh; height: 100dvh; max-width: none;
  border: 0; border-radius: 0; background: #fff;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  overscroll-behavior: contain;
}
.is-reading .viewer-surface { min-height: 0; }
.is-reading .expand-icon { display: none; }
.is-reading .collapse-icon { display: block; }
/* Keep live status accessible; loading and delay messages remain visible. */
.is-reading .viewer-card[data-state="shown"] .viewer-status { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); border: 0; }

@media (max-width: 700px) {
  .site-header { padding-inline: 12px; }
  .brand p, .wide-label { display: none; }
  .source-label { font-size: 11px; }
  main { padding: 8px 8px 0; gap: 8px; }
  .input-card { padding: 10px; }
  .form-controls { flex-wrap: wrap; }
  .input-wrap { flex-basis: 100%; }
  .form-controls .button { flex: 1; }
  .viewer-toolbar { flex-wrap: wrap; gap: 4px; padding: 6px 8px; }
  .viewer-heading { width: 100%; justify-content: space-between; gap: 8px; }
  .viewer-actions { width: 100%; justify-content: space-between; gap: 6px; }
  .viewer-status { padding-inline: 10px; }
  .is-reading .viewer-heading { display: none; }
  footer { display: none; }
  .app-shell { padding-bottom: max(8px, env(safe-area-inset-bottom)); }
}
/* Short windows and the software keyboard may need page scroll. Never clip the
   form or disable zoom just to force everything into the viewport. */
@media (max-height: 500px) and (min-width: 701px) {
  .brand p, footer { display: none; }
  .site-header { padding-block: 6px; }
  main { padding-top: 8px; gap: 8px; }
  .input-card { padding-block: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
}
