:root {
  --ink: #020507;
  --fg: #b8c4c8;
  --fg-dim: #75858b;
  --line: rgba(160, 190, 200, 0.14);
  --panel: rgba(6, 12, 15, 0.74);
  --accent: #d8a35a;
  --font: system-ui, -apple-system, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--ink);
  color: var(--fg);
  font: 12px/1.45 var(--font);
}

canvas#pond {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
}

body.idle { cursor: none; }
body.idle .mini, body.idle .gear { opacity: 0 !important; }

button {
  font: inherit;
  color: inherit;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 9px;
  cursor: pointer;
}
button:hover { background: rgba(255, 255, 255, 0.09); }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 1px solid var(--accent); outline-offset: 1px; }

/* ---------------- 左下角的播放／靜音（介面隱藏時仍在，但更淡） */
.mini {
  position: fixed;
  left: max(14px, env(safe-area-inset-left));
  bottom: max(14px, env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 3;
  transition: opacity .4s;
}
.mini .play, .mini .mute {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(6, 12, 15, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  font-size: 13px;
}
.mini .play { width: 40px; height: 40px; font-size: 14px; color: #e3d2b4; border-color: rgba(216, 163, 90, 0.35); }
.mini:not(.playing) .play { box-shadow: 0 0 0 0 rgba(216, 163, 90, 0.35); animation: hint 3.2s ease-in-out 1.5s 3; }
.mini .mute { opacity: .7; }
.mini .mute svg, .mini .play svg { width: 16px; height: 16px; }
.mini .track {
  margin-left: 4px;
  max-width: min(60vw, 420px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--fg-dim);
  font-size: 11.5px;
  letter-spacing: .02em;
  cursor: pointer;
  opacity: .8;
}
.mini .track:hover { color: var(--fg); }
body[data-ui="2"] .mini { opacity: .28; }
body[data-ui="2"] .mini:hover { opacity: 1; }
body[data-ui="2"] .mini .track { display: none; }

@keyframes hint {
  0%, 100% { box-shadow: 0 0 0 0 rgba(216, 163, 90, 0); }
  40% { box-shadow: 0 0 0 7px rgba(216, 163, 90, 0.16); }
}
@media (prefers-reduced-motion: reduce) {
  .mini:not(.playing) .play { animation: none; }
}

/* ---------------- 右上角齒輪與右側面板 */
.gear {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  z-index: 3;
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 50%;
  opacity: .28;
  background: rgba(6, 12, 15, 0.5);
  transition: opacity .3s;
}
.gear:hover { opacity: 1; }

.panel {
  position: fixed;
  top: 10px;
  right: 10px;
  bottom: 10px;
  width: 292px;
  z-index: 4;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .35);
}
.panel[hidden], .gear[hidden] { display: none; }
.panel header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 10px 8px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--fg);
}
.panel header strong { font-weight: 600; letter-spacing: .04em; }
.panel .x { border: 0; background: none; font-size: 18px; line-height: 1; padding: 2px 6px; color: var(--fg-dim); }
.panel .body { overflow-y: auto; padding: 4px 14px 12px; scrollbar-width: thin; }
.panel section { padding: 9px 0 8px; border-bottom: 1px solid var(--line); }
.panel section:last-of-type { border-bottom: 0; }
.panel h3 { margin: 0 0 7px; font-size: 11px; font-weight: 600; color: var(--fg-dim); letter-spacing: .12em; }

.row { display: grid; grid-template-columns: 56px 1fr 66px; align-items: center; gap: 8px; margin: 5px 0; }
.row .lab { color: var(--fg-dim); }
.row .val { text-align: right; font-variant-numeric: tabular-nums; color: var(--fg); }
.row select { grid-column: 2 / 4; }
.row .fixed, .row .seedv { grid-column: 2 / 4; color: var(--fg); font-variant-numeric: tabular-nums; }
.note { color: var(--fg-dim); font-size: 11px; margin: -2px 0 4px 64px; }

input[type=range] { width: 100%; accent-color: var(--accent); height: 16px; margin: 0; }
input[type=range]:disabled { opacity: .35; }
select {
  font: inherit;
  color: var(--fg);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 3px 6px;
}
select option { background: #0b1418; }

.segs { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin-bottom: 6px; }
.segs.kinds { grid-template-columns: repeat(5, 1fr); }
.seg { padding: 4px 0; text-align: center; }
.seg.on { background: rgba(216, 163, 90, 0.18); border-color: rgba(216, 163, 90, 0.5); color: #f1dcb9; }

.btns { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-top: 6px; }
.chk { display: inline-flex; align-items: center; gap: 5px; color: var(--fg); cursor: pointer; }
.chk input { accent-color: var(--accent); margin: 0; }

.readout { white-space: pre-line; font-variant-numeric: tabular-nums; color: var(--fg); line-height: 1.6; }
.keys { color: var(--fg-dim); font-size: 11px; margin: 10px 0 0; line-height: 1.7; }

.nojs { position: fixed; inset: 40% 0 auto; text-align: center; color: var(--fg); }

/* 窄視窗：面板改成底部半高的抽屜，不蓋掉整個池子 */
@media (max-width: 640px) {
  .panel {
    top: auto;
    left: 8px;
    right: 8px;
    bottom: 8px;
    width: auto;
    max-height: 46vh;
  }
  body[data-ui="1"] .mini { bottom: calc(46vh + 18px); }
  .row { grid-template-columns: 56px 1fr 72px; }
}

/* ---------------- 番茄鐘：池子裡的一朵睡蓮（光點與花由池子畫；這裡只有花旁邊的小字與浮出來的按鈕） */
.lotus {
  position: fixed;
  left: var(--x, 80vw);
  top: var(--y, 75vh);
  width: 0;
  height: 0;
  z-index: 3;
}
.lotus .hit {
  position: absolute;
  left: calc(var(--r, 70px) * -1.15);
  top: calc(var(--r, 70px) * -1.15);
  width: calc(var(--r, 70px) * 2.3);
  height: calc(var(--r, 70px) * 2.3);
  border-radius: 50%;
  border: 0;
  background: transparent;
  padding: 0;
}
.lotus .hit:hover { background: radial-gradient(closest-side, rgba(216, 163, 90, 0.07), transparent); }
.lotus .caption {
  position: absolute;
  left: 0;
  top: calc(var(--r, 70px) * 1.22);
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  white-space: nowrap;
  pointer-events: none;
  text-shadow: 0 0 6px #000, 0 0 2px #000;
  opacity: .55;
  transition: opacity .4s;
}
.lotus:hover .caption, .lotus:focus-within .caption, .lotus[data-phase="idle"] .caption { opacity: 1; }
.lotus .phase { color: var(--fg-dim); font-size: 11px; letter-spacing: .12em; }
.lotus .time { font-size: 15px; font-variant-numeric: tabular-nums; letter-spacing: .06em; color: #dfe6e6; }
.lotus[data-phase="focus"] .time { color: #f0cf98; }
.lotus[data-phase="break"] .time, .lotus[data-phase="long"] .time { color: #a8dcbc; }
.lotus .acts {
  position: absolute;
  left: 0;
  top: calc(var(--r, 70px) * 1.22 + 48px); /* 在「專注 25・休息 5」那一行的下面，不壓到數字 */
  transform: translateX(-50%);
  display: flex;
  gap: 5px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s;
}
.lotus:hover .acts, .lotus:focus-within .acts { opacity: 1; pointer-events: auto; }
.lotus .acts button { font-size: 11px; padding: 2px 8px; border-radius: 10px; background: rgba(6, 12, 15, 0.6); }
.lotus .setup {
  position: absolute;
  right: calc(var(--r, 70px) * -1);
  bottom: calc(var(--r, 70px) * 1.3);
  width: 230px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.lotus .setup[hidden] { display: none; }
.lotus .setup label { display: flex; flex-direction: column; gap: 2px; color: var(--fg-dim); font-size: 11px; }
.lotus .setup label.chk { grid-column: 1 / -1; flex-direction: row; align-items: center; gap: 6px; }
.lotus .setup input[type="number"] { width: 100%; font: inherit; color: var(--fg); background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line); border-radius: 5px; padding: 3px 6px; }

/* 還沒開始時：兩個可以直接滑動的數字；花本身也能繞圈轉來調專注時間 */
.lotus .hit { touch-action: none; }
.lotus[data-idle="1"] .time, .lotus:not([data-idle="1"]) .lens { display: none; }
.lotus .lens { color: var(--fg-dim); font-size: 12px; letter-spacing: .08em; pointer-events: auto; }
.lotus .adj {
  display: inline-block; min-width: 1.6em; padding: 4px 3px 1px; text-align: center; font-weight: 500; font-size: 16px;
  font-variant-numeric: tabular-nums; color: #dfe6e6; border-bottom: 1px dotted rgba(223, 230, 230, 0.45);
  cursor: ew-resize; touch-action: none; user-select: none; -webkit-user-select: none; outline: none; transition: color .2s, border-color .2s;
}
.lotus .adj.on, .lotus .adj:focus-visible { color: #f0cf98; border-bottom-color: rgba(216, 163, 90, 0.9); }
/* 花旁邊浮出來的三個動作：只是幾個字，不是一顆顆的鈕 */
.lotus .acts button { background: none; border: 0; color: var(--fg); text-shadow: 0 0 6px #000, 0 0 2px #000; }
.lotus .acts button:hover { color: #f0cf98; background: none; }

/* ---------------- 三條原則：左側三條直書的詩籤 */
.slips {
  position: fixed;
  left: calc(46px + env(safe-area-inset-left));
  bottom: calc(76px + env(safe-area-inset-bottom)); /* 左下角，播放鍵的上方 */
  isolation: isolate;
  display: flex;
  flex-direction: row-reverse; /* 直書由右往左讀：一在最右 */
  gap: 10px;
  z-index: 3;
}
/* 字後面墊一層左右對稱、往外淡出的暗影：魚游到底下時字還讀得清楚 */
.slips::before {
  content: "";
  position: absolute;
  inset: -30px -44px;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 50%, rgba(2, 7, 9, 0.5) 0%, rgba(2, 7, 9, 0.36) 48%, rgba(2, 7, 9, 0) 74%);
}
.slip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 5px 14px;
  min-height: 190px;
  border-left: 1px solid rgba(160, 190, 200, 0.16);
  opacity: .68;
  transition: opacity .5s, border-color .8s, text-shadow .8s;
}
.slip .no { color: var(--accent); font: inherit; font-size: 11px; opacity: .8; background: none; border: 0; padding: 4px 6px; margin: -4px 0; cursor: pointer; }
.slip:first-child .no { opacity: 1; text-shadow: 0 0 8px rgba(216, 163, 90, .6); cursor: default; }
.slip textarea {
  writing-mode: vertical-rl;
  text-orientation: upright;
  resize: none;
  width: 1.7em;
  height: 15em;
  font: inherit;
  font-size: 14px;
  line-height: 1.6;
  letter-spacing: .28em;
  color: #dfe6e6;
  text-shadow: 0 0 4px #000, 0 0 9px rgba(0, 0, 0, 0.9);
  background: transparent;
  border: 0;
  outline: none;
  overflow: hidden;
  text-shadow: 0 0 6px #000;
}
.slip textarea::placeholder { color: var(--fg-dim); opacity: .55; font-size: 12px; letter-spacing: .12em; }
.slip:hover, .slip:focus-within { opacity: 1; border-left-color: rgba(216, 163, 90, 0.5); }
.slips.remind .slip { opacity: 1; border-left-color: rgba(216, 163, 90, 0.75); }
.slips.remind .slip textarea { color: #f6e2bd; text-shadow: 0 0 10px rgba(216, 163, 90, 0.55), 0 0 6px #000; }
body[data-ui="2"] .slips, body[data-ui="2"] .lotus .caption, body[data-ui="2"] .lotus .acts { display: none; }
body.idle .slips { opacity: .75; }
@media (max-width: 600px) {
  .slips { gap: 4px; left: 22px; }
  .slip { min-height: 150px; padding: 8px 2px; }
  .slip textarea { font-size: 12.5px; height: 13em; }
}
.mini .net { color: var(--fg-dim); font-size: 11px; margin-left: 6px; opacity: .8; }
.note.geo { margin: 0 0 4px 0; }

/* ---------------- 說句話：浮在魚上面的泡泡與左下角的輸入框 */
.says { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 2; }
.says { transition: opacity 1.4s ease; }
.says.quiet { opacity: 0; }
.bubble {
  position: absolute;
  left: 0;
  top: 0;
  max-width: min(46vw, 260px);
  padding: 4px 9px 5px;
  border-radius: 11px;
  background: rgba(12, 18, 26, 0.72);
  border: 1px solid rgba(190, 210, 225, 0.2);
  color: #d5dde2;
  font-size: 13px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  will-change: transform;
  animation: bubble-in .35s ease-out;
}
.bubble.mine { border-color: rgba(216, 163, 90, 0.45); color: #ecdcc0; }
@keyframes bubble-in { from { opacity: 0; } to { opacity: 1; } }
.mini .say {
  width: 150px;
  height: 30px;
  margin-left: 6px;
  padding: 0 10px;
  font: inherit;
  font-size: 13px;
  color: var(--fg);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 15px;
  outline: none;
  opacity: .6;
  transition: opacity .2s, width .2s;
}
.mini .say:focus { opacity: 1; width: min(52vw, 300px); border-color: rgba(216, 163, 90, 0.45); }
.mini .say::placeholder { color: var(--fg-dim); }
.mini .say[hidden], body[data-ui="2"] .mini .say { display: none; }
.bubble b { font-weight: 600; color: #9fb4c0; margin-right: 6px; }
.bubble.mine b { color: #d8a35a; }
.bubble.bare { padding: 2px 7px 3px; font-size: 11.5px; background: rgba(12, 18, 26, 0.5); border-color: transparent; }
.bubble.bare b { margin-right: 0; }
.bubble b:empty { display: none; }
.mini .say.name { width: 76px; }
.mini .say.name:focus { width: 120px; }
.mini .say:disabled { opacity: .45; }
/* 泡泡改成兩行：小字的名字在上、狀態在下，窄一點才不會互相蓋住 */
.bubble { display: flex; flex-direction: column; align-items: center; max-width: 170px; padding: 3px 9px 4px; line-height: 1.25; }
.bubble b { margin-right: 0; font-size: 10.5px; font-weight: 500; opacity: .85; }
.bubble span:empty { display: none; }

/* 深夜三點才出現的一句話 */
.nightnote {
  position: fixed;
  left: 50%;
  bottom: calc(64px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  font-size: 13px;
  letter-spacing: 0.3em;
  color: rgba(214, 224, 236, 0.5);
  opacity: 0;
  transition: opacity 4s ease;
  pointer-events: none;
  white-space: nowrap;
}
.nightnote.on {
  opacity: 1;
}
/* 一輪專注做完：自己的魚說「喝口水吧」。小小的對話框跟著魚，點一下才消失 */
.bubble.drink {
  position: fixed; z-index: 4; overflow: visible; font-family: inherit; letter-spacing: .12em; padding: 5px 11px 6px;
  background: rgba(12, 18, 26, 0.82); border-color: rgba(216, 163, 90, 0.45); color: #ecdcc0;
  opacity: 0; pointer-events: none; animation: none; transition: opacity .6s ease;
  -webkit-tap-highlight-color: transparent;
}
.bubble.drink:hover { background: rgba(12, 18, 26, 0.82); }
.bubble.drink.on { opacity: 1; pointer-events: auto; cursor: pointer; }
.bubble.drink.away { opacity: 0; pointer-events: none; }
/* 對話框底下的小尖角，指向魚 */
.bubble.drink::after {
  content: ""; position: absolute; left: 50%; bottom: -5px; width: 8px; height: 8px; transform: translateX(-50%) rotate(45deg);
  background: rgba(12, 18, 26, 0.82); border-right: 1px solid rgba(216, 163, 90, 0.45); border-bottom: 1px solid rgba(216, 163, 90, 0.45);
}
/* 看得見的框很小，能點的範圍往外多留一圈（至少 44 高） */
.bubble.drink::before { content: ""; position: absolute; inset: -10px -8px -12px; }

/* ---------------- 三個願（左側三條直書的詩籤，程式裡叫 slips／rules）可以收起來：播放鍵上方一個小小的「願」，點一下展開、再點一下收起。
   提醒的時候（番茄鐘換段）就算收著也會浮出來。 */
.slips { transition: opacity .5s, transform .5s; }
.slips-tab {
  position: fixed; left: calc(46px + env(safe-area-inset-left)); bottom: calc(54px + env(safe-area-inset-bottom)); z-index: 3;
  padding: 2px 4px; border: 0; background: none; color: var(--accent); font-size: 11px; letter-spacing: 0;
  -webkit-tap-highlight-color: transparent;
  opacity: .5; text-shadow: 0 0 6px #000, 0 0 2px #000; transition: opacity .3s;
}
.slips-tab:hover { opacity: 1; background: none; } /* 手機點過之後 hover 會黏著，不要留一塊灰底 */
.slip textarea { text-shadow: 0 0 6px #000, 0 0 2px #000; }
body.slips-off .slips:not(.remind) { opacity: 0; transform: translateY(10px); pointer-events: none; }
body[data-ui="2"] .slips-tab, body.idle .slips-tab { opacity: 0; pointer-events: none; }

/* ---------------- 直式手機：整個畫面留給池子，能按的東西都收到拇指碰得到的底部一列
   左邊播放與靜音、右邊「我的魚」與設定；名字與狀態平常收起來，按「我的魚」才在上方展開（鍵盤不會蓋到）。 */
.mini .me { display: none; }
@media (max-width: 640px) and (orientation: portrait) {
  .mini { left: max(16px, env(safe-area-inset-left)); bottom: max(16px, env(safe-area-inset-bottom)); gap: 10px; }
  .mini .play { width: 48px; height: 48px; }
  .mini .play svg { width: 18px; height: 18px; }
  .mini .mute, .mini .me, .gear { width: 44px; height: 44px; opacity: .6; }
  /* 融進水面：不要底色、外框與毛玻璃，只留圖示本身和一圈暗影讓它在亮的水面上也看得見 */
  .mini .play, .mini .mute, .mini .me, .gear {
    background: none !important; border-color: transparent; backdrop-filter: none; -webkit-backdrop-filter: none;
    filter: drop-shadow(0 0 3px rgba(0, 0, 0, .9)); text-shadow: none; color: #e9eff0; opacity: .78;
  }
  .mini .play { opacity: .95; color: #f1dcb9; }
  .mini .me { font-size: 17px; }
  .slips-tab { opacity: .75; }
  /* 「願」對齊正下方的播放鍵（兩個的中心在同一條直線上） */
  .slips-tab { left: calc(max(16px, env(safe-area-inset-left)) + 2px); bottom: calc(max(16px, env(safe-area-inset-bottom)) + 60px); font-size: 12px; }
  body[data-ui="1"] .slips-tab { display: none; }
  .mini .mute svg { width: 18px; height: 18px; }
  .mini .track { display: none; }
  .gear { top: auto; bottom: max(18px, calc(env(safe-area-inset-bottom) + 2px)); right: max(16px, env(safe-area-inset-right)); font-size: 18px; }
  .mini:has(.say:not([hidden])) .me {
    display: grid; place-items: center; position: fixed; padding: 0; border-radius: 50%;
    bottom: max(18px, calc(env(safe-area-inset-bottom) + 2px)); right: calc(max(16px, env(safe-area-inset-right)) + 62px);
    background: rgba(6, 12, 15, 0.5); font-size: 15px; color: var(--fg);
  }
  .mini .net { position: fixed; top: max(14px, env(safe-area-inset-top)); left: 0; right: 0; margin: 0; text-align: center; pointer-events: none; }
  /* 名字與狀態：收起來時不佔畫面 */
  .mini .say { display: none; }
  body.me-open .mini .say:not([hidden]) {
    display: block; position: fixed; left: 28px; right: 28px; width: auto; height: 48px; margin: 0; padding: 0 16px;
    top: calc(max(14px, env(safe-area-inset-top)) + 70px); border-radius: 12px; opacity: 1; z-index: 6;
    background: rgba(255, 255, 255, 0.06);
  }
  body.me-open .mini .say.name:not([hidden]) { top: calc(max(14px, env(safe-area-inset-top)) + 14px); width: auto; }
  body.me-open .mini .say:focus { width: auto; }
  body.me-open .mini::before {
    content: ""; position: fixed; left: 14px; right: 14px; top: max(14px, env(safe-area-inset-top)); height: 132px;
    border-radius: 16px; background: rgba(6, 12, 15, 0.92); z-index: 5;
  }
  body.me-open .gear, body[data-ui="1"] .mini .me { display: none; }
  /* 詩籤靠左、讓出底部那一列 */
  .slips { left: max(20px, env(safe-area-inset-left)); bottom: calc(max(16px, env(safe-area-inset-bottom)) + 96px); gap: 2px; }
  .slips::before { inset: -18px -22px; }
  .slip { min-height: 200px; padding: 8px 4px; }
  .slip textarea { font-size: 14px; height: 12.6em; }
  .slip textarea::placeholder { font-size: 13px; letter-spacing: .06em; }
  /* 沒寫的詩籤只留編號，第一條才提示怎麼用 */
  .slip:not(:first-child) textarea::placeholder { opacity: 0; }
  .slip textarea::placeholder { color: #c9d4d6; opacity: .7; }
  /* 番茄鐘的三顆按鈕與時間設定放大到好按 */
  .lotus .phase { font-size: 12px; }
  .lotus .time { font-size: 20px; }
  .lotus .acts { top: auto; bottom: calc(var(--r, 70px) * 1.25); gap: 8px; }
  /* 詩籤展開（或被提醒亮出來）時，三顆按鈕往右讓開，不壓在第一條詩籤上 */
  body:not(.slips-off) .lotus .acts, body:has(.slips.remind) .lotus .acts { transform: translateX(calc(-50% + 56px)); }
  .lotus .acts button { font-size: 14px; padding: 10px 12px; }
  .lotus .lens { font-size: 12px; letter-spacing: 0; }
  .lotus .adj { font-size: 20px; padding: 8px 3px 2px; min-width: 1.7em; }
  .lotus .setup { position: fixed; left: 14px; right: 14px; bottom: auto; top: max(14px, env(safe-area-inset-top)); width: auto; padding: 16px; gap: 12px; border-radius: 16px; background: rgba(6, 12, 15, 0.92); backdrop-filter: none; -webkit-backdrop-filter: none; }
  .lotus .setup label { font-size: 13px; gap: 5px; }
  .lotus .setup input[type="number"] { height: 44px; border-radius: 10px; padding: 0 12px; }
  .lotus .setup label.chk { font-size: 14px; min-height: 44px; }
  /* 設定面板：貼著底邊的抽屜，字與按鈕都放大 */
  .panel { left: 0; right: 0; bottom: 0; max-height: 62vh; border-radius: 18px 18px 0 0; border-width: 1px 0 0; font-size: 15px; background: rgba(6, 12, 15, 0.94); backdrop-filter: none; -webkit-backdrop-filter: none; box-shadow: none; padding-bottom: env(safe-area-inset-bottom); }
  .panel header { padding: 14px 10px 12px 20px; font-size: 16px; }
  .panel .x { font-size: 26px; width: 44px; height: 44px; }
  .panel .body { padding: 4px 20px 20px; }
  .panel section { padding: 16px 0 14px; }
  .panel h3 { font-size: 13px; margin-bottom: 12px; }
  .panel button, .panel select { min-height: 44px; font-size: 15px; border-radius: 10px; }
  .segs, .segs.kinds { grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
  .row { grid-template-columns: 64px 1fr 78px; gap: 12px; margin: 4px 0; min-height: 44px; }
  .note { font-size: 13px; margin: 2px 0 10px; }
  .btns { gap: 10px 16px; margin-top: 10px; }
  .chk { min-height: 44px; gap: 10px; }
  .chk input { width: 20px; height: 20px; }
  input[type=range] { height: 32px; }
  .keys { display: none; }
  body[data-ui="1"] .mini { bottom: calc(62vh + 14px); }
  body[data-ui="1"] .slips, body[data-ui="1"] .lotus { display: none; }
  .nightnote { bottom: auto; top: calc(max(14px, env(safe-area-inset-top)) + 40px); }
}

/* 觸控裝置：輸入框字級不到 16px，iOS 一點進去就會把整頁放大而且縮不回來 */
@media (pointer: coarse) {
  .mini .say, .panel input, .panel select, .lotus .setup input { font-size: 16px; }
}

/* ---------------- 池畔：角落一片固定的荷葉（畫在池子裡），點它展開一塊邊緣化開的暗影，字浮在水面上，沒有框。
   所有設定都在裡面，一次展開一段。 */
.pad-btn {
  position: fixed; top: max(14px, env(safe-area-inset-top)); right: max(14px, env(safe-area-inset-right)); z-index: 7;
  width: 64px; height: 64px; padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer;
}
.pad-btn:focus-visible { outline: 1px solid var(--accent); outline-offset: -6px; }
body[data-ui="2"] .pad-btn { pointer-events: none; }
.book {
  position: fixed; right: calc(34px + env(safe-area-inset-right)); top: calc(124px + env(safe-area-inset-top)); z-index: 6;
  width: min(300px, calc(100vw - 68px)); max-height: calc(100vh - 260px); overflow-y: auto; scrollbar-width: none;
  padding: 6px 4px 6px 18px; color: var(--fg); font-size: 13px; line-height: 1.7;
  background: rgba(4, 10, 13, 0.82); border-radius: 20px; box-shadow: 0 0 26px 26px rgba(4, 10, 13, 0.82);
}
.book::-webkit-scrollbar { display: none; }
.book[hidden], .book-box[hidden] { display: none; }
.book button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
.book .book-head { display: block; width: 100%; min-height: 34px; text-align: left; font-size: 12px; letter-spacing: .3em; color: var(--accent); opacity: .6; transition: opacity .2s; }
.book .book-head:hover, .book .book-head.on { opacity: 1; }
.book-box { padding: 0 0 12px; }
.book .hint { margin: 0 0 8px; font-size: 12px; opacity: .55; }
.koi-item { position: relative; display: flex; width: 100%; min-height: 34px; align-items: center; gap: 10px; text-align: left; opacity: .85; }
/* 選中的圓點放在文字左邊的留白裡，文字本身跟標題齊左 */
.koi-item::before { content: ""; position: absolute; left: -13px; top: 50%; width: 5px; height: 5px; margin-top: -2.5px; border-radius: 50%; background: transparent; }
.koi-item.on { opacity: 1; color: #f1dcb9; }
.koi-item.on::before { background: #f1dcb9; }
.koi-item.locked { opacity: .38; }
.koi-item small { font-size: 11px; letter-spacing: .05em; }
.koi-item:not(.locked):hover { opacity: 1; }
/* 可以拖的數字 */
.scrub { display: flex; align-items: center; justify-content: space-between; min-height: 34px; opacity: .9; }
.scrub .adj { min-width: 3em; padding: 4px 0 4px 12px; text-align: right; font-weight: 400; font-variant-numeric: tabular-nums; color: #f1dcb9; cursor: ew-resize; touch-action: none; user-select: none; -webkit-user-select: none; border-bottom: 1px dotted rgba(241, 220, 185, .35); }
.choose { margin: 4px 0; }
@media (max-width: 640px) and (orientation: portrait) {
  .pad-btn { top: auto; bottom: max(8px, calc(env(safe-area-inset-bottom) - 6px)); right: max(6px, env(safe-area-inset-right)); }
  .book { top: auto; left: 34px; right: 34px; width: auto; bottom: calc(max(16px, env(safe-area-inset-bottom)) + 128px); max-height: calc(100vh - 260px); font-size: 15px; }
  .koi-item, .scrub, .book .book-head { min-height: 44px; }
  .book .book-head { font-size: 13px; }
  body.book-open .slips { opacity: 0; pointer-events: none; }
  body[data-ui="1"] .pad-btn { display: none; }
}
/* 測試面板的齒輪只在網址帶 dev=1 時出現（按 O 也能開） */
body:not(.dev) .gear { display: none !important; }
body.dev .pad-btn { top: 70px; }

/* ---------------- 別人的原則：掛在魚身邊的幾條直書詩籤，一條一條垂下來，幾秒後淡掉 */
.goal { position: absolute; left: 0; top: 0; pointer-events: none; transition: opacity .9s ease; will-change: transform; }
.goal.out { opacity: 0; }
.goal b { display: block; margin: 0 0 6px 2px; font-size: 11px; font-weight: 400; letter-spacing: .2em; color: var(--accent); text-shadow: 0 0 6px #000, 0 0 2px #000; animation: goal-in .6s ease both; }
.goal div { display: flex; flex-direction: row-reverse; justify-content: flex-end; gap: 12px; }
.goal span {
  writing-mode: vertical-rl; max-height: 15em; padding-top: 9px; font-size: 14px; letter-spacing: .22em; line-height: 1.3; color: #f6e2bd;
  border-top: 1px solid rgba(216, 163, 90, .7); text-shadow: 0 0 8px #000, 0 0 3px #000, 0 0 14px rgba(216, 163, 90, .25);
  animation: goal-in .9s cubic-bezier(.2, .7, .2, 1) both;
}
@keyframes goal-in { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .goal b, .goal span { animation: none; } }

/* 日子：七欄的點陣，一天一個點（今天在右下角） */
.book .days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; max-width: 250px; }
.book .day { display: grid; place-items: center; aspect-ratio: 1; min-height: 30px; }
.book .day i { width: 22px; height: 22px; border-radius: 50%; background: #5fae6a; transform: scale(var(--s)); opacity: .85; transition: transform .3s; }
.book .day i.bloom { background: radial-gradient(circle, #f3b6cf 0 32%, #5fae6a 36%); }
.book .day.on i { box-shadow: 0 0 0 2px #04090c, 0 0 0 3px #f1dcb9; }
.book .day.locked i { opacity: .25; }
.book .day-note { margin: 6px 0 4px; opacity: .8; }

/* 池畔裡唯一的輸入框（邀請碼）：一條底線，沒有框 */
.book-input { width: 100%; min-height: 34px; margin: 4px 0; padding: 0; font: inherit; font-size: 16px; letter-spacing: .2em; color: var(--fg); background: none; border: 0; border-bottom: 1px dotted rgba(241, 220, 185, .35); border-radius: 0; outline: none; }
.book-input::placeholder { font-size: 12px; letter-spacing: .1em; color: var(--fg); opacity: .4; }
.book-input:focus { border-bottom-color: var(--accent); }
.book .pass-head { margin: 0 0 8px; opacity: .85; }

/* 名字與狀態只在魚游到身邊時出現：淡淡地浮出來 */
.says > :not(.goal) { animation: say-in .8s ease both; }
@keyframes say-in { from { opacity: 0; } }

/* 名字與狀態消失時也是淡出；池畔展開時淡入 */
.says > .out { opacity: 0 !important; transition: opacity .8s ease; }
.book:not([hidden]) { animation: say-in .35s ease both; }

.koi-item.sub { padding-left: 14px; font-size: .92em; color: var(--accent); }

/* 手機直式的點擊區：每個可點的東西至少 44×44，彼此不貼在一起 */
@media (max-width: 640px) and (orientation: portrait) {
  /* 「魚」原本夾在休息的數字和荷葉中間，容易按錯；改疊在荷葉正上方，右手拇指一條線 */
  .mini:has(.say:not([hidden])) .me {
    right: max(16px, calc(env(safe-area-inset-right) + 10px));
    bottom: calc(max(8px, calc(env(safe-area-inset-bottom) - 6px)) + 68px);
  }
  .lotus .adj { min-width: 44px; min-height: 44px; }
  .lotus .acts button { padding: 13px 12px; }
  .slips-tab { padding: 0; width: 44px; height: 44px; }
  .slip .no { padding: 10px 5px; margin: -6px 0 0; min-width: 33px; }
  /* 左邊的「願」和右邊的「魚」是一對，字一樣大 */
  .slips-tab, .mini .me, .mini:has(.say:not([hidden])) .me { font-size: 13px; }
}

/* 橫放的手機與平板（用手指點）：同樣把點擊區放大到 44 */
@media (pointer: coarse) and (orientation: landscape) {
  .mini .play, .mini .mute { width: 44px; height: 44px; }
  .mini .say { min-height: 44px; }
  .lotus .adj { min-width: 44px; min-height: 44px; }
  .slips-tab { padding: 0; width: 44px; height: 44px; }
  .slip .no { padding: 10px 5px; margin: -6px 0 0; min-width: 33px; }
}

/* 池畔裡被收起來的項目（例如不播曲子時的「換下一首」） */
.book .koi-item[hidden] { display: none; }

/* ================= 正典：設定與輸入（規則見 css/AGENTS.md）=================
   字浮在水面上，底下只有一片邊緣化開的暗影；沒有卡片、沒有框、沒有填色的欄位。
   值與選中的東西用米金色；能改的值底下一條虛線，正在改的那一條變實線。 */
:root {
  --ui-value: #f1dcb9;
  --ui-under: rgba(241, 220, 185, .35);
  --ui-veil: rgba(4, 10, 13, 0.82);
  --ui-label: 12px;
  --ui-row: 34px;
}
@media (pointer: coarse) { :root { --ui-row: 44px; --ui-label: 13px; } }

/* 文字欄位：唯一的寫法 */
.mini .say, .book-input, .lotus .setup input[type="number"] {
  height: auto; min-height: var(--ui-row); padding: 0; margin: 0;
  font: inherit; font-size: 14px; letter-spacing: .04em; color: var(--ui-value);
  background: none; border: 0; border-bottom: 1px dotted var(--ui-under); border-radius: 0;
  outline: none; opacity: 1; text-shadow: 0 0 6px #000, 0 0 2px #000;
}
.mini .say:focus, .book-input:focus, .lotus .setup input[type="number"]:focus { border-bottom: 1px solid var(--accent); outline: none; }
.mini .say::placeholder, .book-input::placeholder { font-size: 12px; letter-spacing: .06em; color: var(--fg); opacity: .55; }
.mini .say:disabled { color: var(--fg); opacity: .7; border-bottom-color: transparent; }
@media (pointer: coarse) { .mini .say, .book-input, .lotus .setup input[type="number"] { font-size: 16px; } }

/* 欄位的名字：跟池畔的段落標題同一個樣子 */
.field > span, .lotus .setup label { font-size: var(--ui-label); letter-spacing: .3em; color: var(--accent); opacity: .7; }

/* 名字與狀態（桌機）：一列兩條底線，名字就是提示字 */
.mini .mine { display: contents; }
.field { display: contents; }
.field > span { display: none; }
.mini .say { width: 150px; margin-left: 10px; }
.mini .say.name { width: 76px; }

/* 番茄鐘的「更多」：一行一項，名字在左、數字在右 */
.lotus .setup {
  display: block; width: 210px; padding: 6px 4px 6px 18px;
  border: 0; border-radius: 20px; background: var(--ui-veil); box-shadow: 0 0 26px 26px var(--ui-veil);
  backdrop-filter: none; -webkit-backdrop-filter: none;
}
.lotus .setup label { display: flex; flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; min-height: var(--ui-row); letter-spacing: .08em; color: var(--fg); opacity: .9; font-size: 13px; }
.lotus .setup input[type="number"] { width: 3.2em; text-align: right; font-variant-numeric: tabular-nums; letter-spacing: 0; -moz-appearance: textfield; appearance: textfield; }
.lotus .setup input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; }
/* 開關是一行字：開著的前面有一顆米金色的點 */
.lotus .setup label.chk { position: relative; justify-content: flex-start; gap: 0; cursor: pointer; }
.lotus .setup label.chk input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.lotus .setup label.chk::before { content: ""; position: absolute; left: -13px; top: 50%; width: 5px; height: 5px; margin-top: -2.5px; border-radius: 50%; }
.lotus .setup label.chk:has(input:checked) { color: var(--ui-value); opacity: 1; }
.lotus .setup label.chk:has(input:checked)::before { background: var(--ui-value); }
.lotus .setup label.chk:has(input:focus-visible) { text-decoration: underline dotted; }

@media (max-width: 640px) and (orientation: portrait) {
  /* 手機：按「魚」展開，跟池畔同一片暗影，兩個欄位上下排 */
  .mini .mine { display: none; }
  body.me-open .mini .mine {
    display: block; position: fixed; z-index: 6; left: 34px; right: 34px; top: calc(max(14px, env(safe-area-inset-top)) + 30px);
    padding: 6px 4px 10px 18px; border-radius: 20px; background: var(--ui-veil); box-shadow: 0 0 26px 26px var(--ui-veil);
    animation: say-in .35s ease both;
  }
  body.me-open .mini::before { content: none; }
  body.me-open .field { display: block; padding: 6px 0 8px; }
  body.me-open .field > span { display: block; }
  body.me-open .mini .say:not([hidden]), body.me-open .mini .say.name:not([hidden]) {
    display: block; position: static; width: 100%; height: auto; margin: 0; padding: 0; border-radius: 0; background: none;
  }
  body.me-open .field:has(input[hidden]) { display: none; }
  body.me-open .mini .say::placeholder { color: var(--fg); opacity: .45; }
  body.me-open .field:has(input:disabled)::after { content: "今天已經換過了，明天再換"; display: block; margin-top: 4px; font-size: 12px; color: var(--fg); opacity: .6; }
  body.me-open .field input.name::placeholder { color: transparent; }
  .lotus .setup { left: 34px; right: 34px; top: calc(max(14px, env(safe-area-inset-top)) + 30px); width: auto; padding: 6px 4px 6px 18px; border-radius: 20px; background: var(--ui-veil); }
  .lotus .setup label, .lotus .setup label.chk { font-size: 15px; min-height: 44px; }
  .lotus .setup input[type="number"] { height: auto; padding: 0; border-radius: 0; }
}

/* 橫放的矮螢幕（手機橫式）：番茄鐘底下放不下三顆按鈕，改放到花的上方；時間設定的面板往左一點，不壓到右上角的池畔圓鈕 */
@media (orientation: landscape) and (max-height: 500px) {
  .lotus .acts { top: auto; bottom: calc(var(--r, 70px) * 1.25); }
  .lotus .setup { right: calc(var(--r, 70px) * -1 + 16px); bottom: calc(var(--r, 70px) * 1.25 + 34px); }
}
