/* 夜の水族館 — 閉館後の静かな水槽。クラゲの光が監視ソースの体温を伝える */
:root {
  --abyss: #03101a;
  --water: #061a26;
  --glass: #0b2635;
  --glass-line: #17435c;
  --ink: #dcf1fa;
  --dim: #7fa5b8;
  --glow: #66e6ff;
  --jelly-ok: #66e6ff;
  --jelly-warn: #ffc46b;
  --jelly-bad: #ff6b8a;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
body {
  min-height: 100dvh;
  background:
    radial-gradient(1200px 600px at 30% -10%, rgb(102 230 255 / 7%), transparent 60%),
    radial-gradient(900px 500px at 90% 110%, rgb(120 110 255 / 6%), transparent 60%),
    linear-gradient(180deg, var(--abyss), var(--water) 45%, #041420);
  color: var(--ink);
  font-family: "Zen Kaku Gothic New", sans-serif;
  padding-bottom: 60px;
  overflow-x: hidden;
}
canvas#caustics { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 0; opacity: 0.5; }

/* ---- スプラッシュ: 水が満ち、クジラが横切り、館名が灯る ---- */
.splash {
  position: fixed; inset: 0; z-index: 60;
  background: #020a10;
  display: grid; place-items: center;
  overflow: hidden; cursor: pointer;
  animation: splash-out 1s ease 6s forwards;
}
.splash.is-done { display: none; }
@keyframes splash-out { to { opacity: 0; visibility: hidden; } }
.splash-water {
  position: absolute; inset: 0; top: 100%;
  background: linear-gradient(180deg, rgb(102 230 255 / 16%), var(--water) 30%, var(--abyss));
  animation: water-fill 2.2s cubic-bezier(0.3, 0.6, 0.3, 1) 0.2s forwards;
}
@keyframes water-fill { to { top: 0; } }
.splash-caustics {
  position: absolute; inset: 0; opacity: 0;
  background:
    radial-gradient(ellipse 60% 30% at 25% 12%, rgb(102 230 255 / 14%), transparent 60%),
    radial-gradient(ellipse 50% 26% at 70% 8%, rgb(102 230 255 / 11%), transparent 60%);
  animation: caustic-in 1.4s ease 1.8s forwards, caustic-sway 7s ease-in-out 1.8s infinite alternate;
}
@keyframes caustic-in { to { opacity: 1; } }
@keyframes caustic-sway { to { transform: translateX(4%); } }
.splash-bubbles { position: absolute; inset: 0; pointer-events: none; }
.splash-bubbles i {
  position: absolute; bottom: -20px; width: 10px; height: 10px;
  border: 1.4px solid rgb(220 241 250 / 55%); border-radius: 50%;
  opacity: 0;
  animation: bub-rise 3.2s ease-in 2.2s infinite;
}
.splash-bubbles i:nth-child(1) { left: 12%; animation-delay: 2.2s; }
.splash-bubbles i:nth-child(2) { left: 24%; width: 6px; height: 6px; animation-delay: 2.7s; }
.splash-bubbles i:nth-child(3) { left: 41%; animation-delay: 2.4s; }
.splash-bubbles i:nth-child(4) { left: 56%; width: 14px; height: 14px; animation-delay: 3s; }
.splash-bubbles i:nth-child(5) { left: 68%; animation-delay: 2.5s; }
.splash-bubbles i:nth-child(6) { left: 81%; width: 7px; height: 7px; animation-delay: 2.9s; }
.splash-bubbles i:nth-child(7) { left: 92%; animation-delay: 2.3s; }
@keyframes bub-rise {
  0% { opacity: 0; transform: translateY(0); }
  15% { opacity: 0.8; }
  100% { opacity: 0; transform: translateY(-92vh) translateX(12px); }
}
.splash-whale {
  position: absolute; top: 30%; left: -30%;
  width: min(46vw, 380px); height: auto;
  animation: whale-cross 3.4s cubic-bezier(0.4, 0.1, 0.5, 0.9) 2.1s forwards;
}
.splash-whale path { fill: rgb(20 60 84 / 90%); stroke: rgb(102 230 255 / 35%); stroke-width: 1.5; }
.splash-whale .eye { fill: var(--glow); }
@keyframes whale-cross { to { left: 108%; } }
.splash-word { position: relative; z-index: 2; text-align: center; opacity: 0; animation: word-in 1.2s ease 3.9s forwards; }
@keyframes word-in { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }
.splash-over { letter-spacing: 0.5em; font-size: 11px; color: var(--dim); font-family: "IBM Plex Mono", monospace; }
.splash-word h1 {
  margin: 10px 0 0; font-family: "Zen Maru Gothic", sans-serif; font-weight: 900;
  font-size: clamp(40px, 10vw, 76px); letter-spacing: 0.12em;
  color: var(--ink); text-shadow: 0 0 34px rgb(102 230 255 / 45%);
}
.splash-note { margin-top: 12px; color: var(--dim); font-size: 13px; letter-spacing: 0.2em; }
@media (prefers-reduced-motion: reduce) { .splash { display: none; } }

/* ---- ヘッダ ---- */
.aq-head {
  position: relative; z-index: 1;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 24px clamp(16px, 4vw, 42px) 10px;
}
.aq-head .over { font-family: "IBM Plex Mono", monospace; font-size: 9px; letter-spacing: 0.4em; color: var(--dim); }
.aq-head h1 { font-family: "Zen Maru Gothic", sans-serif; font-weight: 900; font-size: clamp(20px, 3.4vw, 30px); letter-spacing: 0.1em; }
.aq-state { margin-left: auto; display: grid; gap: 2px; text-align: right; }
.aq-state strong { font-size: 16px; color: var(--glow); }
body[data-tone="warning"] .aq-state strong { color: var(--jelly-warn); }
body[data-tone="danger"] .aq-state strong { color: var(--jelly-bad); }
.aq-state span { font-size: 11px; color: var(--dim); }
.aq-state .updated b { color: var(--ink); font-weight: 500; }
.quiet-link { color: var(--dim); font-size: 11px; text-decoration: none; border-bottom: 1px dotted var(--dim); }
.quiet-link:hover { color: var(--glow); border-color: var(--glow); }

/* ---- 数値盤 ---- */
.board {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px;
  padding: 10px clamp(16px, 4vw, 42px);
  max-width: 1200px; margin: 0 auto;
}
.tile {
  display: grid; justify-items: center; gap: 2px; padding: 12px 8px;
  background: rgb(11 38 53 / 70%); border: 1px solid var(--glass-line); border-radius: 14px;
  backdrop-filter: blur(2px);
}
.tile strong { font-family: "IBM Plex Mono", monospace; font-size: 24px; color: var(--glow); text-shadow: 0 0 12px rgb(102 230 255 / 40%); }
.tile small { font-size: 10px; letter-spacing: 0.16em; color: var(--dim); }

/* ---- 本体 ---- */
.aq-main { position: relative; z-index: 1; max-width: 1200px; margin: 8px auto 0; padding: 0 clamp(16px, 4vw, 42px); display: grid; gap: 24px; }
.sec-title { font-size: 13px; letter-spacing: 0.2em; color: var(--dim); margin-bottom: 12px; font-weight: 700; }
.sec-title small { margin-left: 8px; font-family: "IBM Plex Mono", monospace; color: var(--glow); }

/* 水槽: 6ソース */
.tanks { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px; }
.tank {
  position: relative; overflow: hidden;
  border: 1px solid var(--glass-line); border-radius: 16px;
  background:
    linear-gradient(180deg, rgb(102 230 255 / 5%), transparent 40%),
    linear-gradient(180deg, var(--glass), #071e2c);
  padding: 16px 16px 18px;
  min-height: 150px;
  box-shadow: inset 0 0 40px rgb(3 16 26 / 60%), 0 10px 30px rgb(0 0 0 / 35%);
}
.tank::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 42%;
  background:
    radial-gradient(ellipse 70% 60% at 30% 0%, color-mix(in srgb, var(--jelly, var(--jelly-ok)) 10%, transparent), transparent 70%),
    radial-gradient(ellipse 60% 50% at 75% 0%, rgb(102 230 255 / 6%), transparent 70%);
  animation: caustic-sway 8s ease-in-out infinite alternate;
}
.tank-head { position: relative; display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.tank-head strong { font-family: "Zen Maru Gothic", sans-serif; font-size: 15px; letter-spacing: 0.06em; }
.tank-head span { font-size: 11px; color: var(--dim); }
.tank-value { position: relative; margin-top: 8px; font-family: "IBM Plex Mono", monospace; font-size: 19px; color: var(--ink); }
.tank-state { position: relative; margin-top: 3px; font-size: 11px; color: var(--dim); overflow-wrap: anywhere; }
.jelly {
  position: absolute; right: 14px; bottom: 12px;
  width: 44px; height: 50px; pointer-events: none;
  animation: jelly-drift 6s ease-in-out infinite alternate;
  filter: drop-shadow(0 0 12px color-mix(in srgb, var(--jelly, var(--jelly-ok)) 60%, transparent));
}
@keyframes jelly-drift { to { transform: translateY(-14px) rotate(4deg); } }
.jelly .bell {
  width: 40px; height: 30px; margin: 0 auto;
  border-radius: 50% 50% 42% 42% / 90% 90% 24% 24%;
  background: radial-gradient(circle at 50% 26%, #fff, var(--jelly, var(--jelly-ok)) 62%, transparent 78%);
  animation: jelly-pulse 2.6s ease-in-out infinite;
  transform-origin: bottom center;
}
@keyframes jelly-pulse { 50% { transform: scaleX(1.12) scaleY(0.9); } }
.jelly .arms { display: flex; justify-content: center; gap: 4px; margin-top: -3px; }
.jelly .arms i {
  width: 2.5px; height: 18px; border-radius: 2px;
  background: linear-gradient(180deg, var(--jelly, var(--jelly-ok)), transparent);
  animation: arm-wave 2.6s ease-in-out infinite;
}
.jelly .arms i:nth-child(2) { height: 22px; animation-delay: 0.2s; }
.jelly .arms i:nth-child(3) { height: 17px; animation-delay: 0.4s; }
.jelly .arms i:nth-child(4) { height: 21px; animation-delay: 0.6s; }
@keyframes arm-wave { 50% { transform: skewX(9deg); } }
.tank[data-severity="warning"] .jelly { animation-duration: 3.4s; }
.tank[data-severity="danger"] .jelly { animation-duration: 1.6s; }
.tank[data-severity="danger"] { border-color: color-mix(in srgb, var(--jelly-bad) 55%, var(--glass-line)); }
.tank.is-changed { animation: tank-ripple 1.2s ease; }
@keyframes tank-ripple { 25% { box-shadow: inset 0 0 60px color-mix(in srgb, var(--jelly, var(--jelly-ok)) 22%, transparent), 0 10px 30px rgb(0 0 0 / 35%); } }
.tank-bubble {
  position: absolute; bottom: 6px; width: 6px; height: 6px;
  border: 1.2px solid rgb(220 241 250 / 50%); border-radius: 50%;
  animation: bub-rise-tank 2.8s ease-in forwards;
  pointer-events: none;
}
@keyframes bub-rise-tank {
  0% { opacity: 0; transform: translateY(0); }
  20% { opacity: 0.8; }
  100% { opacity: 0; transform: translateY(-120px) translateX(8px); }
}

/* 小魚の群れ: 機能チェック */
.school {
  position: relative; display: flex; flex-wrap: wrap; gap: 10px;
  padding: 16px; border: 1px solid var(--glass-line); border-radius: 16px;
  background: rgb(11 38 53 / 50%);
}
.fish {
  position: relative; width: 26px; height: 12px; border: none; padding: 0; cursor: pointer;
  background: var(--fish, var(--jelly-ok));
  border-radius: 60% 40% 40% 60% / 60% 50% 50% 60%;
  clip-path: polygon(0 50%, 22% 8%, 78% 0, 100% 38%, 100% 62%, 78% 100%, 22% 92%);
  opacity: 0.92;
  animation: fish-swim 4.4s ease-in-out infinite alternate;
  animation-delay: var(--tw, 0s);
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--fish, var(--jelly-ok)) 55%, transparent));
}
@keyframes fish-swim { to { transform: translateX(6px) rotate(6deg); } }
.fish[data-status="error"] { animation: fish-flail 0.9s ease-in-out infinite alternate; }
@keyframes fish-flail { to { transform: rotate(170deg) translateY(4px); } }
.fish .tip {
  position: absolute; bottom: 150%; left: 50%; transform: translateX(-50%);
  background: #041420; border: 1px solid var(--glass-line); border-radius: 8px;
  color: var(--ink); font-size: 11px; padding: 5px 9px; white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity 0.2s ease; z-index: 5;
}
.fish:hover .tip, .fish:focus .tip { opacity: 1; }

/* 観察記録 */
.log-list { list-style: none; display: grid; gap: 8px; max-height: 320px; overflow-y: auto; }
.log-item {
  display: grid; grid-template-columns: auto auto minmax(0, 1fr); gap: 10px; align-items: baseline;
  padding: 9px 12px; border-radius: 12px;
  background: rgb(11 38 53 / 55%); border: 1px solid transparent;
  border-left: 3px solid var(--edge, var(--jelly-ok));
  font-size: 12px;
}
.log-item.is-new { animation: log-in 0.8s cubic-bezier(0.2, 0.9, 0.3, 1); }
@keyframes log-in { from { opacity: 0; transform: translateY(-10px); background: rgb(102 230 255 / 12%); } }
.log-item .when { font-family: "IBM Plex Mono", monospace; color: var(--dim); font-size: 10px; white-space: nowrap; }
.log-item .who { color: var(--glow); font-size: 11px; white-space: nowrap; }
.log-item .what { color: var(--ink); overflow-wrap: anywhere; }
.empty { color: var(--dim); font-size: 12px; }

/* ---- 詳細(mdet) ---- */
.details { position: relative; z-index: 1; max-width: 1200px; margin: 24px auto 0; padding: 0 clamp(16px, 4vw, 42px); }
.mdet { background: rgb(11 38 53 / 60%); border: 1px solid var(--glass-line); border-radius: 16px; padding: 18px; backdrop-filter: blur(2px); }
.mdet-title { font-size: 13px; letter-spacing: 0.2em; color: var(--dim); margin-bottom: 12px; }
.mdet-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.mdet-tab {
  position: relative; appearance: none; cursor: pointer; font-family: inherit;
  padding: 7px 15px; border-radius: 999px; font-size: 12px; letter-spacing: 0.08em;
  background: transparent; border: 1px solid var(--glass-line); color: var(--dim);
  transition: all 0.25s ease;
}
.mdet-tab:hover { color: var(--ink); border-color: var(--glow); }
.mdet-tab.is-active { background: var(--glow); border-color: var(--glow); color: #04222e; font-weight: 700; box-shadow: 0 0 16px rgb(102 230 255 / 40%); }
.mdet-tab[data-badge]:not([data-badge=""])::after {
  content: attr(data-badge);
  position: absolute; top: -7px; right: -7px; min-width: 16px; height: 16px;
  border-radius: 8px; background: var(--jelly-bad); color: #fff;
  font-size: 10px; display: grid; place-items: center; padding: 0 4px;
}
.mdet-panel { animation: panel-in 0.5s ease; }
@keyframes panel-in { from { opacity: 0; transform: translateY(8px); } }
.mdet-bar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.mdet-search {
  flex: 1; min-width: 200px; padding: 8px 14px; border-radius: 999px;
  background: rgb(4 20 32 / 80%); border: 1px solid var(--glass-line); color: var(--ink); font-family: inherit; font-size: 13px;
}
.mdet-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.mdet-filter {
  appearance: none; cursor: pointer; font-family: inherit; font-size: 11px;
  padding: 6px 12px; border-radius: 999px; background: transparent;
  border: 1px solid var(--glass-line); color: var(--dim);
}
.mdet-filter.is-active { background: var(--glow); border-color: var(--glow); color: #04222e; font-weight: 700; }
.mdet-group { margin-bottom: 14px; }
.mdet-group-title { display: flex; gap: 8px; align-items: baseline; font-size: 12px; letter-spacing: 0.14em; color: var(--glow); margin-bottom: 8px; }
.mdet-group-title small { color: var(--dim); }
.mdet-check-list { display: grid; gap: 5px; }
.mdet-check {
  display: grid; grid-template-columns: auto minmax(0, 1.2fr) auto minmax(0, 1.4fr); gap: 10px; align-items: center;
  padding: 7px 12px; border-radius: 10px; background: rgb(220 241 250 / 3%);
  font-size: 12px;
  animation: panel-in 0.4s ease both; animation-delay: calc(var(--i, 0) * 26ms);
}
.mdet-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--jelly-ok); box-shadow: 0 0 8px rgb(102 230 255 / 55%); }
.mdet-check[data-status="error"] .mdet-dot { background: var(--jelly-bad); box-shadow: 0 0 8px rgb(255 107 138 / 60%); }
.mdet-check[data-status="warning"] .mdet-dot, .mdet-check[data-status="transient"] .mdet-dot { background: var(--jelly-warn); box-shadow: 0 0 8px rgb(255 196 107 / 55%); }
.mdet-check-name { display: grid; min-width: 0; }
.mdet-check-name strong { font-size: 12px; }
.mdet-check-name span { font-size: 10px; color: var(--dim); }
.mdet-check-state { font-family: "IBM Plex Mono", monospace; font-size: 11px; color: var(--dim); white-space: nowrap; }
.mdet-check-summary { font-size: 11px; color: var(--dim); overflow-wrap: anywhere; }
.mdet-history-list { display: grid; gap: 6px; }
.mdet-event {
  display: grid; grid-template-columns: auto auto minmax(0, 0.8fr) minmax(0, 1.6fr); gap: 10px; align-items: baseline;
  padding: 7px 12px; border-radius: 10px; background: rgb(220 241 250 / 3%); font-size: 12px;
  border-left: 3px solid var(--glass-line);
  animation: panel-in 0.4s ease both; animation-delay: calc(var(--i, 0) * 22ms);
}
.mdet-event[data-tone="danger"] { border-left-color: var(--jelly-bad); }
.mdet-event[data-tone="warning"] { border-left-color: var(--jelly-warn); }
.mdet-event[data-tone="success"] { border-left-color: var(--jelly-ok); }
.mdet-event-time { font-family: "IBM Plex Mono", monospace; font-size: 10px; color: var(--dim); white-space: nowrap; }
.mdet-event-source { font-size: 10px; color: var(--glow); white-space: nowrap; }
.mdet-event-name { font-size: 11px; overflow-wrap: anywhere; }
.mdet-event-msg { color: var(--dim); overflow-wrap: anywhere; }
.mdet-more {
  margin-top: 12px; appearance: none; cursor: pointer; font-family: inherit;
  padding: 8px 18px; border-radius: 999px; background: transparent;
  border: 1px solid var(--glass-line); color: var(--dim); font-size: 12px;
}
.mdet-more:hover { color: var(--ink); border-color: var(--glow); }
.mdet-release-summary { font-size: 12px; color: var(--dim); margin-bottom: 10px; }
.mdet-release {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; gap: 12px; align-items: center;
  padding: 8px 12px; border-radius: 10px; background: rgb(220 241 250 / 3%); font-size: 12px;
  border-left: 3px solid var(--jelly-ok); margin-bottom: 5px;
  animation: panel-in 0.4s ease both; animation-delay: calc(var(--i, 0) * 30ms);
}
.mdet-release[data-tone="warning"] { border-left-color: var(--jelly-warn); }
.mdet-release[data-tone="danger"] { border-left-color: var(--jelly-bad); }
.mdet-release-name { overflow-wrap: anywhere; }
.mdet-release-ver { display: flex; gap: 6px; align-items: center; font-size: 11px; }
.mdet-release-ver code { font-family: "IBM Plex Mono", monospace; background: rgb(4 20 32 / 80%); padding: 1px 6px; border-radius: 5px; color: var(--dim); }
.mdet-release-arrow { color: var(--dim); }
.mdet-release-state { font-size: 11px; color: var(--glow); white-space: nowrap; }
.mdet-release-decision { font-size: 10px; color: var(--dim); white-space: nowrap; }
.mdet-backup {
  display: grid; grid-template-columns: minmax(0, 1.4fr) auto auto auto; gap: 12px; align-items: center;
  padding: 8px 12px; border-radius: 10px; background: rgb(220 241 250 / 3%); font-size: 12px;
  border-left: 3px solid var(--jelly-ok); margin-bottom: 5px;
  animation: panel-in 0.4s ease both; animation-delay: calc(var(--i, 0) * 30ms);
}
.mdet-backup[data-tone="warning"] { border-left-color: var(--jelly-warn); }
.mdet-backup[data-tone="danger"] { border-left-color: var(--jelly-bad); }
.mdet-backup-name { display: grid; min-width: 0; }
.mdet-backup-name strong { font-size: 12px; }
.mdet-backup-name small { font-size: 10px; color: var(--dim); overflow-wrap: anywhere; }
.mdet-backup-gens, .mdet-backup-age { font-family: "IBM Plex Mono", monospace; font-size: 11px; color: var(--dim); white-space: nowrap; }
.mdet-backup-state { font-size: 11px; color: var(--glow); white-space: nowrap; }
.mdet-backup-problems { grid-column: 1 / -1; font-size: 11px; color: var(--jelly-warn); }
.mdet-empty { color: var(--dim); font-size: 12px; }

@media (max-width: 700px) {
  .mdet-check, .mdet-event, .mdet-release, .mdet-backup { grid-template-columns: auto minmax(0, 1fr); }
  .mdet-check-summary, .mdet-event-msg { grid-column: 1 / -1; }
}
:focus-visible { outline: 2px solid var(--glow); outline-offset: 2px; }

/* スマホ/タブレット: 非表示要素や装飾のはみ出しで横スクロールを起こさない */
html, body { overflow-x: clip; }

/* ツールチップは表示時のみレイアウトに参加し、画面幅に収まるよう折り返す */
.fish .tip { display: none; opacity: 1; white-space: normal; max-width: min(72vw, 300px); text-align: left; }
.fish:hover .tip, .fish:focus .tip { display: block; }
