:root {
  --bg: #0d1520;
  --panel: rgba(14, 24, 36, 0.88);
  --line: rgba(160, 210, 255, 0.22);
  --text: #e8f2fb;
  --muted: #93a9bd;
  --accent: #4fc3ff;
  --good: #5be39a;
  --bad: #ff6b7d;
  --C: #9aa7b3;
  --R: #4f9dff;
  --SR: #c77dff;
  --game-right: 0px; /* AI ログを開いている間、その幅だけゲーム画面を狭める */
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  background: radial-gradient(ellipse at 50% 35%, #1d3550 0%, #101b29 55%, #0a1018 100%);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", "Hiragino Sans", "Yu Gothic UI", sans-serif;
  -webkit-tap-highlight-color: transparent;
}
#c { position: fixed; top: 0; left: 0; bottom: 0; right: var(--game-right); width: calc(100% - var(--game-right)); height: 100%; touch-action: none; display: block; }
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }

/* HUD */
#hud {
  position: fixed; top: 12px; left: 12px; width: min(320px, calc(100vw - 24px));
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px;
  backdrop-filter: blur(6px);
}
.who { display: flex; gap: 10px; align-items: center; }
#fname { font-weight: 700; font-size: 16px; }
#ftitle { font-size: 12px; color: var(--muted); }
.rarity { font-weight: 800; font-size: 12px; padding: 3px 8px; border-radius: 6px; background: var(--C); color: #0b1118; }
.rarity.R { background: var(--R); }
.rarity.SR { background: linear-gradient(135deg, #c77dff, #ffd36b); }
.rarity.SSR { background: linear-gradient(135deg, #fff1a8, #f2b632 45%, #ff8a3d); color: #3a2205; box-shadow: 0 0 10px rgba(255, 200, 80, .5); }
.rarity.big { font-size: 18px; padding: 4px 14px; display: inline-block; }
.row { margin-top: 6px; font-size: 13px; color: var(--muted); }
.aff { position: relative; margin-top: 6px; }
.aff-label { font-size: 12px; color: var(--muted); }
.aff-label b { color: var(--text); font-size: 15px; }
.bar { position: relative; height: 10px; border-radius: 5px; background: rgba(255,255,255,.1); margin-top: 4px; overflow: visible; }
#afffill { height: 100%; width: 20%; border-radius: 5px; background: linear-gradient(90deg, #ff8fb1, #ff4f8b); transition: width .6s cubic-bezier(.2,.9,.3,1.2); }
#hud.danger { border-color: rgba(255, 90, 90, .7); }
#hud.danger #afffill { background: #ff4d4d; animation: danger .8s ease-in-out infinite; }
#hud.danger .aff-label b { color: #ff6b6b; }
@keyframes danger { 50% { opacity: .35; } }
.mark { position: absolute; left: 50%; top: -3px; bottom: -3px; width: 2px; background: #ffe07a; }
.mark span { position: absolute; top: 14px; left: -18px; font-size: 10px; color: #ffe07a; white-space: nowrap; }
#delta { position: absolute; right: 0; top: -12px; font-weight: 800; font-size: 22px; line-height: 1.1; opacity: 0; pointer-events: none; text-align: right; text-shadow: 0 1px 4px rgba(0,0,0,.8); }
#delta.show { animation: pop 2.6s ease-out; }
#delta small { display: block; font-size: 12px; font-weight: 700; margin-top: 2px; padding: 2px 6px; border-radius: 6px; background: rgba(10,18,28,.85); }
@keyframes pop { 0% { opacity: 0; transform: translateY(6px); } 10% { opacity: 1; transform: none; } 80% { opacity: 1; } 100% { opacity: 0; transform: translateY(-8px); } }

#mode-tag { position: fixed; top: 12px; right: calc(var(--game-right) + 56px); font-size: 11px; padding: 4px 8px; border-radius: 6px; background: rgba(255,200,80,.15); color: #ffd36b; border: 1px solid rgba(255,200,80,.4); }

/* AI ログ（?debug のときだけ。本体は ai-log-view.js が作る） */
#debugbar { position: fixed; top: 12px; right: calc(var(--game-right) + 56px); z-index: 5; display: flex; gap: 6px; }
#debugbar button, #debugbar a { font-size: 12px; padding: 5px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--text); text-decoration: none; }
#debugbar button:disabled { opacity: .5; cursor: default; }
#mode-tag:has(~ #debugbar:not([hidden])) { top: 48px; }

/* 魚一覧: 左にリスト、右に選んだ魚の詳細 */
#fishlist, #zukan, #ranking { z-index: 15; }
.fl-panel { width: min(1100px, 100%); height: calc(100vh - 32px); display: flex; flex-direction: column; background: #0f1823; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.fl-panel header { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); flex: none; }
.fl-sub { color: var(--muted); font-size: 12px; }
.fl-close, .fl-back { margin-left: auto; font-size: 13px; padding: 4px 12px; border-radius: 8px; border: 1px solid var(--line); background: none; }
.fl-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 290px 1fr; }
.fl-side { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); }
.fl-filter { padding: 10px; display: grid; gap: 8px; border-bottom: 1px solid var(--line); }
.fl-search { width: 100%; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--line); background: rgba(0,0,0,.25); color: var(--text); font-size: 13px; }
.fl-search:focus { outline: none; border-color: var(--accent); }
.fl-rarity { display: flex; gap: 6px; flex-wrap: wrap; }
.fl-rarity button { font-size: 11px; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--line); background: none; color: var(--muted); }
.fl-rarity button.on { color: var(--text); border-color: var(--accent); background: rgba(79,195,255,.12); }
.fl-list { flex: 1; overflow-y: auto; outline: none; }
.fl-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.fl-row:hover { background: rgba(255,255,255,.04); }
.fl-row.sel { background: rgba(79,195,255,.1); box-shadow: inset 3px 0 0 var(--accent); }
.fl-row canvas { width: 38px; height: 38px; border-radius: 50%; flex: none; }
.fl-row .n { flex: 1; min-width: 0; }
.fl-row .n b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fl-row .n small { display: block; color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fl-row .r { color: var(--muted); font-size: 11px; text-align: right; }
.fl-empty { padding: 16px; color: var(--muted); font-size: 13px; }
.fl-detail { overflow-y: auto; padding: 18px 22px; font-size: 13px; line-height: 1.6; display: flex; flex-direction: column; gap: 10px; }
.fl-head { display: flex; gap: 14px; align-items: center; }
.fl-head canvas { width: 96px; height: 96px; border-radius: 50%; flex: none; border: 2px solid var(--line); }
.fl-name { font-size: 20px; font-weight: 800; }
.fl-title { color: var(--muted); font-size: 12px; }
.fl-stats { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); font-size: 12px; }
.fl-stats b { color: var(--text); font-weight: 600; }
.zk-idhint { color: var(--muted); font-size: 11px; } /* 図鑑: ?fish=<id> の案内 */
.fl-rate { color: var(--muted); font-size: 12px; } /* 魚一覧: 直近のプレイログからの釣れた率 */
.fl-h { margin: 6px 0 0; font-size: 12px; color: var(--muted); font-weight: 600; letter-spacing: .05em; }
.zk-group { margin: 14px 0 2px; font-size: 13px; color: var(--text); font-weight: 700; } /* 図鑑: 好き嫌いの段の見出し（人格 / 壁の前後） */
.fl-h.zk-sub { margin-top: 4px; padding-left: 10px; }
.fl-persona { color: #c9d8e6; }
.fl-gate { padding: 6px 10px; border-radius: 8px; background: rgba(199,125,255,.12); border: 1px solid rgba(199,125,255,.35); font-size: 12px; }
.fl-parts { width: 100%; border-collapse: collapse; font-size: 12px; }
.fl-parts td { padding: 5px 6px; border-top: 1px solid var(--line); vertical-align: top; }
.fl-parts td:first-child { white-space: nowrap; font-weight: 600; }
.fl-parts .secret { color: var(--muted); }
.trait { display: inline-block; padding: 0 6px; border-radius: 4px; font-size: 11px; white-space: nowrap; background: rgba(255,255,255,.08); color: var(--muted); }
.trait.proud { background: rgba(255,211,107,.18); color: #ffd36b; }
.trait.complex { background: rgba(255,107,125,.18); color: #ff8b98; }
.trait.jaded { background: rgba(150,170,190,.2); color: #b8c7d6; }
.trait.hidden { background: rgba(79,195,255,.18); color: var(--accent); margin-left: 3px; }
.fl-detail .primary { margin-top: 8px; max-width: 320px; padding: 10px; font-size: 14px; }
.fl-back { display: none; margin-left: 0; align-self: flex-start; }
/* 狭い画面: リストと詳細を切り替える */
@media (max-width: 700px) {
  .fl-body { grid-template-columns: 1fr; }
  .fl-side { border-right: 0; }
  .fl-body.detail .fl-side { display: none; }
  .fl-body:not(.detail) .fl-detail { display: none; }
  .fl-back { display: inline-block; }
}
aside.ailog { --card: #1c2a3a; position: fixed; top: 0; right: 0; bottom: 0; z-index: 20; background: #0f1823; }

/* 吹き出し */
#bubble {
  /* width: max-content で、left が画面端に近くても幅が縮まない（縮むと縦長の吹き出しになる） */
  position: fixed; left: 0; top: 0; width: max-content; max-width: min(320px, 70vw);
  background: #fffdf6; color: #1b1b1b; border-radius: 16px; padding: 10px 14px; font-size: 15px; line-height: 1.5;
  transform: translate(-50%, calc(-100% - 14px)); pointer-events: none; box-shadow: 0 6px 24px rgba(0,0,0,.35);
}
#bubble::after { content: ""; position: absolute; left: 50%; bottom: -10px; margin-left: -8px; border: 8px solid transparent; border-top-color: #fffdf6; border-bottom: 0; }
#bubble.thinking { color: #888; }

#tip { position: fixed; pointer-events: none; background: rgba(0,0,0,.75); border: 1px solid var(--line); padding: 4px 8px; border-radius: 6px; font-size: 13px; transform: translate(12px, 12px); }

#banner {
  position: fixed; top: 22%; left: calc((100% - var(--game-right)) / 2); transform: translateX(-50%); text-align: center;
  font-size: clamp(22px, 5vw, 40px); font-weight: 900; color: #ffe07a; text-shadow: 0 2px 12px rgba(0,0,0,.6);
  pointer-events: none; animation: banner 2.4s ease-out forwards;
}
#banner small { display: block; font-size: 15px; color: var(--text); font-weight: 600; margin-top: 4px; }
@keyframes banner { 0% { opacity: 0; transform: translateX(-50%) scale(.8); } 15% { opacity: 1; transform: translateX(-50%) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; } }

/* パネル（右下） */
#pad { position: fixed; right: calc(var(--game-right) + 12px); bottom: calc(var(--dock-h, 220px) + 16px); display: flex; flex-direction: column; gap: 8px; }
#pad button {
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); font-size: 18px;
  backdrop-filter: blur(6px); touch-action: none; user-select: none;
}
#pad button:active { background: rgba(79,195,255,.3); }
#pad button { display: grid; place-items: center; padding: 0; }
.pad-icon { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* 会話のドック */
#dock {
  position: fixed; left: calc((100% - var(--game-right)) / 2); bottom: 12px; transform: translateX(-50%); width: min(680px, calc(100% - var(--game-right) - 24px));
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 10px; backdrop-filter: blur(6px);
}
#choices { display: grid; gap: 6px; }
#choices button {
  text-align: left; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255,255,255,.05); font-size: 15px;
}
#choices button:hover:not(:disabled) { background: rgba(79,195,255,.16); border-color: var(--accent); }
#choices button:disabled, #free button:disabled { opacity: .45; cursor: default; }
#choices .loading { color: var(--muted); font-size: 14px; padding: 10px 2px; }
#free { display: flex; gap: 6px; margin-top: 8px; }
#free input { flex: 1; min-width: 0; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: rgba(0,0,0,.25); color: var(--text); font-size: 15px; }
#free input:focus { outline: none; border-color: var(--accent); }
#free button { padding: 0 16px; border-radius: 10px; border: 0; background: var(--accent); color: #062033; font-weight: 700; }
#hint { font-size: 11px; color: var(--muted); margin-top: 6px; text-align: center; }
body.final #dock { border-color: #ffe07a; box-shadow: 0 0 24px rgba(255,224,122,.25); }

/* 休業中（空の水槽に看板。水槽は回せるよう、看板の外は操作を通す） */
#closed { position: fixed; top: 14%; left: calc((100% - var(--game-right)) / 2); transform: translateX(-50%); text-align: center; pointer-events: none; width: min(420px, calc(100% - 32px)); }
#closed .sign {
  display: inline-block; padding: 14px 34px; font-size: clamp(28px, 7vw, 44px); font-weight: 900; letter-spacing: .25em; text-indent: .25em;
  color: #fff3dc; background: linear-gradient(180deg, #8a5a32, #6a4224); border: 4px solid #4a2c16; border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,.5), inset 0 2px 0 rgba(255,255,255,.15); transform: rotate(-3deg);
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
}
#closed p { margin: 18px 0 0; color: var(--text); text-shadow: 0 2px 8px rgba(0,0,0,.8); line-height: 1.7; font-size: 15px; }
#closed-reason { font-size: 12px !important; color: #ffd36b !important; }

/* オーバーレイ */
.overlay { position: fixed; top: 0; left: 0; bottom: 0; right: var(--game-right); display: grid; place-items: center; background: rgba(5,10,16,.6); backdrop-filter: blur(3px); padding: 16px; }
.panel { width: min(420px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 24px; text-align: center; max-height: calc(100dvh - 32px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.18) transparent; }
/* 背の低いウィンドウでは、パネルの中をスクロールする。主ボタン（.stick の中）は下に貼り付いて見え続ける */
.stick { position: sticky; bottom: -20px; margin: 0 0 -20px; padding: 10px 0 20px; background: linear-gradient(to top, var(--panel) 72%, transparent); }
.stick .primary { margin-top: 8px; }
.panel h1 { margin: 0; font-size: 30px; letter-spacing: .05em; }
.sub { color: var(--muted); margin: 6px 0 18px; font-size: 14px; }
.primary { display: block; width: 100%; margin-top: 18px; padding: 14px; border: 0; border-radius: 12px; background: linear-gradient(135deg, #4fc3ff, #3b7cff); color: #fff; font-size: 17px; font-weight: 800; }
.primary:disabled { opacity: .5; }
.secondary { display: block; width: 100%; margin-top: 10px; padding: 10px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255,255,255,.05); font-size: 14px; font-weight: 600; }
.secondary:hover { border-color: var(--accent); }
.zukan-count { color: var(--muted); font-weight: 500; font-size: 12px; margin-left: 4px; }

/* 釣り堀コンディション（DeepSeek の残高） */
/* 釣り堀コンディション: 左下に小さく目立たない札。閉業間近だけ目立たせる */
/* 左下の隅（#corner）に、釣り堀コンディションの札とクレジットを縦に並べる。隅ごと置き場所を動かす */
#corner {
  position: fixed; left: 12px; bottom: 12px; z-index: 12; max-width: min(270px, calc(100% - var(--game-right) - 24px));
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  pointer-events: none; /* 札はタップを受け取らない（結果画面の図鑑ボタンなどに重なっても、押せるように）。リンクだけ受け取る */
}
#pond {
  display: flex; align-items: center; gap: 5px; flex-wrap: wrap; padding: 3px 8px; border-radius: 8px;
  font-size: 11px; color: var(--muted); opacity: .6; transition: opacity .2s, background .2s;
}
#corner:hover #pond { opacity: 1; }
/* 結果画面では隠す。勝負中（選択肢の欄が出ている間）はクレジットを隠し、コンディションの札だけにする（スマホでは札が選択肢の真上に来るので） */
body:has(#result:not([hidden])) #corner { display: none; }
body:has(#dock:not([hidden])) #credit { display: none; }
#pond .debug { width: 100%; }
/* クレジット: 札より小さく薄く。リンクだけ押せる */
#credit { padding: 0 8px; font-size: 10px; color: var(--muted); opacity: .45; transition: opacity .2s; }
#corner:hover #credit { opacity: .9; }
#credit a { color: inherit; text-decoration: underline dotted; pointer-events: auto; }
/* 画面が狭いと選択肢の欄が横いっぱいになるので、その上の左端に出す */
@media (max-width: 1040px) {
  body:has(#dock:not([hidden])) #corner { bottom: calc(var(--dock-h, 220px) + 16px); }
}
.pond-status .pips { letter-spacing: 1px; font-size: 10px; }
.pond-status b { color: var(--text); font-weight: 700; }
.pond-status.great b, .pond-status.great .pips { color: #5be39a; }
.pond-status.good b, .pond-status.good .pips { color: #8fd3ff; }
.pond-status.murky b, .pond-status.murky .pips { color: #d8c46a; }
.pond-status.critical { opacity: 1; background: rgba(60, 12, 16, .75); }
.pond-status.critical b, .pond-status.critical .pips { color: #ff7a7a; }
.pond-status.critical .warn { width: 100%; color: #ff9a9a; animation: danger 1.6s ease-in-out infinite; }
.pond-status .debug { color: #ffd36b; }

/* 称号とヌシ */
#title-line { margin: -8px 0 12px; font-size: 13px; color: #ffe07a; font-weight: 700; }
#gacha.nushi .panel { border-color: rgba(255, 210, 90, .6); box-shadow: 0 0 40px rgba(255, 200, 80, .25); }
#gacha.nushi #pull { background: linear-gradient(135deg, #f5c84a, #c8801c); color: #2a1a05; }
#omen { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; background: radial-gradient(ellipse at 50% 70%, rgba(40,25,5,.55), rgba(0,0,0,.92)); animation: omen 4.2s ease-in-out forwards; pointer-events: none; }
#omen p { margin: 0; text-align: center; font-size: clamp(24px, 5vw, 40px); font-weight: 900; color: #f5d27a; letter-spacing: .15em; line-height: 1.8; font-family: "Yu Mincho", "Hiragino Mincho ProN", serif; text-shadow: 0 0 24px rgba(255,200,80,.6); }
@keyframes omen { 0% { opacity: 0; } 15% { opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; } }
body.quake #c { animation: quake .12s linear infinite; }
@keyframes quake { 25% { transform: translate(3px, -2px); } 50% { transform: translate(-3px, 2px); } 75% { transform: translate(2px, 3px); } }
.clear-head { font-size: 14px; color: var(--muted); letter-spacing: .2em; }
#clear-title { font-size: clamp(30px, 7vw, 44px); font-weight: 900; color: #ffe07a; font-family: "Yu Mincho", "Hiragino Mincho ProN", serif; text-shadow: 0 0 20px rgba(255,200,80,.4); }
#clear-cheers { display: grid; gap: 8px; margin: 14px 0 6px; text-align: left; }
.cheer { display: flex; gap: 10px; align-items: center; opacity: 0; animation: cheer .5s ease-out forwards; }
.cheer canvas { width: 40px; height: 40px; border-radius: 50%; flex: none; }
.cheer p { margin: 0; padding: 8px 12px; border-radius: 12px; background: #fffdf6; color: #1b1b1b; font-size: 14px; }
.cheer b { display: block; font-size: 11px; color: #8a7a6a; }
@keyframes cheer { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
#clear-card { display: block; width: 100%; margin-top: 12px; border-radius: 8px; box-shadow: 0 6px 24px rgba(0,0,0,.4); }

/* 体長とランキング */
.btn-row { display: flex; gap: 8px; }
.btn-row .secondary { flex: 1; }
#res-catch { margin-top: 10px; padding: 12px; border-radius: 12px; background: rgba(255,224,122,.08); border: 1px solid rgba(255,224,122,.3); }
.rc-size { font-size: 26px; font-weight: 900; color: #ffe07a; }
.rc-size small { font-size: 14px; color: var(--muted); font-weight: 600; margin-left: 6px; }
.rc-tags { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-top: 4px; }
.rc-tags span { font-size: 12px; padding: 2px 10px; border-radius: 999px; background: rgba(255,255,255,.08); }
.rc-tags .monster, .rc-tags .best { background: rgba(255,143,177,.2); color: #ff9dbb; font-weight: 700; }
.rc-rank { margin-top: 6px; font-size: 13px; color: var(--muted); }
.rc-rank b { color: var(--text); }
.rc-form { display: flex; gap: 6px; margin-top: 10px; }
.rc-form input { flex: 1; min-width: 0; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line); background: rgba(0,0,0,.25); color: var(--text); font-size: 15px; }
.rc-form button { padding: 0 16px; border-radius: 10px; border: 0; background: var(--accent); color: #062033; font-weight: 700; }
.rc-msg { margin-top: 8px; font-size: 13px; }
.rc-msg.err { color: var(--bad); }
.rk-panel { width: min(640px, 100%); }
#rk-note { padding: 8px 16px; font-size: 11px; color: var(--muted); flex: none; }
#rk-list { flex: 1; overflow-y: auto; border-top: 1px solid var(--line); }
.rk-row { display: flex; align-items: center; gap: 10px; padding: 8px 16px; border-bottom: 1px solid var(--line); }
.rk-row.mine { background: rgba(79,195,255,.1); box-shadow: inset 3px 0 0 var(--accent); }
.rk-no { width: 2.2em; text-align: center; font-weight: 800; color: var(--muted); flex: none; }
.rk-row canvas { width: 32px; height: 32px; border-radius: 50%; flex: none; }
.rk-row canvas.rk-unknown { background: radial-gradient(circle, rgba(255,255,255,.18), rgba(255,255,255,.04)); }
.rk-who { flex: 1; min-width: 0; }
.rk-who b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rk-who small, .rk-size small { display: block; font-size: 11px; color: var(--muted); }
.rk-size { text-align: right; }
.rk-size b { font-size: 17px; color: #ffe07a; }
.rk-empty { padding: 24px 16px; color: var(--muted); text-align: center; }

/* 図鑑 */
.zk-badge { font-size: 11px; padding: 1px 7px; border-radius: 999px; white-space: nowrap; background: rgba(255,255,255,.08); color: var(--muted); }
.zk-badge.love { background: rgba(255,143,177,.18); color: #ff8fb1; }
.zk-badge.catch { background: rgba(255,224,122,.16); color: #ffe07a; }
.fl-row.unseen .n b { color: var(--muted); }
.zk-records { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.zk-records div { padding: 8px; border-radius: 10px; background: rgba(255,255,255,.04); border: 1px solid var(--line); text-align: center; }
.zk-records b { display: block; font-size: 22px; }
.zk-records span { font-size: 11px; color: var(--muted); }
.zk-hidden { display: flex; flex-wrap: wrap; gap: 6px; }
.zk-hidden span { font-size: 12px; padding: 2px 10px; border-radius: 999px; border: 1px dashed var(--line); color: var(--muted); }
.zk-hidden span.found { border-style: solid; border-color: var(--accent); color: var(--accent); }
.zk-card { width: 100%; max-width: 560px; border-radius: 8px; box-shadow: 0 6px 24px rgba(0,0,0,.4); }
.zk-unseen { color: var(--muted); }
.fl-detail .share { max-width: 560px; }

/* ガチャ: ウキのあたり演出（水面は y=86px） */
#cast { position: relative; width: 240px; height: 140px; margin: 0 auto 10px; overflow: hidden; border-radius: 0 0 16px 16px; cursor: pointer; }
#cast .water { position: absolute; left: 0; right: 0; top: 86px; bottom: 0; z-index: 2; background: linear-gradient(#2c6f90e6, #0f2c40f2); border-top: 1px solid rgba(190, 235, 255, .55); border-radius: 0 0 16px 16px; }
#cast .glow { position: absolute; left: 0; right: 0; top: 60px; height: 60px; z-index: 3; opacity: 0; pointer-events: none; transition: opacity .4s; }
#cast .bobber { position: absolute; left: calc(50% - 15px); top: 36px; z-index: 1; animation: float 2.4s ease-in-out infinite; }
#cast .bob-inner { position: relative; }
#cast .line { position: absolute; left: 14.5px; bottom: 100%; width: 1px; height: 220px; background: rgba(230, 240, 255, .45); }
#cast svg { display: block; }
#cast .cap { fill: #ff3d5a; }
#gacha.nushi #cast .cap { fill: #f2b632; }
#cast .ripple { position: absolute; left: calc(50% - 30px); top: 80px; width: 60px; height: 12px; z-index: 3; border: 2px solid rgba(220, 245, 255, .7); border-radius: 50%; opacity: 0; pointer-events: none; }
#cast .column { position: absolute; left: calc(50% - 22px); bottom: 54px; width: 44px; height: 0; z-index: 3; border-radius: 22px 22px 0 0; background: linear-gradient(rgba(255, 240, 170, .95), rgba(255, 200, 80, .2)); opacity: 0; }
#cast .splash { position: absolute; left: 50%; top: 84px; z-index: 4; }
#cast .splash i { position: absolute; width: 7px; height: 7px; border-radius: 50%; background: #d8f3ff; opacity: 0; }
#cast .bang { position: absolute; left: calc(50% + 18px); top: 8px; z-index: 5; font-size: 34px; font-weight: 900; color: #ffe07a; text-shadow: 0 0 12px rgba(255, 180, 60, .9); opacity: 0; transform: scale(0); }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(3px); } }

/* 投げる → ぽちゃん */
#cast.cast .bobber { animation: cast-in .5s ease-in forwards; }
#cast.cast .ripple { animation: ripple .9s .45s ease-out; }
#cast.cast .ripple.r2 { animation-delay: .65s; }
@keyframes cast-in { from { transform: translate(60px, -140px) rotate(40deg); } 85% { transform: translateY(6px); } to { transform: none; } }
@keyframes ripple { from { opacity: .9; transform: scale(.4); } to { opacity: 0; transform: scale(2.2); } }

/* ピクッ、ピクッ */
#cast.nibble .bobber { animation: nibble .7s ease-in-out infinite; }
#cast.nibble .ripple { animation: ripple .7s ease-out infinite; }
@keyframes nibble { 0%, 55%, 100% { transform: none; } 65% { transform: translateY(7px); } 75% { transform: translateY(1px); } 85% { transform: translateY(5px); } }

/* ぐぐっと沈む（引きの強さは大きさの気配で変わる） */
#cast.bite .bobber, #cast.hook .bobber { animation: sink .3s ease-in forwards; }
#cast.bite .bob-inner { animation: tug .12s linear infinite; }
#cast.bite .bang { animation: bang .3s cubic-bezier(.3, 1.8, .5, 1) forwards; }
#cast.bite .ripple { animation: ripple .45s ease-out infinite; }
#cast.bite.omen-big .bob-inner, #cast.bite.omen-monster .bob-inner { animation-duration: .07s; }
#cast.bite.omen-monster { animation: quake .12s linear infinite; }
@keyframes sink { to { transform: translateY(40px); } }
@keyframes tug { 25% { transform: translateX(-2px); } 75% { transform: translateX(2px); } }
@keyframes bang { to { opacity: 1; transform: none; } }

/* 引き上げる → しぶき */
#cast.hook .bobber { animation: yank .45s ease-in forwards; }
#cast.hook .bang { opacity: 1; transform: none; }
#cast.hook .splash i { animation: drop .6s ease-out forwards; }
#cast.hook .splash i:nth-child(1) { --dx: -46px; --dy: -50px; }
#cast.hook .splash i:nth-child(2) { --dx: -24px; --dy: -70px; }
#cast.hook .splash i:nth-child(3) { --dx: -6px; --dy: -84px; }
#cast.hook .splash i:nth-child(4) { --dx: 12px; --dy: -76px; }
#cast.hook .splash i:nth-child(5) { --dx: 30px; --dy: -60px; }
#cast.hook .splash i:nth-child(6) { --dx: 50px; --dy: -40px; }
@keyframes yank { from { transform: translateY(40px); } to { transform: translate(-30px, -160px) rotate(-30deg); } }
@keyframes drop { from { opacity: 1; transform: none; } to { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(.6); } }

/* レアリティの予感: R は青く光る、SR は水面が紫と金に揺れる、SSR は金色に光って水柱 */
#cast.r-R:not(.cast) svg { filter: drop-shadow(0 0 8px #4f9dff) drop-shadow(0 0 3px #9cc8ff); }
#cast.r-SR:not(.cast) .glow { opacity: 1; background: linear-gradient(90deg, rgba(199, 125, 255, .55), rgba(255, 211, 107, .55), rgba(199, 125, 255, .55)); background-size: 200% 100%; animation: shimmer .8s linear infinite; filter: blur(10px); }
#cast.r-SSR:not(.cast) .glow { opacity: 1; background: radial-gradient(ellipse at 50% 50%, rgba(255, 225, 120, .95), rgba(255, 190, 60, 0) 70%); animation: gold 1s ease-in-out infinite; }
#cast.r-SSR:not(.cast) .water { background: linear-gradient(#a8862ee6, #3a2a0cf2); }
#cast.hook.r-SSR .column { animation: column .5s ease-out forwards; }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes gold { 50% { opacity: .55; } }
@keyframes column { 0% { opacity: 1; height: 0; } 100% { opacity: .9; height: 120px; } }
#cast-msg { margin: -4px 0 6px; font-weight: 800; color: #ffe07a; text-shadow: 0 0 12px rgba(255,200,80,.6); }
#card { animation: reveal .6s ease-out; }
.card-head { display: flex; align-items: center; gap: 14px; text-align: left; }
.card-who { min-width: 0; }
#card-face-wrap {
  flex: none; width: 88px; height: 88px; padding: 3px; border-radius: 50%;
  background: var(--C); animation: face-pop .45s .25s cubic-bezier(.3, 1.6, .5, 1) both;
}
#card.R #card-face-wrap { background: var(--R); }
#card.SR #card-face-wrap { background: linear-gradient(135deg, #c77dff, #ffd36b); }
#card.SSR #card-face-wrap { background: conic-gradient(#ff8a8a, #ffd36b, #8fffb0, #8fd3ff, #c77dff, #ff8a8a); box-shadow: 0 0 14px rgba(255, 200, 80, .6); }
#card-face { display: block; width: 100%; height: 100%; border-radius: 50%; background: #1b2a38; }
@keyframes face-pop { from { transform: scale(0); } to { transform: none; } }
#card-name { font-size: 26px; font-weight: 800; margin-top: 6px; line-height: 1.2; }
#card-title { color: var(--muted); font-size: 14px; }
#card-history { color: var(--muted); font-size: 12px; margin-top: 3px; opacity: .8; }
#card-intro { margin-top: 12px; padding: 10px; border-radius: 10px; background: rgba(255,255,255,.06); font-size: 14px; }
@keyframes reveal { from { opacity: 0; transform: scale(.85); } to { opacity: 1; transform: none; } }
#card.SSR #card-name { background: linear-gradient(90deg, #ffe58a, #f2a632); -webkit-background-clip: text; background-clip: text; color: transparent; }
#card.SR #card-name { background: linear-gradient(90deg, #c77dff, #ffd36b); -webkit-background-clip: text; background-clip: text; color: transparent; }

#res-title { font-size: 30px; font-weight: 900; }
#res-title.win { color: #ffe07a; }
#res-title.love { color: #ff8fb1; }
#res-title.fail { color: var(--muted); }
.panel.wide { width: min(640px, 100%); padding: 20px; }
#res-card { display: block; width: 100%; aspect-ratio: 1200 / 630; margin-top: 12px; border-radius: 8px; box-shadow: 0 6px 24px rgba(0,0,0,.4); background: #f3ebdc; }
.share { display: flex; gap: 8px; margin-top: 12px; }
.share button { flex: 1; padding: 10px 6px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255,255,255,.06); font-size: 14px; font-weight: 600; white-space: nowrap; }
.share button:hover { border-color: var(--accent); background: rgba(79,195,255,.12); }

@media (max-width: 600px) {
  #hud { padding: 8px 10px; }
  #choices button { padding: 9px 10px; font-size: 14px; }
  #hint { display: none; }
}

/* バージョンの印（見出しの横の小さな札。package.json の version に合わせる） */
.prealpha { font-size: 11px; font-weight: 500; vertical-align: middle; margin-left: 2px; color: var(--muted); opacity: .7; letter-spacing: 0; }

/* 大きさの気配（ガチャ） */
#card-omen { margin-top: 8px; font-size: 14px; color: var(--muted); }
#card-omen b { color: var(--text); }
#card-omen.fine b { color: #8fd3ff; }
#card-omen.big b { color: #ffe07a; }
#card-omen.monster b { color: #ff9dbb; font-size: 17px; }

/* 釣り師番号 */
#account { z-index: 16; }
.ac-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.ac-head .fl-close { margin-left: auto; }
.ac-number { font-family: Consolas, Menlo, monospace; font-size: clamp(22px, 6vw, 30px); font-weight: 800; letter-spacing: .06em; padding: 12px; border-radius: 12px; background: rgba(255,255,255,.06); border: 1px dashed var(--line); user-select: all; white-space: nowrap; overflow: hidden; }
.ac-actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.ac-actions button { flex: 1; padding: 9px 6px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255,255,255,.05); font-size: 13px; font-weight: 600; white-space: nowrap; }
.ac-actions button.danger { color: #ff9a9a; border-color: rgba(255,107,125,.4); }
.ac-note { margin-top: 8px; font-size: 12px; color: var(--muted); line-height: 1.6; }
.ac-note b { color: #ff9a9a; }
/* ランキングの名前の行（✏ でその場で書き換える） */
.ac-name { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ac-edit { background: none; border: 0; padding: 0 4px; color: var(--muted); font-size: 13px; cursor: pointer; }
.ac-edit:hover { color: var(--text); }
.ac-name-form { display: flex; gap: 6px; width: 100%; }
.ac-name-form input { flex: 1; min-width: 0; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--line); background: rgba(0,0,0,.25); color: var(--text); font-size: 14px; }
.ac-name-form button { padding: 0 12px; border-radius: 8px; border: 1px solid var(--line); background: rgba(255,255,255,.06); font-size: 13px; white-space: nowrap; }
.ac-name-form button:disabled { opacity: .5; }
.ac-err { width: 100%; color: var(--bad); font-size: 12px; }
.ac-err:empty { display: none; }
.ac-done { color: #5be39a; font-size: 12px; }
.ac-section { margin-top: 18px; text-align: left; }

/* 遊び方の解説（index.html に静的に書いた文章。縦に長いので中だけスクロール） */
.help-body { text-align: left; max-height: min(70vh, 640px); overflow-y: auto; padding-right: 4px; }
.help-body section + section { margin-top: 14px; }
.help-body h3 { margin: 0 0 4px; font-size: 13px; color: var(--muted); font-weight: 600; letter-spacing: .05em; }
.help-body p { margin: 0; font-size: 14px; line-height: 1.7; color: #c9d8e6; }
.help-body p.small { font-size: 12px; color: var(--muted); }
#ac-login-input { font-family: Consolas, Menlo, monospace; letter-spacing: .05em; }

/* クイズ（ルイのフランス問題など） */
#quiz-box { margin: 0 2px 8px; padding: 10px 12px; border-radius: 12px; background: linear-gradient(90deg, rgba(0,85,164,.25), rgba(255,255,255,.06), rgba(239,65,53,.25)); border: 1px solid rgba(255,255,255,.25); }
.quiz-label { font-size: 12px; font-weight: 800; color: #ffd36b; letter-spacing: .05em; }
#quiz-setup { margin-top: 2px; font-size: 12px; color: var(--muted); line-height: 1.5; }
#quiz-q { margin-top: 2px; font-size: 15px; font-weight: 700; }
#quiz-hint { margin-top: 2px; font-size: 12px; color: var(--muted); }
.tricolore { display: inline-block; width: 18px; height: 12px; margin-right: 6px; vertical-align: -1px; border-radius: 2px; background: linear-gradient(90deg, #0055a4 33.3%, #fff 33.3% 66.6%, #ef4135 66.6%); }

/* 10 の質問（見出しは「20」に訂正線を引いて「10」にしたネタ） */
.tw-old { color: var(--muted); font-size: 11px; text-decoration: line-through; text-decoration-thickness: 2px; text-decoration-color: #ff6b7d; margin-right: 1px; }
.tw-new { display: inline-block; color: #ffd36b; transform: rotate(-6deg) translateY(-1px); margin-right: 1px; }
#twenty-box { margin: 0 2px 8px; padding: 10px 12px; border-radius: 12px; background: linear-gradient(135deg, rgba(120,100,200,.22), rgba(60,80,140,.18)); border: 1px solid rgba(200,190,255,.3); }
.tw-head { display: flex; justify-content: space-between; align-items: center; }
.tw-label { font-size: 12px; font-weight: 800; color: #d9ccff; }
.tw-left { font-size: 12px; color: var(--muted); }
.tw-answer { margin-top: 4px; font-size: 22px; font-weight: 900; text-align: center; }
.tw-answer.a-はい { color: #5be39a; }
.tw-answer.a-いいえ, .tw-answer.a-miss { color: #ff8b98; }
.tw-answer.a-たぶん { color: #ffd36b; }
.tw-answer.a-わかんない { color: var(--muted); }
.tw-answer.solved { color: #ffe07a; }
.tw-note { margin-top: 4px; font-size: 13px; color: var(--muted); }
.tw-history { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.tw-history span { font-size: 11px; padding: 1px 8px; border-radius: 999px; background: rgba(255,255,255,.08); color: var(--muted); }
.tw-hint { margin-top: 6px; font-size: 13px; color: #d9ccff; }

/* 自由入力の使えない文字 */
#input-warn { margin: 6px 2px 0; font-size: 12px; color: #ff9a9a; }

/* 図鑑の解説・後日談 */
.zk-text { margin: 4px 0; line-height: 1.7; color: #c9d8e6; }
.zk-intro { font-size: 13px; color: var(--muted); }
.zk-parts { font-size: 13px; }
.zk-locked { font-size: 12px; color: var(--muted); opacity: .7; }
.zk-epilogue { padding: 10px 12px; border-radius: 10px; background: rgba(255, 211, 107, .07); border: 1px solid rgba(255, 211, 107, .3); }

/* 効果音のオン/オフ（右上）と、その下の「この勝負の会話をコピー」、?debug の試し聞きパネル */
#sound, #copylog {
  position: fixed; top: 12px; right: calc(var(--game-right) + 12px); z-index: 5;
  width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel);
  font-size: 16px; padding: 0; backdrop-filter: blur(6px);
}
#copylog { top: 56px; }
#copylog[hidden] { display: none; }
#sfx-test {
  position: fixed; top: 100px; right: calc(var(--game-right) + 12px); z-index: 20; max-width: 300px;
  display: flex; flex-wrap: wrap; gap: 6px; padding: 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel);
}
#sfx-test[hidden] { display: none; }
#sfx-test button { font-size: 12px; padding: 4px 8px; border-radius: 6px; border: 1px solid var(--line); background: none; }

/* 二重人格の入れ替わり: 水槽を一瞬光らせる */
#c.flash { animation: mode-flash .6s ease-out; }
@keyframes mode-flash { 0% { filter: brightness(1); } 15% { filter: brightness(2.2) saturate(.2); } 100% { filter: brightness(1); } }

/* 伝説級の個体: ウキの沈みで画面が強く揺れ、札は金色 */
body.quake.legend #c { animation: quake .07s linear infinite; }
#cast.bite.omen-legend { animation: quake .07s linear infinite; }
#cast.bite.omen-legend .bob-inner { animation-duration: .05s; }
#card-omen.legend b { color: #ffd36b; font-size: 18px; text-shadow: 0 0 10px rgba(255, 200, 80, .7); }
.rc-tags .legend { background: rgba(255,211,107,.22); color: #ffd36b; font-weight: 800; }

/* リレー小説の原稿（オサム）: 会話欄の上に本文を積む。折りたたみ式 */
#story-box { margin: 0 2px 8px; padding: 8px 12px; border-radius: 12px; background: linear-gradient(135deg, rgba(240,228,200,.14), rgba(200,180,150,.08)); border: 1px solid rgba(240,228,200,.3); }
.story-head { display: flex; justify-content: space-between; align-items: center; cursor: pointer; list-style: none; font-size: 12px; }
.story-head::-webkit-details-marker { display: none; }
.story-head::before { content: '▸'; margin-right: 6px; color: var(--muted); }
#story-box[open] .story-head::before { content: '▾'; }
.story-label { font-weight: 800; color: #f1dfb3; letter-spacing: .05em; margin-right: auto; }
.story-count { color: var(--muted); }
.story-body { max-height: 128px; overflow-y: auto; margin-top: 6px; padding-right: 4px; font-family: 'Hiragino Mincho ProN', 'Yu Mincho', 'Noto Serif JP', serif; font-size: 14px; line-height: 1.7; }
.story-line { margin: 0 0 4px; }
.story-line.player { color: #ffe8a8; }
.story-line.fish { color: #e9e4d8; }
.story-line.last { font-weight: 700; }
/* 結果画面の完成した作品 */
#res-story { margin-top: 10px; padding: 12px; border-radius: 12px; background: rgba(240,228,200,.08); border: 1px solid rgba(240,228,200,.3); text-align: left; }
.rs-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.rs-head small { color: var(--muted); }
.rs-body { max-height: 220px; overflow-y: auto; font-family: 'Hiragino Mincho ProN', 'Yu Mincho', 'Noto Serif JP', serif; font-size: 14px; line-height: 1.8; }
#res-story button { margin-top: 8px; width: 100%; }

/* 見えない心の壁: 当たったターンにバーが跳ね返り、ガラスの反射が走る。当たったあとは薄いガラス面とヒビが残る（よく見ると分かる） */
#afffill.bounce { transition: width .35s cubic-bezier(.3, 1.8, .5, 1); }
#wall { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; background: rgba(255,255,255,.14); border-radius: 1px; pointer-events: none; }
#wall .crack { position: absolute; left: 0; width: 1px; height: 7px; background: rgba(255,255,255,.22); transform-origin: top; }
#wall::before { content: ""; position: absolute; left: -6px; top: -2px; width: 14px; height: calc(100% + 4px); border-radius: 7px; background: radial-gradient(ellipse at center, rgba(255,255,255,.95), rgba(255,255,255,0) 70%); opacity: 0; pointer-events: none; }
#wall.glint::before { animation: glint .45s ease-out; }
@keyframes glint { 0% { opacity: 0; transform: scaleX(.3); } 30% { opacity: 1; transform: scaleX(1.2); } 100% { opacity: 0; transform: scaleX(.6); } }
#wall.shatter { animation: shatter .6s ease-out forwards; }
#wall.shatter .crack { animation: shard .6s ease-out forwards; }
@keyframes shatter { 0% { opacity: 1; } 100% { opacity: 0; transform: translateY(14px); } }
@keyframes shard { 0% { transform: translate(0, 0) rotate(var(--rot, 0deg)); opacity: 1; } 100% { transform: translate(var(--dx, 6px), 18px) rotate(calc(var(--rot, 0deg) + 60deg)); opacity: 0; } }
/* 増減の数字: 壁に当たったときは本来の増分を出してから「+0」に滑り落ちる。メモがあるときは長めに見せる */
#delta.show.long { animation-duration: 5s; }
#delta .fall { display: inline-block; animation: fall .5s ease-in forwards; }
@keyframes fall { 0% { transform: translateY(0); } 60% { transform: translateY(6px); opacity: .4; } 100% { transform: translateY(0); opacity: 1; } }
/* 大事なメモ（壁・崩れた・地雷）: バーの下に少し大きめの札 */
#alert { margin-top: 20px; font-size: 13px; font-weight: 800; padding: 5px 10px; border-radius: 8px; background: rgba(10,18,28,.9); border: 1px solid rgba(255,255,255,.25); color: #ffe07a; opacity: 0; width: max-content; max-width: 100%; }
#alert.show { animation: alertpop .4s ease-out both; } /* 出たら次の操作まで残す（main.js の send / praise で消す） */
@keyframes alertpop { 0% { opacity: 0; transform: translateY(4px); } 100% { opacity: 1; transform: none; } }
/* スマホ: 吹き出しが HUD に重なって札が読めないので、札は選択肢パネルのすぐ上に出す */
@media (max-width: 600px) {
  body:has(#dock:not([hidden])) #corner { display: none; } /* スマホは狭いので、会話中は釣り堀コンディションを出さない（ガチャ画面には出る） */
  #alert { position: fixed; left: 12px; right: 72px; width: auto; max-width: none; bottom: calc(var(--dock-h, 220px) + 20px); margin: 0; z-index: 6; } /* 選択肢パネルのすぐ上。右の操作ボタン（#pad）とは重ねない */
}
