html:has(body.whale-page) {
  --paper: #e7f1f8;
  --ink: #16325c;
  --muted: #5c7390;
  --accent: #1c5f9e;
  --line: #c5d5e4;
  --nav-surface: rgb(231 241 248 / .82);
  --nav-surface-solid: #e7f1f8;
  --nav-border: rgb(22 50 92 / .14);
  --nav-hover: rgb(28 95 158 / .08);
  --nav-active: rgb(28 95 158 / .12);
  --nav-scroll-shadow: 0 8px 28px rgb(22 50 92 / .08);
  color-scheme: light;
}

html[data-theme="dark"]:has(body.whale-page) {
  --paper: #071422;
  --ink: #e7eef6;
  --muted: #9eb0c6;
  --accent: #8eb7e8;
  --line: #243952;
  --nav-surface: rgb(7 20 34 / .82);
  --nav-surface-solid: #071422;
  --nav-border: rgb(231 238 246 / .14);
  --nav-hover: rgb(142 183 232 / .1);
  --nav-active: rgb(142 183 232 / .16);
  --nav-scroll-shadow: 0 10px 32px rgb(2 8 16 / .45);
  color-scheme: dark;
  background: #071422;
}

html[data-theme="dark"]:has(body.whale-page) body { background-image: none; }

body.whale-page {
  background:
    radial-gradient(ellipse at 82% -8%, rgb(166 214 240 / .7), transparent 46%),
    radial-gradient(ellipse at 8% 108%, rgb(196 161 90 / .16), transparent 34%),
    var(--paper);
}

html[data-theme="dark"] body.whale-page {
  background:
    radial-gradient(ellipse at 84% -10%, rgb(36 92 158 / .42), transparent 48%),
    radial-gradient(ellipse at 6% 110%, rgb(224 181 106 / .1), transparent 30%),
    var(--paper);
}

body.whale-page ::selection { background: #c9e4f6; color: #16325c; }
html[data-theme="dark"] body.whale-page ::selection { background: #1d4e86; color: #f4f8fc; }
body.whale-page .paper-grain { display: none; }

.whale-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
}

.whale-mark {
  width: 168px;
  flex: none;
  margin-bottom: 0.15rem;
  color: #2a74b8;
}

html[data-theme="dark"] body.whale-page .whale-mark { color: #8eb7e8; }

.whale-main {
  position: relative;
  z-index: 1;
  width: min(760px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 3.2rem 0 4.5rem;
}

.whale-main .writing-intro { letter-spacing: .02em; }

.whale-main h2 {
  margin: 2.4rem 0 0.2rem;
  font-size: 1.2rem;
  font-weight: 500;
  letter-spacing: .14em;
}

.whale-gate { margin-top: 1.8rem; }
.whale-gate p { margin: 0; font-size: 1.05rem; line-height: 1.7; }

.whale-gate form {
  display: flex;
  gap: 0.7rem;
  align-items: center;
  margin-top: 0.9rem;
}

.whale-gate input {
  flex: 1;
  min-width: 0;
  border: 1px solid rgb(22 50 92 / .22);
  background: rgb(255 255 255 / .72);
  color: inherit;
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
  font: inherit;
}

html[data-theme="dark"] body.whale-page .whale-gate input {
  background: rgb(12 32 56 / .72);
  border-color: rgb(142 183 232 / .28);
}

.whale-gate button {
  border: 1px solid #c4a15a;
  border-radius: 12px;
  background: #1c5f9e;
  color: #f7fbff;
  padding: 0.75rem 1.05rem;
  font: inherit;
  letter-spacing: .08em;
  cursor: pointer;
}

html[data-theme="dark"] body.whale-page .whale-gate button {
  background: #16365c;
  border-color: #e0b56a;
  color: #f4f8fc;
}

.whale-error { color: #9a4a3a; min-height: 1.4em; margin-top: 0.6rem; }
html[data-theme="dark"] body.whale-page .whale-error { color: #f0a8a0; }

.whale-status {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin: 1.8rem 0 0.4rem;
}

.whale-chip {
  display: grid;
  gap: 0.15rem;
  min-width: 7.4rem;
  padding: 0.7rem 0.9rem 0.75rem;
  background: rgb(255 255 255 / .62);
  border: 1px solid rgb(22 50 92 / .1);
  border-radius: 16px;
}

html[data-theme="dark"] body.whale-page .whale-chip {
  background: rgb(16 42 72 / .72);
  border-color: rgb(142 183 232 / .16);
}

.whale-chip-label { font-size: 0.86rem; letter-spacing: .08em; color: var(--muted); }
.whale-chip strong { font-size: 1.55rem; font-weight: 500; font-variant-numeric: tabular-nums; }

.whale-chip i {
  display: block;
  height: 3px;
  margin-top: 0.35rem;
  border-radius: 99px;
  background: rgb(22 50 92 / .12);
}

html[data-theme="dark"] body.whale-page .whale-chip i { background: rgb(231 238 246 / .12); }

.whale-chip i::before {
  content: "";
  display: block;
  height: 100%;
  width: calc(var(--n) * 1%);
  max-width: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.whale-list,
.whale-log {
  list-style: none;
  margin: 0;
  padding: 0;
}

.whale-list li,
.whale-log li {
  display: grid;
  grid-template-columns: 3.4rem 1fr;
  gap: 0.75rem;
  align-items: baseline;
  padding: 0.85rem 0;
  border-top: 1px solid var(--line);
  line-height: 1.65;
}

.whale-list li:not(:has(time)),
.whale-log li:not(:has(time)) { grid-template-columns: 1fr; }

.whale-list time,
.whale-log time {
  color: #9a7433;
  font-variant-numeric: tabular-nums;
  font-size: 0.92rem;
}

html[data-theme="dark"] body.whale-page .whale-list time,
html[data-theme="dark"] body.whale-page .whale-log time { color: #e0b56a; }

.whale-log { color: var(--muted); font-size: 0.95rem; }

.whale-in .whale-list li { animation: settle .4s ease both; }
.whale-in .whale-list li:nth-child(2) { animation-delay: .04s; }
.whale-in .whale-list li:nth-child(3) { animation-delay: .08s; }
.whale-in .whale-list li:nth-child(4) { animation-delay: .12s; }
.whale-in .whale-list li:nth-child(n + 5) { animation: none; }

@keyframes settle {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .whale-in .whale-list li { animation: none; }
}

.whale-meta { margin: 1.6rem 0 0; font-size: 0.9rem; color: var(--muted); }

@media (max-width: 640px) {
  .whale-gate form { align-items: stretch; }
  .whale-chip { min-width: calc(50% - 0.4rem); flex: 1; }
  .whale-mark { width: 92px; }
}
