[hidden] { display: none !important; }

:root {
  --bg: #0d1a2e;
  --bg2: #13243d;
  --ink: #f2ecdc;
  --dim: #a59fbd;
  --gold: #7cc8f0;
  --gold2: #b9e6ff;
  --hair: rgba(124, 200, 240, .18);
  --hair2: rgba(124, 200, 240, .4);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: radial-gradient(1200px 600px at 50% -10%, #1d3a5c 0%, var(--bg) 60%) fixed, var(--bg);
  color: var(--ink);
  font-family: "Hiragino Sans", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  line-height: 1.7;
}

#app { padding: 0 16px 32px; }

#site-header {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 0;
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid var(--hair);
}
.apps-link {
  color: var(--dim);
  text-decoration: none;
  font-size: 13px;
  border: 1px solid var(--hair);
  border-radius: 999px;
  padding: 3px 10px;
  white-space: nowrap;
}
.apps-link:hover { color: var(--ink); border-color: var(--hair2); }
.header-logo { margin: 0; font-size: 17px; font-weight: 800; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-logo a { color: inherit; text-decoration: none; }
.header-logo a:hover { color: var(--gold2); }
.header-sub { font-size: 12px; font-weight: 500; color: var(--dim); margin-left: 6px; }
.soundbtn {
  background: none;
  border: 1px solid var(--hair);
  color: var(--dim);
  border-radius: 999px;
  padding: 4px 12px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.soundbtn:hover { color: var(--ink); border-color: var(--hair2); }

/* ── 盤 ─────────────────────────────── */
#play {
  max-width: 1200px;
  margin: 20px auto 0;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 24px;
}

#board { display: flex; flex-direction: column; gap: 8px; }
.hudbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 4px; }
#help-btn { padding: 4px 14px; font-size: 13px; }

#stage {
  position: relative;
  aspect-ratio: 3 / 4;
  height: min(70svh, 700px);
  max-width: 100%;
  border-radius: 18px;
  /* 神殿の夜空と大理石の器 */
  background:
    linear-gradient(180deg, rgba(200, 230, 255, .05) 0 18.7%, transparent 18.7%),
    radial-gradient(120% 70% at 50% 100%, #1b3350 0%, #112640 60%, #0c1c31 100%);
  border: 3px solid #9fc3dd;
  box-shadow:
    inset 0 0 0 4px #4d6f8c,
    inset 0 -30px 60px rgba(0, 0, 0, .35),
    0 18px 50px rgba(0, 0, 0, .45);
  overflow: hidden;
}
#cv {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: pointer;
  outline: none;
}
#cv:focus-visible { box-shadow: inset 0 0 0 2px var(--gold); }

.hud {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.1;
}
.hud small { font-size: 10px; letter-spacing: .12em; color: var(--dim); }
.hud-score { align-items: flex-start; min-width: 80px; }
.hud-score b { font-size: 22px; font-variant-numeric: tabular-nums; color: var(--gold2); display: inline-block; transform-origin: left center; }
.hud-score b.bump { animation: bump .28s ease-out; }
@keyframes bump { 0% { transform: scale(1.28); } 100% { transform: scale(1); } }
.hud-next { flex-direction: row; gap: 8px; min-width: 80px; justify-content: flex-end; }
.mode { margin-left: 6px; color: var(--gold2); letter-spacing: 0; }
.side-btns { display: flex; gap: 8px; flex-wrap: wrap; }

.orb {
  --c: #888;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  font-size: 16px;
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--c) 45%, white), var(--c) 60%, color-mix(in srgb, var(--c) 65%, black));
  border: 1.5px solid color-mix(in srgb, var(--c) 50%, black);
  flex: none;
}

#banner {
  position: absolute;
  left: 50%;
  top: 30%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 22px;
  border-radius: 14px;
  background: rgba(18, 15, 36, .82);
  border: 1px solid var(--hair2);
  pointer-events: none;
  white-space: nowrap;
  text-align: center;
}
#banner.show { animation: banner 2.2s ease forwards; }
@keyframes banner {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.7); }
  12% { opacity: 1; transform: translate(-50%, -50%) scale(1.06); }
  20% { transform: translate(-50%, -50%) scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -62%); }
}
.banner-head { font-size: 11px; letter-spacing: .2em; color: var(--gold); }
.banner-name { font-size: 26px; font-weight: 900; }
.banner-rank { font-size: 12px; color: var(--dim); }

#intro, #over {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: rgba(12, 10, 24, .78);
  backdrop-filter: blur(3px);
  text-align: center;
  padding: 16px;
}
.over-title { font-size: 26px; font-weight: 900; margin: 0 0 6px; color: var(--gold2); }
.over-row { margin: 0; color: var(--dim); }
.over-row b { color: var(--ink); font-size: 17px; }
.over-btns { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; justify-content: center; }

.primary, .ghost {
  font: inherit;
  font-weight: 700;
  border-radius: 999px;
  padding: 8px 20px;
  cursor: pointer;
  text-decoration: none;
  font-size: 14px;
}
.primary { background: var(--gold); color: #08182b; border: none; }
.primary:hover { background: var(--gold2); }
.ghost { background: none; color: var(--ink); border: 1px solid var(--hair2); }
.ghost:hover { border-color: var(--gold); }

/* ── 横の欄（ランキング） ─────────────── */
#side {
  width: 270px;
  flex: none;
  background: rgba(255, 255, 255, .03);
  border: 1px solid var(--hair);
  border-radius: 14px;
  padding: 14px 14px 16px;
}
.side-head { display: flex; align-items: baseline; justify-content: space-between; }
.side-head h2 { margin: 0; font-size: 15px; }
.seen { font-size: 12px; color: var(--dim); }
.side-note { font-size: 12px; color: var(--dim); margin: 4px 0 10px; }
#ladder { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
#ladder li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 8px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--dim);
}
#ladder li .orb { width: 24px; height: 24px; font-size: 13px; }
#ladder li .rk { width: 30px; text-align: right; font-size: 11px; font-variant-numeric: tabular-nums; }
#ladder li.got { color: var(--ink); }
#ladder li.now { background: rgba(124, 200, 240, .14); color: var(--gold2); font-weight: 700; }
.side-best { margin: 12px 0 0; font-size: 13px; color: var(--dim); }
.side-best b { color: var(--ink); }
.side-btns { margin-top: 8px; }
.side-btns .ghost { padding: 5px 14px; font-size: 13px; }
.blog-link { display: block; margin-top: 12px; font-size: 12px; color: var(--gold); }

/* ── 遊び方・フッター ─────────────────── */
#guide-section { max-width: 1200px; margin: 48px auto 0; }
#guide-section h2 { font-size: 18px; border-bottom: 1px solid var(--hair); padding-bottom: 6px; }
.guide-content { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.guide-col h3 { font-size: 14px; color: var(--gold); margin: 0 0 4px; }
.guide-col p { font-size: 14px; margin: 0; color: #d9d3c4; }

#site-footer { max-width: 1200px; margin: 44px auto 0; padding-top: 16px; border-top: 1px solid var(--hair); color: var(--dim); }
.footer-links { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; }
.footer-links a { color: var(--dim); text-decoration: none; }
.footer-links a:hover { color: var(--ink); }
.footer-copy { font-size: 12px; }

@media (max-width: 760px) {
  #play { flex-direction: column; align-items: center; }
  #board { width: 100%; align-items: center; }
  .hudbar { width: 100%; max-width: calc(70svh * 3 / 4); }
  #stage { height: auto; width: 100%; max-height: 70svh; max-width: calc(70svh * 3 / 4); }
  #side { width: 100%; }
  #ladder { display: flex; }
  .guide-content { grid-template-columns: 1fr; }
  .header-sub { display: none; }
}

/* 浮き沈みの欄 */
#ladder li { gap: 10px; }
#ladder li .orb { width: 40px; height: 28px; border: none; border-radius: 0; background: none; }
.fl { font-size: 12px; padding: 0 8px; border-radius: 999px; }
#ladder li .nm { flex: 1; }
.fl.surface { color: #bfe9ff; background: rgba(124, 200, 240, .16); }
.fl.swim { color: #c6f0d8; background: rgba(110, 210, 160, .12); }
.fl.floor { color: #e6d2b8; background: rgba(210, 170, 120, .12); }
.hud-next .orb { width: 44px; height: 34px; border: none; border-radius: 0; background: none; }
/* 縦長の絵（タツノオトシゴ）が枠からはみ出さないよう、枠に収まる大きさまで縮める */
#ladder li .orb, .hud-next .orb { display: inline-flex; align-items: center; justify-content: center; }
.orb img { max-width: 100%; max-height: 100%; width: auto; height: auto; display: block; }
.intro-text { max-width: 30em; text-align: left; font-size: 14px; line-height: 1.7; }
.intro-text p { margin: 0 0 8px; }
.nowrap { white-space: nowrap; }
#ladder li .nm { white-space: nowrap; }

/* 言語。要らないほうの文言を伏せる（i18n.js が <html lang> を描画の前に決める） */
html[lang="ja"] [lang="en"],
html[lang="en"] [lang="ja"] { display: none; }

.langbar { display: inline-flex; gap: 4px; }
.langbar button {
  background: none;
  border: 1px solid var(--hair);
  color: var(--dim);
  border-radius: 999px;
  padding: 3px 10px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.langbar button:hover { color: var(--ink); border-color: var(--hair2); }
.langbar button[aria-pressed="true"] { color: var(--gold2); border-color: var(--hair2); background: rgba(124, 200, 240, .08); }

/* 関連アプリ・広告 */
.related-apps { max-width: 1200px; margin: 40px auto 0; background: rgba(255, 255, 255, .03); border: 1px solid var(--hair); border-radius: 12px; padding: 16px; }
.related-apps-title { font-size: 15px; margin: 0 0 10px; }
.related-apps-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.related-app-link {
  display: block;
  padding: 8px 12px;
  border: 1px solid var(--hair);
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none;
  font-size: 14px;
}
.related-app-link:hover { color: var(--gold2); border-color: var(--hair2); }
#ad-section { max-width: 1200px; margin: 16px auto 0; min-height: 0; overflow: hidden; }
.footer-link { color: var(--dim); text-decoration: none; }
.footer-link:hover { color: var(--ink); }
.footer-sep { color: var(--hair2); }

@media (max-width: 760px) {
  .langbar button { padding: 3px 8px; }
  .sb-label { display: none; }
  #site-header { gap: 8px; }
  .soundbtn { padding: 4px 10px; }
}
