:root {
  color-scheme: light;
  --cream: #f7f1e4;
  --cream-deep: #e9dfca;
  --navy: #10283d;
  --navy-soft: #244257;
  --teal: #087f78;
  --teal-light: #d9efea;
  --gold: #c79b42;
  --before-ratio: 50%;
  --toolbar-height: 96px;
  font-family: "Hiragino Sans", "Yu Gothic", "YuGothic", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--cream);
  color: var(--navy);
}

button,
input { font: inherit; }

button,
.sync-control {
  min-height: 44px;
}

button { touch-action: manipulation; }

.toolbar {
  position: fixed;
  z-index: 20;
  inset: 0 0 auto;
  min-height: var(--toolbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 18px;
  border-bottom: 1px solid rgba(16, 40, 61, 0.2);
  background: rgba(247, 241, 228, 0.98);
  box-shadow: 0 5px 24px rgba(16, 40, 61, 0.12);
}

.toolbar__intro { min-width: 235px; }

.eyebrow,
.toolbar h1,
.privacy-note { margin: 0; }

.eyebrow {
  color: var(--teal);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.toolbar h1 {
  margin-top: 2px;
  font-family: "Hiragino Mincho ProN", "Yu Mincho", serif;
  font-size: clamp(17px, 2vw, 24px);
  line-height: 1.2;
}

.privacy-note {
  margin-top: 4px;
  color: var(--navy-soft);
  font-size: 11px;
}

.toolbar__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.mode-switcher {
  display: flex;
  margin: 0;
  padding: 3px;
  border: 1px solid rgba(16, 40, 61, 0.25);
  border-radius: 10px;
  background: #fffdf8;
}

.mode-switcher button,
.mobile-swap,
.top-button {
  border: 0;
  border-radius: 7px;
  padding: 8px 13px;
  color: var(--navy);
  background: transparent;
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
}

.mode-switcher button[aria-pressed="true"] {
  color: white;
  background: var(--navy);
}

.sync-control {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  border-radius: 8px;
  color: var(--navy);
  background: var(--teal-light);
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
}

.sync-control input {
  width: 19px;
  height: 19px;
  margin: 0;
  accent-color: var(--teal);
}

.top-button {
  border: 1px solid var(--teal);
  color: var(--teal);
  background: #fffdf8;
}

.mobile-swap { display: none; }
.mobile-swap[hidden] { display: none !important; }

button:focus-visible,
input:focus-visible,
.divider:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}

.comparison {
  position: fixed;
  inset: var(--toolbar-height) 0 0;
  display: flex;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  background: var(--navy);
}

.pane {
  position: relative;
  min-width: 0;
  height: 100%;
  overflow: hidden;
  background: white;
}

.mode-compare .pane--before { flex: 0 0 var(--before-ratio); }
.mode-compare .pane--after { flex: 1 1 auto; }

.pane__label {
  position: absolute;
  z-index: 5;
  top: 10px;
  left: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 6px 11px 6px 7px;
  border: 1px solid rgba(16, 40, 61, 0.18);
  border-radius: 9px;
  background: rgba(255, 253, 248, 0.94);
  box-shadow: 0 4px 16px rgba(16, 40, 61, 0.14);
  pointer-events: none;
}

.pane__label span:last-child { display: grid; }
.pane__label strong { font-size: 13px; }
.pane__label small { color: var(--navy-soft); font-size: 10px; }

.version-mark {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: var(--navy);
  font-size: 12px;
  font-weight: 900;
}

.pane--after .version-mark { background: var(--teal); }

iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: white;
}

.frame-state {
  position: absolute;
  z-index: 4;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 8px;
  padding: 72px 24px 24px;
  text-align: center;
  background:
    radial-gradient(circle at 50% 42%, rgba(8, 127, 120, 0.12), transparent 32%),
    var(--cream);
}

.frame-state[hidden] { display: none; }

.frame-state > span {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid var(--teal);
  border-radius: 50%;
  color: var(--teal);
  font-size: 24px;
  font-weight: 900;
}

.frame-state strong { font-size: 18px; }
.frame-state small { color: var(--navy-soft); line-height: 1.7; }
.frame-state code { font-size: 0.95em; }

.divider {
  position: relative;
  z-index: 10;
  flex: 0 0 12px;
  width: 12px;
  height: 100%;
  background: var(--navy);
  cursor: col-resize;
  touch-action: none;
}

.divider::before {
  content: "";
  position: absolute;
  inset: 0 -10px;
}

.divider__grip {
  position: absolute;
  top: 50%;
  left: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: 34px;
  height: 54px;
  border: 2px solid var(--cream);
  border-radius: 17px;
  background: var(--teal);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
  transform: translate(-50%, -50%);
}

.divider__grip i {
  width: 2px;
  height: 18px;
  border-radius: 2px;
  background: white;
}

.mode-before .pane--before,
.mode-after .pane--after { flex: 1 1 100%; }

.mode-before .pane--after,
.mode-after .pane--before,
.mode-before .divider,
.mode-after .divider { display: none; }

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

@media (max-width: 900px) {
  :root { --toolbar-height: 132px; }

  .toolbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
    padding: 9px 12px;
  }

  .toolbar__intro { min-width: 0; }
  .privacy-note { display: none; }
  .toolbar__actions { width: 100%; justify-content: flex-start; }
  .top-button { margin-left: auto; }
}

@media (max-width: 1269px) {
  .mode-compare .divider { display: none; }
  .mode-compare .pane { flex: 1 1 100%; width: 100%; min-width: 0; }
  .mode-compare.mobile-show-after .pane--before,
  .mode-compare.mobile-show-before .pane--after { display: none; }
  .mobile-swap { display: inline-flex; align-items: center; }
  .mobile-swap { border: 1px solid var(--navy); background: #fffdf8; }
}

@media (max-width: 767px) {
  :root { --toolbar-height: 190px; }

  .toolbar__actions { flex-wrap: wrap; }

  .mode-switcher {
    width: 100%;
  }

  .mode-switcher button { flex: 1 1 0; padding-inline: 5px; }

  .sync-control { flex: 1 1 auto; justify-content: center; }
  .top-button { margin-left: 0; }
}

@media (max-width: 390px) {
  :root { --toolbar-height: 198px; }
  .toolbar h1 { font-size: 17px; }
  .toolbar__actions { gap: 6px; }
  .mobile-swap,
  .top-button { padding-inline: 9px; font-size: 12px; }
}

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