/* 摸鱼水族馆：页面样式。鱼缸、猫、下潜的画面都在 canvas 里，这里只管版面。 */

:root {
  --bg: #eef5f2;
  --paper: #ffffff;
  --ink: #0f2f39;
  --ink-2: #4b6a72;
  --ink-3: #7c979d;
  --line: #d3e2de;
  --sea: #1487a0;
  --sea-deep: #0a3d55;
  --coral: #ff6f4e;
  --coral-dk: #e85a3a;
  --sun: #ffd34d;
  --rim: #17323c;
  --radius: 14px;
  --font: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  --display: "Noto Serif SC", "Songti SC", "STSong", "SimSun", serif;
}

* { box-sizing: border-box; }
/* hidden 属性必须压过 .btn 之类自己写的 display，不然"藏起来"的按钮照样显示 */
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.6 var(--font); -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
h1, h2, h3, p, dl, dd, ul, blockquote, fieldset { margin: 0; padding: 0; }
fieldset { border: 0; min-width: 0; }
ul { list-style: none; }
button, input, textarea { font: inherit; color: inherit; }
.wrap { width: min(1040px, 100% - 32px); margin-inline: auto; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--sea); outline-offset: 2px; }

/* ---------- 按钮 ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 40px; padding: 0 18px; border-radius: 999px; border: 1px solid transparent;
  font-size: 14.5px; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .1s;
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--coral); color: #fff; }
.btn.primary:hover { background: var(--coral-dk); }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn.ghost:hover { border-color: var(--ink-3); background: rgba(15, 47, 57, .04); }
.btn.danger { color: #b3402a; }

/* ---------- 顶栏 ---------- */

.topbar {
  position: sticky; top: 0; z-index: 30;
  background: rgba(238, 245, 242, .82);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(15, 47, 57, .06);
}
.topbar-in {
  width: min(1040px, 100% - 32px); margin-inline: auto; height: 60px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.brand { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; font-weight: 700; letter-spacing: .02em; }
.brand svg { width: 26px; height: 26px; }
.top-actions { display: flex; gap: 8px; }

/* ---------- 开头 ---------- */

.hero { padding: 56px 0 8px; text-align: center; }
.eyebrow { font-size: 13px; letter-spacing: .28em; color: var(--sea); font-weight: 600; }
.hero h1 {
  font-family: var(--display); font-weight: 900; letter-spacing: .06em;
  font-size: clamp(40px, 8vw, 76px); line-height: 1.15; margin-top: 10px;
}
/* 摸鱼语录：自动轮换，点一下换一句 */
.quote {
  display: inline-flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 2px 6px;
  margin-top: 16px; padding: 8px 16px; max-width: 100%; min-height: 46px;
  border: 0; border-radius: 999px; background: transparent; cursor: pointer;
  font-family: var(--display); font-weight: 700; font-size: clamp(18px, 3vw, 24px); line-height: 1.4; color: var(--ink);
  transition: opacity .28s, transform .28s, background .15s;
}
.quote:hover { background: rgba(15, 47, 57, .05); }
.quote.out { opacity: 0; transform: translateY(6px); }
.quote-mark { color: var(--coral); font-size: 1.25em; line-height: 1; }
.quote-swap { width: 16px; height: 16px; margin-left: 4px; color: var(--ink-3); flex: none; transition: transform .4s; }
.quote:hover .quote-swap { transform: rotate(180deg); color: var(--sea); }
.lead { margin-top: 8px; color: var(--ink-3); font-size: clamp(13.5px, 2vw, 15px); }

/* 投喂按钮点下去弹一下 */
@keyframes bump { 0% { transform: scale(1); } 35% { transform: scale(1.14); } 100% { transform: scale(1); } }
.btn.bump { animation: bump .32s ease-out; }
.stats {
  margin: 34px auto 0; display: grid; grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper);
  max-width: 860px;
}
.stats > div { padding: 16px 10px; border-left: 1px solid var(--line); }
.stats > div:first-child { border-left: 0; }
.stats dt { font-size: 12.5px; color: var(--ink-3); }
.stats dd { margin-top: 2px; white-space: nowrap; }
.stats b { font-size: clamp(22px, 4vw, 30px); font-variant-numeric: tabular-nums; }
.stats span { margin-left: 4px; font-size: 13px; color: var(--ink-2); }

/* ---------- 鱼缸 ---------- */

.tank-sec { padding-top: 84px; }   /* 缸沿上方留给猫的地方 */
.tank { position: relative; width: 100%; height: clamp(340px, 60vh, 600px); background: #0f5d78; }
.tank-rim {
  position: absolute; left: 0; right: 0; top: 0; height: 12px; z-index: 2;
  background: linear-gradient(180deg, #2c4f5b 0 3px, var(--rim) 3px);
  box-shadow: 0 2px 0 rgba(0, 0, 0, .18);
}
#tankCanvas { position: absolute; inset: 12px 0 0 0; width: 100%; height: calc(100% - 12px); display: block; touch-action: pan-y; }
.tank-tip {
  position: absolute; z-index: 3; transform: translate(-50%, -100%); pointer-events: none;
  background: rgba(8, 30, 40, .88); color: #fff; font-size: 12.5px; line-height: 1.4;
  padding: 5px 10px; border-radius: 8px; white-space: nowrap;
}
.tank-cap { padding: 12px 0 0; text-align: center; font-size: 13px; color: var(--ink-3); }

/* ---------- 比一比 ---------- */

.compare { margin-top: 44px; }
.compare-card {
  display: grid; grid-template-columns: 1fr auto; gap: 14px 24px; align-items: center;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px;
}
.compare-card h2 { font-size: 20px; }
.compare-card p { color: var(--ink-2); font-size: 14px; }
.cmp-form { display: flex; gap: 8px; }
.cmp-form input {
  width: 120px; height: 40px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--bg);
}
.cmp-out { grid-column: 1 / -1; font-size: 15px !important; color: var(--ink) !important; min-height: 0; }
.cmp-out:empty { display: none; }
.cmp-out b { color: var(--coral-dk); font-size: 1.25em; }

/* ---------- 名册 ---------- */

.roster { margin-top: 44px; }
.roster-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.roster-head h2 { font-family: var(--display); font-size: 26px; letter-spacing: .04em; }
.tabs { display: inline-flex; padding: 3px; border-radius: 999px; background: rgba(15, 47, 57, .06); }
.tabs button {
  height: 32px; padding: 0 14px; border: 0; border-radius: 999px; background: transparent;
  font-size: 13.5px; color: var(--ink-2); cursor: pointer;
}
.tabs button[aria-selected="true"] { background: var(--paper); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.grid { margin-top: 18px; display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.card {
  display: grid; grid-template-columns: 96px 1fr; gap: 4px 14px; text-align: left; width: 100%;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; cursor: pointer; transition: border-color .15s, transform .15s;
}
.card:hover { border-color: var(--sea); transform: translateY(-2px); }
.card canvas { grid-row: 1 / span 3; width: 96px; height: 72px; border-radius: 10px; background: linear-gradient(180deg, #2a9bb4, #0f5d78); }
.card-top { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.card-top b { font-size: 18px; font-variant-numeric: tabular-nums; }
.card-top span { font-size: 12.5px; color: var(--sea); font-weight: 600; }
.card-top .mine { color: var(--coral-dk); }
.card-note {
  font-size: 14px; color: var(--ink-2); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-foot { font-size: 12.5px; color: var(--ink-3); display: flex; gap: 12px; }
.more-row { margin-top: 20px; text-align: center; }
.foot { padding: 46px 0 40px; text-align: center; font-size: 13px; color: var(--ink-3); }

/* ---------- 弹窗 ---------- */

.dlg {
  border: 0; padding: 0; border-radius: 18px; background: var(--paper); color: var(--ink);
  width: min(720px, 100% - 24px); max-height: calc(100dvh - 24px);
  box-shadow: 0 24px 80px rgba(4, 24, 34, .4);
}
.dlg::backdrop { background: rgba(4, 24, 34, .55); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px 8px; }
.dlg-head h2 { font-size: 20px; }
.x { width: 36px; height: 36px; border-radius: 50%; border: 0; background: transparent; font-size: 24px; line-height: 1; color: var(--ink-2); cursor: pointer; }
.x:hover { background: rgba(15, 47, 57, .07); }
.dlg-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 22px 20px; }

.add-body { display: grid; grid-template-columns: 240px 1fr; gap: 20px; padding: 8px 22px; }
.add-preview canvas, #fishCanvas { width: 100%; height: auto; display: block; border-radius: 12px; background: linear-gradient(180deg, #2a9bb4, #0c4c66); }
.add-preview p { margin-top: 8px; text-align: center; font-weight: 700; color: var(--sea); }
.field { display: block; margin-bottom: 12px; }
.field > span, .field > legend { display: flex; justify-content: space-between; font-size: 13.5px; font-weight: 600; margin-bottom: 6px; width: 100%; }
.field em { font-style: normal; font-weight: 400; color: var(--ink-3); }
.field input, .field textarea {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); resize: vertical;
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.chips button {
  height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line);
  background: transparent; font-size: 13px; cursor: pointer;
}
.chips button:hover { border-color: var(--ink-3); }
.chips button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.chips.acts { margin-bottom: 0; }
.form-err { color: #b3402a; font-size: 13.5px; min-height: 1.4em; }

.fish-body { padding: 8px 22px 22px; }
.fish-meta { margin-top: 16px; }
.fish-big b { font-family: var(--display); font-size: 30px; }
.fish-tags { margin-top: 2px; font-size: 13.5px; color: var(--ink-2); }
.fish-meta blockquote { margin-top: 12px; padding-left: 14px; border-left: 3px solid var(--sea); font-size: 16px; overflow-wrap: anywhere; }
.fish-actions { margin-top: 16px; display: flex; gap: 8px; flex-wrap: wrap; }
.fed-hint { margin-top: 8px; font-size: 13px; color: var(--ink-3); }
.btn:disabled { opacity: .55; cursor: default; }
.talk { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }
.talk h3 { font-size: 14px; color: var(--ink-2); }
.talk li { padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 14.5px; overflow-wrap: anywhere; }
.talk li small { display: block; color: var(--ink-3); font-size: 12px; }
.talk .empty { color: var(--ink-3); border: 0; }
.talk-form { display: flex; gap: 8px; margin-top: 12px; }
.talk-form input { flex: 1; min-width: 0; height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 90;
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 14px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .25);
}

/* ---------- 猫 ---------- */

.cat-layer { position: absolute; left: 0; top: 0; width: 0; height: 0; z-index: 20; pointer-events: none; }
html.dive-on .cat-layer { display: none; }
.cat-cv { position: absolute; left: 0; top: 0; pointer-events: none; will-change: transform; }
.cat-hit {
  position: absolute; left: 0; top: 0; pointer-events: auto; cursor: grab; touch-action: none;
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; border-radius: 30%;
}
html.cat-dragging, html.cat-dragging * { cursor: grabbing !important; -webkit-user-select: none !important; user-select: none !important; }

/* ---------- 下潜 ---------- */

html.dive-on, html.dive-on body { height: 100%; overflow: hidden; overscroll-behavior: none; background: #020812; }
html.dive-on main, html.dive-on .foot, html.dive-on .topbar { display: none; }
.dive { position: fixed; inset: 0; z-index: 50; touch-action: none; }
.dive[hidden] { display: none; }
#diveCanvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: crosshair; }
.dive-hud { position: absolute; inset: 0; pointer-events: none; color: #eaf6f8; }
.dive-meter { position: absolute; left: 22px; top: 20px; text-shadow: 0 1px 8px rgba(0, 0, 0, .5); }
.dive-depth b { font-family: var(--display); font-size: 44px; line-height: 1; font-variant-numeric: tabular-nums; }
.dive-depth span { margin-left: 6px; font-size: 14px; opacity: .8; }
.dive-zone { margin-top: 6px; font-size: 15px; font-weight: 600; }
.dive-note { margin-top: 2px; font-size: 13px; opacity: .75; }
.dive-bar { position: absolute; right: 20px; top: 84px; bottom: 40px; width: 2px; background: rgba(255, 255, 255, .18); border-radius: 2px; }
.dive-bar i { position: absolute; left: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--sun); box-shadow: 0 0 10px rgba(255, 211, 77, .8); transform: translateY(-50%); }
.dive-exit {
  position: absolute; right: 18px; top: 18px; pointer-events: auto;
  background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .28); color: #fff;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.dive-exit:hover { background: rgba(255, 255, 255, .22); }
.dive-hint {
  position: absolute; left: 50%; bottom: 26px; transform: translateX(-50%); white-space: nowrap;
  font-size: 13.5px; padding: 8px 16px; border-radius: 999px; background: rgba(2, 10, 20, .5);
  transition: opacity .6s;
}
.dive-hint.gone { opacity: 0; }
.dive-size { margin-top: 6px; font-size: 13px; color: #a0f0b4; }
/* 吞鱼时冒出来的那句话 */
.dive-msg {
  position: absolute; left: 50%; bottom: 26px; transform: translate(-50%, 8px); max-width: min(560px, calc(100% - 48px));
  padding: 9px 18px; border-radius: 16px; background: rgba(2, 10, 20, .78); font-size: 14.5px; line-height: 1.5; text-align: center;
  opacity: 0; transition: opacity .35s, transform .35s; overflow-wrap: anywhere;
}
.dive-msg.show { opacity: 1; transform: translate(-50%, 0); }
/* 今日菜单：这一趟吞过的鱼，点一下看它的故事 */
.dive-menu { position: absolute; left: 22px; bottom: 24px; pointer-events: auto; max-width: 220px; }
.dive-menu[hidden] { display: none; }
.dive-menu p { font-size: 12.5px; opacity: .75; margin-bottom: 6px; }
.dive-menu li + li { margin-top: 4px; }
.dive-menu button {
  display: block; width: 100%; text-align: left; padding: 5px 11px; border-radius: 999px; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, .2); background: rgba(2, 10, 20, .55); color: #eaf6f8; font-size: 12.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dive-menu button:hover { background: rgba(255, 255, 255, .16); }
@media (max-width: 720px) {
  .dive-menu ul { display: none; }           /* 窄屏只留"今日菜单 · N 条"这一行，不挡画面 */
  .dive-menu { bottom: auto; top: 128px; }
}

/* ---------- 顶栏里带图标的按钮 ---------- */

.icon-btn { padding: 0 14px; }
.icon-btn[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }

/* ---------- 老板来了：整屏假文档 ---------- */

html.boss-on, html.boss-on body { overflow: hidden; }
.boss {
  position: fixed; inset: 0; z-index: 200; display: flex; flex-direction: column;
  background: #e9ebef; color: #1f2329;
  font: 13px/1.5 "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}
.boss[hidden] { display: none; }
.boss-top { flex: none; height: 42px; display: flex; align-items: center; gap: 12px; padding: 0 12px; background: #2b579a; color: #fff; }
.boss-close {
  width: 28px; height: 28px; flex: none; border: 0; border-radius: 6px; cursor: pointer;
  background: rgba(255, 255, 255, .16); color: #fff; font-size: 20px; line-height: 1;
}
.boss-close:hover { background: #d9452f; }
.boss-name { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.boss-saved { margin-left: auto; font-size: 12px; opacity: .8; white-space: nowrap; }
.boss-menu { flex: none; display: flex; gap: 2px; padding: 0 8px; height: 30px; align-items: center; background: #f5f6f8; border-bottom: 1px solid #dfe2e6; }
.boss-menu span { padding: 3px 10px; border-radius: 4px; color: #3b4048; }
.boss-tools { flex: none; display: flex; align-items: center; gap: 6px; padding: 0 12px; height: 38px; background: #fbfbfc; border-bottom: 1px solid #dfe2e6; color: #3b4048; overflow: hidden; white-space: nowrap; }
.boss-tools > i { width: 1px; height: 18px; background: #d5d8dd; margin: 0 4px; }
.boss-tools b, .boss-tools em, .boss-tools u, .boss-ico { width: 26px; height: 26px; display: inline-grid; place-items: center; border-radius: 4px; font-size: 14px; }
.boss-tools em { font-family: Georgia, serif; }
.boss-sel { padding: 3px 22px 3px 8px; border: 1px solid #d5d8dd; border-radius: 4px; background: #fff; font-size: 12.5px; }
.boss-desk { flex: 1; overflow: auto; padding: 22px 16px 60px; scrollbar-width: thin; }
.boss-page {
  width: min(794px, 100%); min-height: 1123px; margin: 0 auto; padding: 76px clamp(22px, 9vw, 92px) 90px;
  background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .14);
  font: 16px/2 "SimSun", "Songti SC", "Noto Serif SC", serif; color: #111;
}
.boss-page h1 { font: 700 26px/1.6 "SimHei", "Microsoft YaHei", "PingFang SC", sans-serif; text-align: center; letter-spacing: .04em; margin: 0 0 6px; }
.boss-page h2 { font: 700 17px/2 "SimHei", "Microsoft YaHei", "PingFang SC", sans-serif; margin: 14px 0 2px; }
.boss-page p { margin: 0; text-indent: 2em; text-align: justify; }
.boss-page p.meta { text-indent: 0; text-align: center; font-size: 14px; color: #555; margin-bottom: 18px; }
@keyframes caret { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }
.boss-caret { display: inline-block; width: 1.5px; height: 1.05em; margin-left: 1px; vertical-align: -0.16em; background: #111; animation: caret 1.06s steps(1) infinite; }
.boss-status { flex: none; height: 26px; display: flex; align-items: center; gap: 22px; padding: 0 14px; background: #f5f6f8; border-top: 1px solid #dfe2e6; font-size: 12px; color: #5c636e; white-space: nowrap; overflow: hidden; }
.boss-zoom { margin-left: auto; }

/* ---------- 正经上班鱼：全站一起装正经 ---------- */

html.serious-on {
  --bg: #f2f4f7; --ink: #1c2733; --ink-2: #4a5665; --ink-3: #7b8794; --line: #d8dee6;
  --sea: #2f5fd0; --coral: #2f5fd0; --coral-dk: #2449a8;
  --display: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
}
html.serious-on .hero h1 { font-weight: 700; letter-spacing: .01em; font-size: clamp(28px, 5vw, 46px); }
html.serious-on .eyebrow { letter-spacing: .1em; }
html.serious-on .quote { font-weight: 600; font-size: clamp(15px, 2.2vw, 18px); }
html.serious-on .quote-mark { color: var(--ink-3); }
html.serious-on .topbar { background: rgba(242, 244, 247, .9); }
html.serious-on #tankCanvas { filter: saturate(.5) contrast(.96); }
html.serious-on .card canvas, html.serious-on #fishCanvas, html.serious-on .add-preview canvas { filter: saturate(.5); }

/* ---------- 窄屏 ---------- */

@media (max-width: 860px) {
  .icon-btn { width: 40px; padding: 0; }
  .icon-btn .btn-label, .icon-btn .dive-label { display: none; }
}
@media (max-width: 420px) {
  #bossBtn { display: none; }      /* 手机上没有键盘，也没有老板从背后路过 */
  .top-actions { gap: 6px; }
}

@media (max-width: 720px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stats > div:nth-child(3) { border-left: 0; }
  .stats > div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .compare-card { grid-template-columns: 1fr; }
  .add-body { grid-template-columns: 1fr; }
  .add-preview { max-width: 260px; margin-inline: auto; }
  .hero { padding-top: 36px; }
  .dive-hint { white-space: normal; text-align: center; width: calc(100% - 48px); }
}
@media (max-width: 420px) {
  .topbar .btn { padding: 0 14px; }
  .cmp-form input { flex: 1; width: auto; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .card, .btn { transition: none; }
}
