/* 文字アクアリウム — ブラウン管の文字画面ふうの見た目。画像は使わず、すべて文字で描く */

/* 説明文・ボタン・数字はドット文字（DotGothic16 の ASCII と Latin-1 だけに絞ったもの。tools/build_font.py。OFL 1.1＝assets/fonts/OFL.txt）。
   水そう・魚の絵は、幅のそろった端末の等幅フォント（--mono）のまま */
@font-face {
  font-family: "MojiDot";
  src: url("../assets/fonts/dotgothic16.woff2?ver=20261204-1") format("woff2");
  font-display: swap;
}
:root {
  --bg: #04121f;
  --bg2: #062338;
  --line: #1f5b78;
  --fg: #bfefff;
  --dim: #5b8aa3;
  --cy: #5ff2ff;
  --gr: #8dff9a;
  --am: #ffc857;
  --pk: #ff8fb3;
  --rd: #ff6b6b;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Roboto Mono", "DejaVu Sans Mono", "Liberation Mono", "Courier New", monospace;
  --ui: ui-monospace, "SF Mono", Menlo, Consolas, "Roboto Mono", monospace, system-ui, sans-serif;
}
/* ドット文字が全部の字を持っている言語（ASCII と Latin-1 で書ける言語）だけ、画面の文字をドット文字にする。
   ほかの言語（アラビア文字・漢字・ベトナム語・トルコ語など）は字の一部だけがドット文字になってまだらになるので、端末の書体のまま */
:root:is(:lang(en), :lang(es), :lang(fr), :lang(pt), :lang(de), :lang(it), :lang(id), :lang(sw), :lang(tl), :lang(jv)) {
  --ui: "MojiDot", ui-monospace, "SF Mono", Menlo, Consolas, "Roboto Mono", monospace, system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg); overflow: hidden; }
body { font-family: var(--ui); font-size: 15px; line-height: 1.5; -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; overscroll-behavior: none; }
.hidden { display: none !important; }
button { font: inherit; color: inherit; }
/* ゲームの画面だけ、ブラウン管のようにうっすら光らせる。ドット文字の言語では太字にせず（にじむ）、字の間を少しあける。
   共通ヘッダーには効かせない。アラビア文字は字の間をあけるとつながらなくなるので、ドット文字の言語だけ */
#app, .sgr-overlay { text-shadow: 0 0 4px rgba(191, 239, 255, .28); }
:is(#app, .sgr-overlay):is(:lang(en), :lang(es), :lang(fr), :lang(pt), :lang(de), :lang(it), :lang(id), :lang(sw), :lang(tl), :lang(jv)) { font-synthesis: none; letter-spacing: .02em; }
#logo-art, .item-art { letter-spacing: 0; }

#app {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 1000px;
  height: calc(100dvh - var(--sgh-top, 0px) - var(--ad-space, 0px));
  margin: 0 auto;
  padding: 6px max(8px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  gap: 6px;
}
html.has-ad-banner #app { padding-bottom: 6px; }

/* ---------- 上の表示 ---------- */
#hud { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 10px; padding: 2px 4px; font-size: 13px; white-space: nowrap; }
.hud-item small { color: var(--dim); font-size: 11px; }
.hud-item b { font-family: var(--ui); font-weight: 700; color: var(--am); }
#hud-coin b { color: var(--am); text-shadow: 0 0 8px rgba(255, 200, 87, .5); }
#water-bar.ok { color: var(--cy); }
#water-bar.warn { color: var(--am); }
#water-bar.bad { color: var(--rd); animation: blink 0.8s steps(2) infinite; }

/* ---------- 水そう ---------- */
#stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: radial-gradient(120% 90% at 50% 0%, #0a3350 0%, var(--bg2) 45%, #03101c 100%);
  box-shadow: inset 0 0 40px rgba(0, 0, 0, .55), 0 0 18px rgba(95, 242, 255, .12);
  overflow: hidden;
  transition: background-color .6s;
}
#stage::after {   /* 走査線 */
  content: "";
  position: absolute; inset: 0;
  background: repeating-linear-gradient(to bottom, rgba(0, 0, 0, 0) 0 2px, rgba(0, 0, 0, .16) 2px 3px);
  pointer-events: none;
}
#app.murky #stage { background: radial-gradient(120% 90% at 50% 0%, #25401f 0%, #14301f 45%, #07140c 100%); }
#app.fever #stage { border-color: #ffe35a; animation: fever-glow .6s steps(2) infinite; }   /* うんちフィーバー（Poop Fever） */
@keyframes fever-glow {
  0% { box-shadow: inset 0 0 40px rgba(0, 0, 0, .55), 0 0 26px rgba(255, 227, 90, .6); }
  50% { box-shadow: inset 0 0 40px rgba(0, 0, 0, .55), 0 0 8px rgba(255, 227, 90, .25); }
}
#tank {
  margin: 0;
  font-family: var(--mono);
  font-size: 16px;
  line-height: 19px;
  font-variant-ligatures: none;
  font-feature-settings: "liga" 0, "calt" 0;
  letter-spacing: 0;
  color: var(--fg);
  white-space: pre;
  cursor: pointer;
  touch-action: none;
  user-select: none; -webkit-user-select: none;
  text-shadow: 0 0 6px currentColor;
}
#tank > div { height: 1lh; }
#tank i, #logo-art i, .item-art i { font-style: normal; }
.probe { position: absolute; visibility: hidden; font-size: 100px; letter-spacing: 0; }

/* 文字の色 */
.c1 { color: var(--cy); } .c2 { color: var(--gr); } .c3 { color: var(--am); } .c4 { color: var(--pk); }
.c5 { color: #f4fbff; } .c6 { color: #ff9f4a; } .c7 { color: var(--rd); } .c8 { color: #6aa8ff; }
.c9 { color: #c79bff; } .c10 { color: #ffe35a; font-weight: 700; } .c11 { color: #4f6b7a; }
.c12 { color: #c9a86a; } .c13 { color: #3f9fc4; } .c14 { color: #4f8f3a; } .c15 { color: #7fc8e8; }
.c16 { color: #ffb37a; } .c17 { color: #ffe35a; font-weight: 700; } .c18 { color: #9db4c0; }
.c19 { color: #04121f; background: #f4fbff; text-shadow: none; } .c20 { color: #55d06a; }

/* ---------- 知らせ・魚の情報 ---------- */
#log { margin: 0; min-height: 3em; padding: 2px 4px; font-size: 13.5px; color: var(--gr); text-shadow: 0 0 6px rgba(141, 255, 154, .4); }
#log-cursor { animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
#info { display: flex; align-items: center; gap: 6px; min-height: 3em; padding: 0 4px; font-size: 13px; }
#info-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
#info-text b { color: var(--cy); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#info-text > span { font-family: var(--ui); color: var(--fg); white-space: nowrap; overflow: hidden; }

/* ---------- ボタン（[ かっこ ] つきの文字） ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 40px; padding: 4px 6px;
  border: 0; border-radius: 4px;
  background: transparent;
  color: var(--cy);
  font-family: var(--ui); font-size: 14px; font-weight: 700; line-height: 1.2;
  cursor: pointer;
  touch-action: manipulation;
  white-space: nowrap;
}
.btn::before { content: "["; margin-right: .35em; color: var(--dim); font-family: var(--ui); }
.btn::after { content: "]"; margin-left: .35em; color: var(--dim); font-family: var(--ui); }
.btn:hover { background: rgba(95, 242, 255, .1); }
.btn:active { background: var(--cy); color: var(--bg); }
.btn:focus-visible { outline: 2px solid var(--am); outline-offset: 1px; }
.btn:disabled { color: #3f596a; cursor: default; background: transparent; }
.btn-primary { color: var(--bg); background: var(--cy); padding: 8px 14px; font-size: 16px; box-shadow: 0 0 14px rgba(95, 242, 255, .35); }
.btn-primary::before, .btn-primary::after { color: var(--bg); }
.btn-primary:hover { background: #a5f8ff; }
.btn-danger { color: var(--rd); }
.btn.blink { color: var(--am); animation: blink 1s steps(2) infinite; }
.icon-btn { background: transparent; border: 0; }
#cmd { display: flex; justify-content: space-between; gap: 2px; }
#cmd .btn { flex: 1 1 auto; min-height: 44px; }
#cmd .btn-q { flex: 0 0 auto; }
.btn-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }

/* ---------- オーバーレイ ---------- */
.overlay {
  position: fixed; left: 0; right: 0; top: var(--sgh-top, 0px); bottom: var(--ad-space, 0px);
  z-index: 50;
  display: flex; align-items: center; justify-content: center;
  padding: 10px;
  background: rgba(2, 10, 18, .82);
}
.overlay-box {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  width: 100%; max-width: 520px; max-height: 100%;
  padding: 16px 14px;
  border: 2px solid var(--line); border-radius: 10px;
  background: #051a2b;
  box-shadow: 0 0 30px rgba(95, 242, 255, .15);
  overflow-y: auto; overscroll-behavior: contain;
  text-align: center;
}
#title-overlay { background: rgba(2, 10, 18, .72); }
#title-head { display: flex; flex-direction: column; align-items: center; }
#logo-art { margin: 0 0 8px; font-family: var(--mono); font-size: 14px; line-height: 1.25; text-align: left; color: #3f9fc4; text-shadow: 0 0 6px currentColor; font-variant-ligatures: none; }
#logo { margin: 0; font-size: clamp(26px, 8vw, 38px); letter-spacing: .06em; color: var(--cy); text-shadow: 0 0 14px rgba(95, 242, 255, .6); }
#logo-en { margin: 0; font-family: var(--ui); font-size: 13px; letter-spacing: .4em; color: var(--am); }
#tagline { margin: 0; font-size: 14px; }
#tagline b { color: var(--am); }
#footer { margin-top: 4px; font-size: 11px; color: var(--dim); }
#footer a { color: var(--dim); }

.win { align-items: stretch; text-align: left; }
.win-head { display: flex; align-items: center; gap: 8px; }
.win-title { flex: 1 1 auto; margin: 0; font-size: 18px; color: var(--cy); }
.win-title::before { content: "== "; color: var(--dim); font-family: var(--ui); }
.win-title::after { content: " =="; color: var(--dim); font-family: var(--ui); }
.win-coin { font-family: var(--ui); font-weight: 700; color: var(--am); }
.win-close { min-height: 36px; }
.win-note { margin: 0; font-size: 12.5px; color: var(--dim); }
.tabs { display: flex; gap: 2px; border-bottom: 1px dashed var(--line); }
.tab { flex: 1 1 0; color: var(--dim); }
.tab.on { color: var(--bg); background: var(--cy); }
.tab.on::before, .tab.on::after { color: var(--bg); }
.list { list-style: none; margin: 0; padding: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; min-height: 120px; }
.item { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px dashed #123a52; }
.item-art { flex: 0 0 92px; margin: 0; font-family: var(--mono); font-size: 11px; line-height: 1.15; text-align: center; white-space: pre; overflow: hidden; text-shadow: 0 0 6px currentColor; font-variant-ligatures: none; }
.item-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.item-body b { font-size: 14px; color: var(--fg); }
.item-body span { font-size: 11.5px; color: var(--dim); }
.item-body .dex-rec { font-family: var(--ui); color: var(--am); }
.item-buy { flex: 0 0 auto; min-width: 84px; color: var(--am); font-family: var(--ui); }
.item.unknown .item-body b { color: var(--dim); }

#eval-rank { text-align: center; font-size: 18px; font-weight: 700; color: var(--am); text-shadow: 0 0 10px rgba(255, 200, 87, .5); }
#eval-total { text-align: center; font-family: var(--ui); font-size: 40px; font-weight: 700; line-height: 1.1; color: var(--cy); text-shadow: 0 0 14px rgba(95, 242, 255, .6); }
#eval-total small { margin-left: 4px; font-family: var(--ui); font-size: 15px; }
#eval-next { text-align: center; }
#eval-list { list-style: none; margin: 0; padding: 0; }
#eval-list li { display: flex; justify-content: space-between; padding: 4px 2px; border-bottom: 1px dashed #123a52; font-size: 13.5px; }
#eval-list b { font-family: var(--ui); color: var(--am); }
#report-coin { text-align: center; font-family: var(--ui); font-size: 34px; font-weight: 700; color: var(--am); text-shadow: 0 0 12px rgba(255, 200, 87, .5); }
#report-overlay .win, #reset-overlay .win { text-align: center; }
.howto { margin: 0; padding-left: 1.4em; font-size: 13.5px; text-align: left; }
.howto li { margin-bottom: 6px; }
.howto b { color: var(--am); }

/* 全国ランキングの「登録」の差し込み（js/ranking.js）を、この画面の色に合わせる */
#eval-box .sgr-cta { align-self: stretch; }

@media (max-width: 430px) {
  #hud { font-size: 12px; gap: 2px 6px; }
  #hud-coin small { display: none; }
  #cmd .btn { font-size: 13px; padding: 4px 1px; }
  #cmd .btn::before { margin-right: .2em; }
  #cmd .btn::after { margin-left: .2em; }
}
@media (min-width: 700px) {
  body { font-size: 16px; }
  #hud { font-size: 15px; justify-content: flex-start; gap: 4px 26px; }
  #cmd { justify-content: center; gap: 12px; }
  #cmd .btn { flex: 0 0 auto; padding: 4px 14px; }
  .item-art { flex-basis: 150px; font-size: 13px; }
}
@media (max-height: 430px) {   /* 横向きのスマホ */
  #app { gap: 2px; padding-top: 2px; }
  #log, #info { min-height: 1.5em; white-space: nowrap; overflow: hidden; }
  #info-text { flex-direction: row; gap: 10px; }
  #cmd .btn { min-height: 34px; }
  #logo-art { display: none; }
  .overlay-box { padding: 8px 12px; gap: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  #log-cursor, .btn.blink, #water-bar.bad, #app.fever #stage { animation: none; }
  #app.fever #stage { box-shadow: inset 0 0 40px rgba(0, 0, 0, .55), 0 0 18px rgba(255, 227, 90, .45); }
}

/* ---------- 全国ランキング（SGRanking 共通モジュール js/ranking.js） ---------- */
.sgr-hidden { display: none !important; }

.sgr-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  padding-top: calc(16px + var(--sgh-top, 0px));
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  background: rgba(2, 9, 16, .82);
}
.sgr-panel {
  width: min(420px, 100%);
  max-height: min(80vh, 640px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg2);
  color: var(--fg);
  border: 1px solid var(--cy);
  padding: 16px 14px;
  box-shadow: 0 0 24px rgba(95, 242, 255, .25);
}
.sgr-title { margin: 0; font-size: 18px; font-weight: 700; text-align: center; color: var(--cy); text-shadow: 0 0 10px rgba(95, 242, 255, .5); }
.sgr-tabs { display: flex; gap: 6px; justify-content: center; }
.sgr-tab {
  border: 1px solid var(--line);
  padding: 4px 12px;
  font: inherit;
  font-size: 13px;
  background: transparent;
  color: var(--fg);
  cursor: pointer;
}
.sgr-tab-active { background: var(--cy); color: var(--bg); border-color: var(--cy); }
.sgr-register { padding: 10px; border: 1px dashed var(--am); }
.sgr-register-msg { margin: 0 0 6px; font-size: 14px; font-weight: 700; color: var(--am); text-align: center; }
.sgr-form { display: flex; gap: 8px; }
.sgr-name {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 16px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--bg);
  color: var(--fg);
  -webkit-user-select: text;
  user-select: text;
}
.sgr-name::placeholder { color: var(--dim); }
.sgr-name:focus { outline: 2px solid var(--am); outline-offset: 0; }
.sgr-submit, .sgr-cta-btn {
  border: 1px solid var(--am);
  padding: 8px 14px;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  background: var(--am);
  color: var(--bg);
  cursor: pointer;
  box-shadow: 0 0 12px rgba(255, 200, 87, .3);
}
.sgr-submit:disabled { opacity: .5; cursor: default; }
.sgr-error { margin: 6px 0 0; font-size: 12px; color: var(--rd); }
.sgr-status { margin: 0; font-size: 13px; color: var(--dim); text-align: center; }
.sgr-list {
  margin: 0;
  padding: 0;
  list-style: none;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  flex: 1;
  min-height: 0;
  border-top: 1px solid var(--line);
}
.sgr-row { display: flex; align-items: center; gap: 8px; padding: 6px 6px; font-size: 14px; border-bottom: 1px dashed #123a52; }
.sgr-row.sgr-row-me { background: var(--am); color: var(--bg); font-weight: 700; }
.sgr-rank { width: 2em; text-align: right; font-family: var(--ui); font-weight: 700; flex-shrink: 0; color: var(--dim); }
.sgr-rank.sgr-rank-top { color: var(--am); }
.sgr-row.sgr-row-me .sgr-rank { color: var(--bg); }
.sgr-row-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sgr-row-score { font-family: var(--ui); font-weight: 700; color: var(--cy); flex-shrink: 0; font-variant-numeric: tabular-nums; }
.sgr-row.sgr-row-me .sgr-row-score { color: var(--bg); }
.sgr-close {
  border: 1px solid var(--line);
  padding: 10px;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  background: transparent;
  color: var(--cy);
  cursor: pointer;
}
.sgr-close:hover { background: rgba(95, 242, 255, .1); }
.sgr-close:focus-visible, .sgr-submit:focus-visible, .sgr-cta-btn:focus-visible, .sgr-tab:focus-visible, .sgr-cta-link:focus-visible { outline: 2px solid var(--am); outline-offset: 2px; }
.sgr-cta { margin: 0; text-align: center; }
.sgr-cta-msg { margin: 0 0 6px; font-size: 14px; font-weight: 700; color: var(--am); }
.sgr-cta-link {
  border: none;
  background: none;
  color: var(--cy);
  font: inherit;
  font-size: 13px;
  text-decoration: underline;
  cursor: pointer;
}

/* ==========================================================================
   フッター固定バナー広告（スマホ表示時のみ / js/ad-banner.js が挿入する）
   --ad-h    : 広告そのものの高さ。広告なしのときは 0px
   --ad-space: レイアウトが空けるべき高さ（広告 + セーフエリア）
   ========================================================================== */
:root {
  --ad-h: 0px;
  --ad-space: 0px;
}
html.has-ad-banner {
  --ad-space: calc(var(--ad-h, 0px) + env(safe-area-inset-bottom, 0px));
}

.ad-banner {
  /* height は広告そのものの高さ。セーフエリアぶんの padding は外側に足す */
  box-sizing: content-box;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  /* ランキング・リザルト等の全画面オーバーレイ（2147483000）よりは下に置く */
  z-index: 2147482000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  height: var(--ad-h, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  overflow: hidden;
  background: rgba(14, 16, 20, 0.86);
  /* border ではなく inset shadow にして、枠線ぶん高さがずれないようにする */
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.ad-banner__frame {
  display: block;
  width: 100%;
  height: var(--ad-h, 0px);
  border: 0;
  color-scheme: light;
}

@media print {
  .ad-banner { display: none; }
}
