/* **hidden 属性を効かせる。**
   `[hidden] { display: none }` はブラウザ既定のスタイルシートの規則なので、
   作者スタイルシートの display に負ける。`.home-callouts { display: grid }` や
   `.site-btn { display: inline-flex }` を付けた要素は、JS が hidden を立てても
   表示されたままになる（トップのデイリーカードとデイリーのモード別ボタンで
   実際に起きた）。個別に `.foo[hidden] { display: none }` を書いて回ると、
   次に display を持つクラスを足したときにまた漏れるので根元で塞ぐ。 */
[hidden] { display: none !important; }

:root {
  --site-bg: #f3efe4;
  --site-bg-end: #ebe3d2; /* body のグラデーション終端。フッターで女の子を隠すのに使う */
  --site-panel: rgba(255, 250, 240, 0.88);
  --site-panel-strong: #fffaf0;
  --site-ink: #102432;
  --site-muted: #536271;
  --site-line: rgba(16, 36, 50, 0.12);
  --site-accent: #c8632a;
  --site-accent-deep: #8d3e14;
  --site-secondary: #0f596c;
  --site-shadow: 0 22px 60px rgba(16, 36, 50, 0.14);
}

/* app.css locks the standalone game UI to the viewport. Site pages need the
   document viewport itself to scroll so Safari can reliably keep sticky UI. */
html {
  height: auto;
  min-height: 100%;
  overflow-x: clip;
  overflow-y: auto;
}

body.site-body {
  height: auto;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: visible;
  background:
    radial-gradient(circle at top left, rgba(200, 99, 42, 0.18), transparent 28%),
    radial-gradient(circle at top right, rgba(15, 89, 108, 0.18), transparent 30%),
    linear-gradient(180deg, #f7f0e4 0%, var(--site-bg) 40%, #ebe3d2 100%);
  color: var(--site-ink);
  font-family: "Hiragino Sans", "Yu Gothic", "Noto Sans JP", sans-serif;
}

body.site-body.game-focus-mode {
  overflow: hidden;
}

body.site-body.game-focus-mode .site-header {
  z-index: 400;
}

.site-shell {
  min-height: 100vh;
  /* 右下のマスコット（z-index: 0）より前に出し、カードやフッターで隠れるようにする。
     中身の z-index（ヘッダー 100 など）はこの積み重ねの中で完結する。 */
  position: relative;
  z-index: 1;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(18px);
  background: rgba(247, 240, 228, 0.88);
  border-bottom: 1px solid var(--site-line);
}

.site-header-inner {
  width: min(1200px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 14px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1 1 auto;
  color: inherit;
  text-decoration: none;
}

.site-brand strong,
.site-brand small {
  display: block;
}

.site-brand > span:last-child {
  min-width: 0;
}

.site-brand small {
  color: var(--site-muted);
  font-size: 0.74rem;
}

.site-brand-mark {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 12px 24px rgba(15, 89, 108, 0.14);
  overflow: hidden;
}

.site-brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.site-nav {
  display: inline-flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.site-nav a,
.section-link,
.inline-link {
  color: var(--site-secondary);
  text-decoration: none;
  font-weight: 600;
}

.site-nav a:hover,
.section-link:hover,
.inline-link:hover {
  color: var(--site-accent-deep);
}

.site-header-right {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
  flex: 0 1 auto;
  gap: 10px;
  flex-wrap: wrap;
}

/* スタミナ表示を押し出さないよう、ヘッダー右側では自分の名前だけが縮む。
   min-width: 0 の連鎖が切れていると #user-name の ellipsis が発動しない（refs #592） */
.site-header-right > .score {
  flex: 0 0 auto;
}

/* ヘッダー右は、スタミナの実値とユーザーメニューが入るまで幅が確定せず、確定した瞬間に
   93px → 174px（モバイル実測）へ広がっていた。CLS への寄与は 0.0015 と小さいが、
   Cloudflare Web Analytics はこれを 1 件のレイアウトシフトとして拾い、ほぼ全ページビューを
   「悪い」へ分類していた（P50〜P99 が揃って 1・要改善 0% という分布のない数字になる）。
   確定後の実測寸法を最初から予約して、シフトそのものを起こさない。 */
.site-header-right {
  min-height: 38px;
}

/* 「⚡ -/-」→「⚡ 12/20 (3:41)」で幅が動く。最大表示ぶんを先に確保しておく。 */
#stamina-display {
  min-width: 5.2em;
}

/* 回復タイマーは毎秒書き換わる。等幅数字にして秒の繰り下がりで幅が動かないようにする。 */
.stamina-timer {
  font-variant-numeric: tabular-nums;
}

/* 実績チップ（#site-collection-chip）は実績を持つユーザーにだけ、コレクション API が
   返ってから現れる。予約が無いとその瞬間にヘッダー右が 205px → 330px（デスクトップ実測）
   へ広がり、ブランドまで押し潰されてシフトする。実績の有無は事前に分からないので、
   チップが入る前提の幅を常に確保する。数字はアイコン 3 個＋残数 3 桁の実測値。 */
.site-header-actions {
  display: inline-flex;
  align-items: center;
  min-width: 260px;
  min-height: 38px;
  gap: 10px;
  /* チップは左に入る。左詰めのままだとチップの出現でメニューが右へ押される
     （デスクトップ実測 117px の移動）。右端に固定して動かさない。 */
  justify-content: flex-end;
}

.site-game-status {
  border-top: 1px solid rgba(16, 36, 50, 0.08);
  background: rgba(255, 250, 240, 0.72);
}

.site-game-status[hidden] {
  display: none;
}

.site-game-status-inner {
  width: min(1200px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 8px 0 10px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, auto);
  align-items: center;
  gap: 8px 14px;
}

/* HUD のボタンはゲームモードが確定してから不要な分が hidden になるため、
   折り返しを許すと「初期 2 行 → 確定後 1 行」で高さが 39px 縮み、ヘッダーごと
   ページ全体が飛び上がる（モバイルで CLS 0.34 を実測）。高さを常に 1 行へ固定し、
   入り切らない分は横スクロールへ逃がす（.game-map-metrics と同じ扱い）。 */
.game-hud-btns {
  display: inline-flex;
  align-items: center;
  grid-column: 1;
  justify-self: start;
  min-width: 0;
  max-width: 100%;
  gap: 6px;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.game-hud-btns::-webkit-scrollbar {
  display: none;
}

/* 1 行に収まらないモード（MineSweeper 等）では flex アイテムが縮み、ボタン内の
   ラベルが折り返して高さが 34px → 78px に伸びてしまう。縮ませず横スクロールへ
   逃がすことで、ボタン数に関係なく高さを 1 行に保つ。 */
.game-hud-btns > * {
  flex-shrink: 0;
}

.game-hud-btns[hidden] {
  display: none;
}

.game-score-group {
  display: inline-flex;
  align-items: center;
  grid-column: 2;
  justify-content: flex-end;
  justify-self: end;
  gap: 10px;
  flex-wrap: wrap;
}

.site-game-status .score {
  color: var(--site-ink);
  font-size: 0.95rem;
}

.site-game-status .score.stamina,
.site-header-right .score.stamina {
  color: var(--site-secondary);
  font-size: 0.9rem;
}

/* 特殊付与で通常上限 5 を超えている状態（app.css の .score.stamina.overflow と同じ意図）。 */
.site-game-status .score.stamina.overflow,
.site-header-right .score.stamina.overflow {
  color: #e0a800;
}

.site-game-status .score.color-swap,
.site-game-status .score.slitherlink-lines,
.site-game-status .score.pathcut-lines {
  color: #27a6d9;
  font-weight: 800;
}

.site-game-status .score.color-swap[hidden],
.site-game-status .score.slitherlink-lines[hidden],
.site-game-status .score.pathcut-lines[hidden] {
  display: none;
}

.site-game-status .score.samegame-info {
  color: #673ab7;
  font-weight: 800;
}

.site-game-status .score.samegame-info[hidden] {
  display: none;
}

.header-btn--samegame-add-row {
  display: inline-grid;
  place-items: center;
  min-width: 42px;
  min-height: 34px;
  padding: 2px 6px;
  background: rgba(103, 58, 183, 0.1);
  border-color: rgba(103, 58, 183, 0.42);
  color: #673ab7;
}

.header-btn--samegame-add-row[hidden] {
  display: none;
}

.header-btn--samegame-add-row:hover {
  background: rgba(103, 58, 183, 0.2);
}

.header-btn--samegame-add-row img {
  display: block;
  width: 30px;
  height: 30px;
  object-fit: contain;
  pointer-events: none;
}

.header-btn--samegame-add-row:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.site-game-status .stamina-timer,
.site-header-right .stamina-timer {
  color: var(--site-muted);
}

.site-game-status .stamina-debug-btn,
.site-header-right .stamina-debug-btn {
  background: rgba(15, 89, 108, 0.08);
  border-color: rgba(15, 89, 108, 0.22);
  color: var(--site-secondary);
}

.site-game-status .stamina-debug-btn:hover,
.site-header-right .stamina-debug-btn:hover {
  background: rgba(15, 89, 108, 0.14);
}

.site-main {
  width: min(1200px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 56px;
}

body.site-body.route-game .site-main {
  padding-top: 6px;
}

.hero-panel,
.page-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(280px, 1fr);
  gap: 22px;
  padding: 32px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 32px;
  background:
    linear-gradient(140deg, rgba(255, 250, 240, 0.96), rgba(255, 244, 229, 0.88)),
    linear-gradient(135deg, rgba(15, 89, 108, 0.08), rgba(200, 99, 42, 0.12));
  box-shadow: var(--site-shadow);
}

.eyebrow,
.section-kicker {
  color: var(--site-accent-deep);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero-panel .hero-copy {
  align-self: center;
}

.hero-panel .hero-copy h1 {
  font-size: clamp(1.5rem, 2.35vw, 2.25rem);
  line-height: 1.16;
  margin: 0;
}

.page-hero h1 {
  font-size: clamp(1.72rem, 3.3vw, 3rem);
  line-height: 1.12;
  margin: 4px 0 12px;
}

.page-summary,
.content-note,
.content-card p,
.empty-state {
  color: var(--site-muted);
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 20px;
  min-height: 46px;
}

.hero-metrics {
  display: grid;
  gap: 10px;
}

.hero-panel .hero-metrics {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.home-callouts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.home-callouts .art-callout {
  grid-template-rows: minmax(0, 1fr) auto;
}

.art-callout {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  margin-top: 22px;
  padding: 20px 22px;
  border: 1px solid rgba(200, 99, 42, 0.24);
  border-radius: 24px;
  background:
    linear-gradient(135deg, rgba(255, 250, 240, 0.98), rgba(255, 239, 218, 0.94)),
    var(--site-panel);
  box-shadow: 0 14px 32px rgba(16, 36, 50, 0.08);
}

.art-callout-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 18px;
  background: rgba(200, 99, 42, 0.12);
  font-size: 1.65rem;
}

/* 今日の盤面プレビュー。他のカードのアイコン（54px の絵文字）より大きく取る。
   デイリーは主要導線なので、モード名の文字だけでなく盤面そのもので引きたい。 */
.daily-callout .art-callout-icon.daily-preview {
  width: 108px;
  height: 108px;
  padding: 6px;
  border-radius: 20px;
  /* 盤面の下地（pixi-renderer が塗る色）と馴染ませる。 */
  background: rgba(16, 36, 50, 0.10);
}

.daily-preview-stage {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 14px;
  overflow: hidden;
}

.daily-preview-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* 盤面が出たら絵文字は引っ込める。 */
.daily-preview-stage:not([hidden]) + .daily-preview-fallback,
.daily-preview:has(.daily-preview-stage:not([hidden])) .daily-preview-fallback {
  display: none;
}

@media (max-width: 640px) {
  .daily-callout .art-callout-icon.daily-preview {
    width: 76px;
    height: 76px;
  }
}

.art-callout-copy h2 {
  margin: 2px 0 4px;
  font-size: clamp(1.18rem, 2vw, 1.55rem);
}

.art-callout-copy p:last-child {
  margin: 0;
  color: var(--site-muted);
  line-height: 1.6;
}

.art-callout-actions {
  display: flex;
  grid-column: 1 / -1;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.feedback-callout {
  border-color: rgba(15, 89, 108, 0.24);
  background:
    linear-gradient(135deg, rgba(239, 250, 250, 0.98), rgba(222, 241, 243, 0.94)),
    var(--site-panel);
}

.feedback-callout .art-callout-icon {
  background: rgba(15, 89, 108, 0.12);
}

.feedback-callout .site-link-btn.primary {
  background: linear-gradient(135deg, var(--site-secondary), #19829a);
  box-shadow: 0 12px 28px rgba(15, 89, 108, 0.2);
}

.support-callout {
  border-color: rgba(190, 80, 110, 0.24);
  background:
    linear-gradient(135deg, rgba(255, 246, 249, 0.98), rgba(253, 228, 236, 0.94)),
    var(--site-panel);
}

.support-callout .art-callout-icon {
  background: rgba(190, 80, 110, 0.12);
}

.support-callout-qr {
  width: 96px;
  height: 96px;
  border-radius: 8px;
}

@media (max-width: 767px) {
  .support-callout-qr {
    display: none;
  }
}

.support-callout .site-link-btn.primary {
  background: linear-gradient(135deg, #be506e, #d9708c);
  box-shadow: 0 12px 28px rgba(190, 80, 110, 0.2);
}

.metric-tile {
  padding: 16px 18px;
  border-radius: 20px;
  background: var(--site-panel);
  border: 1px solid var(--site-line);
}

.metric-tile strong {
  display: block;
  font-size: clamp(1.45rem, 2.2vw, 1.95rem);
  line-height: 1.05;
}

.metric-tile span {
  color: var(--site-muted);
  font-size: 0.84rem;
}

.site-btn,
.site-link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.site-btn:hover,
.site-link-btn:hover {
  transform: translateY(-1px);
}

.site-btn-primary,
.site-link-btn.primary {
  background: linear-gradient(135deg, var(--site-accent), #d7823c);
  color: #fff9f2;
  box-shadow: 0 12px 28px rgba(200, 99, 42, 0.22);
}

.site-btn-secondary,
.site-link-btn.secondary {
  background: rgba(15, 89, 108, 0.08);
  color: var(--site-secondary);
  border-color: rgba(15, 89, 108, 0.2);
}

.site-btn-ghost {
  background: rgba(255, 255, 255, 0.66);
  color: var(--site-ink);
  border-color: var(--site-line);
}

.site-user-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--site-line);
  color: var(--site-ink);
}

.site-user-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.site-user-icon-default {
  font-size: 1.1rem;
  line-height: 1;
}


.site-user-dropdown {
  position: relative;
  min-width: 0;
  max-width: 100%;
}

.site-user-avatar-btn {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  max-width: 100%;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--site-line);
  color: var(--site-ink);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: background 0.16s ease;
}

.site-user-avatar-btn .user-id {
  min-width: 0;
  overflow: hidden;
  flex-wrap: nowrap;
}

.site-user-avatar-btn #user-icon {
  flex-shrink: 0;
}

.site-user-avatar-btn #user-name {
  display: block;
  min-width: 0;
  /* 上限ではなく固定幅にする。max-width だと「認証前は空(0px) → 確定後は名前の長さ」
     で幅が動き、そのぶんヘッダー全体がシフトしていた。入り切らない名前は ellipsis。
     短い名前だと余りが出るので、左寄せにしてアイコンの隣に付ける
     （中央寄せのままだと名前がボタンの中で浮いて見える）。 */
  width: 8rem;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-user-avatar-btn:hover {
  background: rgba(255, 255, 255, 0.96);
}

.site-dropdown-caret {
  font-size: 0.75rem;
  color: var(--site-muted);
}

.site-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 140px;
  background: var(--site-panel-strong);
  border: 1px solid var(--site-line);
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(16, 36, 50, 0.14);
  overflow: hidden;
  z-index: 200;
  display: flex;
  flex-direction: column;
}

.site-dropdown-menu[hidden] {
  display: none;
}

.site-dropdown-item {
  display: block;
  width: 100%;
  padding: 12px 18px;
  text-align: left;
  color: var(--site-ink);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  background: none;
  border: none;
  cursor: pointer;
  transition: background 0.12s ease;
}

.site-dropdown-item:hover {
  background: rgba(16, 36, 50, 0.06);
}

.site-dropdown-item-primary {
  color: var(--site-accent-deep);
}

.site-dropdown-auth-warning {
  max-width: 260px;
  margin: 0;
  padding: 10px 18px 0;
  color: var(--site-accent-deep);
  font-size: 0.75rem;
  line-height: 1.5;
}

.anonymous-auth-notice {
  position: fixed;
  right: 1rem;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 1rem);
  z-index: 210;
  width: min(420px, calc(100vw - 2rem));
  padding: 1rem;
  border: 1px solid var(--site-line);
  border-radius: 14px;
  background: var(--site-panel-strong);
  box-shadow: var(--site-shadow);
  color: var(--site-ink);
}

.anonymous-auth-notice p {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  line-height: 1.6;
}

.anonymous-auth-notice-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.anonymous-auth-notice-actions button {
  padding: 0.4rem 0.7rem;
  border: 1px solid var(--site-line);
  border-radius: 8px;
  background: var(--site-panel);
  color: var(--site-ink);
  cursor: pointer;
}

.anonymous-auth-notice-actions button:first-child {
  background: var(--site-secondary);
  color: #fff;
}

.anonymous-auth-notice-actions button:last-child {
  margin-left: auto;
}

.section-block {
  margin-top: 34px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.section-heading h2,
.content-card h2 {
  margin-top: 6px;
  font-size: clamp(1.35rem, 2.2vw, 2rem);
}

.map-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.compact-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.leaderboard-panel {
  padding: 12px;
  border-radius: 28px;
  background:
    linear-gradient(160deg, rgba(255, 250, 240, 0.96), rgba(255, 244, 229, 0.9)),
    linear-gradient(135deg, rgba(15, 89, 108, 0.06), rgba(200, 99, 42, 0.08));
  border: 1px solid rgba(255, 255, 255, 0.65);
  box-shadow: 0 18px 38px rgba(16, 36, 50, 0.08);
}

.home-leaderboard {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.home-leaderboard-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(16, 36, 50, 0.08);
}

.home-leaderboard-gap {
  text-align: center;
  color: var(--site-muted);
}

.home-leaderboard-item.me {
  background: linear-gradient(135deg, rgba(200, 99, 42, 0.12), rgba(15, 89, 108, 0.08)), rgba(255, 255, 255, 0.92);
  border-color: rgba(200, 99, 42, 0.28);
}

.home-leaderboard-rank {
  display: inline-grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(15, 89, 108, 0.12), rgba(200, 99, 42, 0.18));
  color: var(--site-accent-deep);
  font-size: 1.05rem;
  font-weight: 800;
}

.home-leaderboard-main {
  min-width: 0;
}

.home-leaderboard-name {
  min-width: 0;
  font-weight: 700;
}

.home-leaderboard-name .player-chip {
  max-width: 100%;
}

.home-leaderboard-subtext,
.home-leaderboard-score span {
  color: var(--site-muted);
  font-size: 0.84rem;
}

.home-leaderboard-score {
  display: grid;
  justify-items: end;
  gap: 2px;
  text-align: right;
}

.home-leaderboard-score strong {
  font-size: clamp(1.05rem, 1.8vw, 1.35rem);
  line-height: 1;
}

.collection-owner {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
  max-width: 100%;
  margin-bottom: 1rem;
  font-size: 1.15rem;
  /* 誰のコレクションかは fetch が返るまで分からない。hidden から起こすと 28px の行が
     生まれて下がまるごと押し下がるので、高さは最初から確保して中身だけ伏せる。 */
  min-height: 28px;
}

.collection-owner.is-pending > * {
  visibility: hidden;
}

#collection-owner-profile {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
}

.collection-owner > strong {
  flex: 0 0 auto;
  white-space: nowrap;
}

.collection-owner[hidden] {
  display: none;
}

.map-card {
  display: block;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  min-height: 300px;
  border-radius: 24px;
  background: var(--site-panel-strong);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 18px 34px rgba(16, 36, 50, 0.12);
}

.map-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(16, 36, 50, 0.06), rgba(16, 36, 50, 0.68));
  opacity: 0.96;
  z-index: 1;
}

.map-card-media {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at top right, rgba(255, 255, 255, 0.38), transparent 24%),
    linear-gradient(135deg, #0f596c, #c8632a);
  background-size: cover;
  background-position: center;
  transform: scale(1.02);
  image-rendering: pixelated;
}

/* CLS 対策: カタログ／ランキングの取得中も実データと同じ高さを確保し、
   読み込み完了時に下のセクションが押し下がらないようにする。 */
.map-card-skeleton {
  position: relative;
  min-height: 300px;
  overflow: hidden;
  border-radius: 24px;
  background: var(--site-panel-strong);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 18px 34px rgba(16, 36, 50, 0.12);
}

.map-card-skeleton::after,
.home-leaderboard-skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, 0.42) 50%, transparent 80%);
  transform: translateX(-100%);
  animation: skeleton-sheen 1.4s ease-in-out infinite;
}

.home-leaderboard-skeleton {
  position: relative;
  overflow: hidden;
}

.hero-panel {
  grid-template-columns: minmax(280px, 0.85fr) minmax(0, 1.65fr);
}

.home-leaderboard-skeleton .home-leaderboard-rank,
.home-leaderboard-skeleton .placeholder-line {
  color: transparent;
  background: rgba(16, 36, 50, 0.08);
  border-radius: 8px;
}

.home-leaderboard-skeleton .home-leaderboard-rank {
  background: rgba(16, 36, 50, 0.08);
}

@keyframes skeleton-sheen {
  to { transform: translateX(100%); }
}

@media (prefers-reduced-motion: reduce) {
  .map-card-skeleton::after,
  .home-leaderboard-skeleton::after {
    animation: none;
  }
}

.map-card-body {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 300px;
  padding: 20px;
  color: #fff7f0;
}

.map-card-topline {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  align-items: start;
  margin-bottom: auto;
}

.map-badge-row,
.map-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.map-badge,
.map-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 250, 240, 0.16);
  border: 1px solid rgba(255, 250, 240, 0.28);
  backdrop-filter: blur(10px);
  font-size: 0.8rem;
}

.map-mode-badge {
  font-weight: 800;
  letter-spacing: 0;
  color: #fffaf0;
  border-color: rgba(255, 250, 240, 0.42);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.16);
}

.map-mode-badge--mine {
  background: rgba(200, 99, 42, 0.74);
}

.map-mode-badge--color {
  background: rgba(39, 166, 217, 0.74);
}

.map-mode-badge--mosaic {
  background: rgba(78, 91, 107, 0.78);
}

.map-mode-badge--nikaku {
  background: rgba(67, 160, 71, 0.74);
}

.map-mode-badge--sudoku_swap {
  background: rgba(57, 73, 171, 0.74);
}

.map-mode-badge--loop {
  background: rgba(0, 121, 107, 0.74);
}

.map-card h3 {
  font-size: 1.45rem;
  margin-bottom: 8px;
}

.map-card p {
  color: rgba(255, 247, 240, 0.9);
  line-height: 1.6;
  margin-bottom: 14px;
}

.map-card-footer {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
}

.map-progress-bar {
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.16);
  margin: 14px 0 8px;
}

.map-progress-bar > span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #f7cf73, #f29a4a);
}

.service-guide {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 34px;
}

.guide-card,
.content-card {
  padding: 24px;
  border-radius: 24px;
  background: var(--site-panel);
  border: 1px solid var(--site-line);
  box-shadow: 0 16px 34px rgba(16, 36, 50, 0.08);
}

.guide-card-accent {
  background: linear-gradient(160deg, rgba(15, 89, 108, 0.08), rgba(200, 99, 42, 0.08)), var(--site-panel);
}

.guide-list {
  margin-top: 14px;
  padding-left: 20px;
  color: var(--site-ink);
  line-height: 1.8;
}

.guide-list.compact {
  margin-top: 12px;
}

.game-map-titlebar {
  padding: 14px 0 10px;
}

.game-map-titlebar h1 {
  font-size: clamp(1.4rem, 2.4vw, 2rem);
  line-height: 1.2;
  margin: 0;
}

.game-private-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 3px 10px;
  vertical-align: middle;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: #fff0e8;
  color: #b94712;
  border: 1px solid rgba(185, 71, 18, 0.34);
}

[data-theme="dark"] .game-private-badge {
  background: rgba(185, 71, 18, 0.22);
  color: #f5a06a;
  border-color: rgba(245, 160, 106, 0.3);
}

.game-map-summary {
  margin: 6px 0 0;
  font-size: 0.7rem;
  line-height: 1.5;
  color: var(--site-muted);
  white-space: pre-line;
}
.game-map-summary a {
  color: var(--site-secondary);
  text-decoration: underline;
  word-break: break-all;
}

.game-map-meta {
  padding: 14px 0 2px;
}

.game-map-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: flex-start;
}

.game-metric-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(255, 250, 240, 0.12);
  border: 1px solid rgba(255, 250, 240, 0.22);
  backdrop-filter: blur(10px);
}

.game-metric-value {
  font-size: clamp(1.05rem, 1.85vw, 1.55rem);
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.game-metric-label {
  color: var(--site-muted);
  font-size: 0.9rem;
  line-height: 1;
  white-space: nowrap;
}

.game-shell {
  margin-top: 4px;
}

.game-focus-toolbar {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 5;
  display: flex;
  justify-content: flex-end;
  pointer-events: none;
}

.game-focus-toggle {
  pointer-events: auto;
  border: 1px solid rgba(255, 250, 240, 0.28);
  background: rgba(16, 36, 50, 0.72);
  color: #f7efe6;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.82rem;
  font-weight: 700;
  backdrop-filter: blur(12px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.24);
}

.app-wrapper {
  position: relative;
  inset: auto;
  min-height: 0;
  height: clamp(560px, calc(100svh - 135px), 900px);
  border-radius: 28px;
  overflow: hidden;
  border: 1px solid rgba(16, 36, 50, 0.12);
  box-shadow: 0 22px 60px rgba(16, 36, 50, 0.14);
  background: #15232c;
}

body.site-body.game-focus-mode .app-wrapper {
  position: fixed;
  top: var(--game-focus-top-offset, 0px);
  right: 0;
  bottom: 0;
  left: 0;
  width: 100vw;
  height: calc(100dvh - var(--game-focus-top-offset, 0px));
  border-radius: 0;
  border-width: 0;
  z-index: 300;
}

body.site-body.game-focus-mode .game-shell {
  margin-top: 0;
}

body.site-body.game-focus-mode .game-map-titlebar,
body.site-body.game-focus-mode .game-map-meta,
body.site-body.game-focus-mode .game-view > .section-block,
body.site-body.game-focus-mode .site-footer {
  display: none;
}

.game-stage {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
}

.site-footer {
  width: min(1200px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 0 0 44px;
  color: var(--site-muted);
  /* 背景を塗ってマスコットを隠す。左右は箱の外まで同じ色で伸ばす（クリップは縦方向だけ）。 */
  background: var(--site-bg-end);
  box-shadow: 0 0 0 100vmax var(--site-bg-end);
  clip-path: inset(0 -100vmax);
}

.home-view[hidden],
.game-view[hidden] {
  display: none;
}

/* どちらのビューを描くかは lang-boot.js が head で data-route に確定させる。
   site.js（module）の boot を待たずに済むので、/game/:id を直接開いたときに
   ホームが数秒見えてから切り替わることがなくなる。data-route が付かない
   （JS 無効）場合はホームだけを描く従来どおりの挙動になる。 */
html:not([data-route="game"]) #game-view {
  display: none;
}

html[data-route="game"] #home-view {
  display: none;
}

@media (max-width: 1100px) {
  .map-grid,
  .compact-grid,
  .service-guide,
  .hero-panel,
  .page-hero {
    grid-template-columns: 1fr;
  }

  .game-map-metrics {
    grid-template-columns: 1fr;
  }

  .app-wrapper {
    height: clamp(520px, calc(100svh - 115px), 820px);
  }
}

@media (max-width: 760px) {
  .section-heading,
  .map-card-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .site-header-inner {
    width: min(100vw - 16px, 1200px);
    padding: 10px 0;
    gap: 6px;
    flex-direction: row;
    align-items: center;
    /* はみ出しの元。子が縮まずに横スクロールが出ていた。 */
    min-width: 0;
  }

  .site-brand {
    gap: 8px;
  }

  /* 実績チップぶんを常に予約する以上、狭い画面ではブランドが横幅を譲る。
     「World Sweeper」を 2 行に折り、そのぶん字を落とす。2 行でもヘッダー右の
     38px に収まるので、ヘッダー自体は厚くならない。 */
  .site-brand strong {
    font-size: 0.72rem;
    line-height: 1.15;
    white-space: normal;
    /* 最初から 2 行で確定させる。1 行で始めるとチップが出て幅が狭まった瞬間に
       1 行 → 2 行へ変わり、そこが新しいシフト源になる。 */
    display: block;
    max-width: 5em;
  }

  /* タグラインはスマホでは出さない。
     スタミナ・実績チップ・ユーザー名と横幅を取り合い、はみ出してページ全体に
     横スクロールが出ていた。ブランド名だけ残せば用は足りる。 */
  .site-brand small {
    display: none;
  }

  .site-brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 10px;
  }

  .site-header-right {
    flex: 0 1 auto;
    flex-wrap: nowrap;
    gap: 6px;
    min-width: 0;
    /* 予約する寸法は画面幅で変わる（実測: モバイルは 111x34、デスクトップは 120x38）。 */
    min-height: 34px;
  }

  /* 狭い画面はチップのアイコンが 1 個だけになる。ただしメニュー側の幅が表示名の
     長さで 82〜111px と動くので、その最大ぶんまで見込んで確保する
     （チップ 70 + gap 10 + メニュー 111 = 191px に余裕を足す）。 */
  .site-header-actions {
    min-width: 200px;
    min-height: 34px;
  }

  .site-user-avatar-btn {
    padding: 6px 8px;
    font-size: 0.78rem;
  }

  .site-user-avatar-btn .user-id {
    gap: 0.28rem;
  }

  .site-user-avatar-btn #user-name {
    width: 4.5rem;
  }

  /* 実績チップはスマホではアイコン1つと残数だけ（app.css 側でも絞っているが、
     ヘッダーの取り合いを確実に避けるため余白もここで詰める）。 */
  .site-collection-chip {
    padding: 4px 6px;
    gap: 2px;
  }

  .site-nav {
    width: 100%;
    order: 3;
  }

  .site-game-status-inner {
    width: min(100vw - 20px, 1200px);
    grid-template-columns: 1fr;
  }

  .game-hud-btns {
    grid-column: 1;
    justify-self: center;
    gap: 4px;
  }

  .game-score-group {
    grid-column: 1;
    justify-self: center;
    justify-content: center;
    gap: 8px;
  }

  .map-grid,
  .compact-grid {
    grid-template-columns: 1fr;
  }

  .home-leaderboard-item {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .home-leaderboard-score {
    grid-column: 1 / -1;
    justify-items: start;
    text-align: left;
    padding-left: calc(2.5rem + 14px);
  }

  .hero-panel,
  .page-hero,
  .guide-card,
  .content-card {
    padding: 22px;
  }

  .art-callout {
    grid-template-columns: auto minmax(0, 1fr);
    padding: 18px;
  }

  .home-callouts {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .art-callout-actions {
    grid-column: 1 / -1;
    justify-content: stretch;
  }

  .art-callout-actions .site-link-btn {
    flex: 1 1 180px;
  }

  .game-map-titlebar {
    padding: 10px 0 8px;
  }

  .game-map-titlebar h1 {
    font-size: clamp(1.3rem, 5vw, 1.8rem);
  }

  .game-map-metrics {
    gap: 6px;
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .game-map-metrics::-webkit-scrollbar {
    display: none;
  }

  .game-metric-chip {
    flex: 0 0 auto;
    min-height: 38px;
    padding: 6px 10px;
    gap: 6px;
  }

  .game-metric-value {
    font-size: clamp(0.9rem, 4vw, 1.08rem);
  }

  .game-metric-label {
    font-size: 0.72rem;
  }

  .site-main {
    width: min(100vw - 20px, 1200px);
  }

  body.site-body.route-game .site-main {
    padding-top: 4px;
  }

  .hero-copy h1,
  .page-hero h1 {
    font-size: clamp(1.42rem, 7vw, 2.15rem);
    line-height: 1.16;
  }

  .hero-panel .hero-copy h1 {
    font-size: clamp(1.3rem, 5.8vw, 1.8rem);
  }

  .hero-panel .hero-metrics {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .hero-panel .metric-tile {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
  }

  .metric-tile strong {
    font-size: clamp(1.18rem, 6vw, 1.6rem);
  }

  .metric-tile span {
    font-size: 0.78rem;
  }

  .site-footer {
    width: min(100vw - 20px, 1200px);
  }

  .app-wrapper {
    height: clamp(320px, 54svh, 520px);
  }

  .game-focus-toolbar {
    top: calc(env(safe-area-inset-top, 0px) + 10px);
    right: 10px;
  }

  body.site-body.game-focus-mode .game-focus-toolbar {
    right: max(10px, env(safe-area-inset-right, 0px));
    top: max(10px, env(safe-area-inset-top, 0px));
  }
}

/* ===== Dark mode / System theme ===== */

[data-theme="dark"],
[data-theme="system"] {
  --site-bg: #111c26;
  --site-bg-end: #131f2a;
  --site-panel: rgba(20, 34, 48, 0.92);
  --site-panel-strong: #162130;
  --site-ink: #dce8f0;
  --site-muted: #7fa0b8;
  --site-line: rgba(220, 232, 240, 0.10);
  --site-accent: #e07840;
  --site-accent-deep: #c8632a;
  --site-secondary: #4ab8d4;
  --site-shadow: 0 22px 60px rgba(0, 0, 0, 0.35);
}

[data-theme="dark"] body.site-body,
[data-theme="system"] body.site-body {
  background:
    radial-gradient(circle at top left, rgba(180, 80, 20, 0.12), transparent 28%),
    radial-gradient(circle at top right, rgba(10, 60, 90, 0.15), transparent 30%),
    linear-gradient(180deg, #111c26 0%, #0e1820 40%, #131f2a 100%);
}

[data-theme="dark"] .site-header,
[data-theme="system"] .site-header {
  background: rgba(14, 24, 32, 0.88);
  border-bottom-color: rgba(220, 232, 240, 0.10);
}

[data-theme="dark"] .site-game-status,
[data-theme="system"] .site-game-status {
  background: rgba(14, 24, 32, 0.72);
  border-top-color: rgba(220, 232, 240, 0.08);
}

[data-theme="dark"] .site-user-avatar-btn,
[data-theme="system"] .site-user-avatar-btn {
  background: rgba(220, 232, 240, 0.08);
  border-color: rgba(220, 232, 240, 0.16);
}

[data-theme="dark"] .site-user-avatar-btn:hover,
[data-theme="system"] .site-user-avatar-btn:hover {
  background: rgba(220, 232, 240, 0.14);
}

[data-theme="dark"] .site-nav a,
[data-theme="system"] .site-nav a {
  color: var(--site-muted);
}

[data-theme="dark"] .site-nav a:hover,
[data-theme="system"] .site-nav a:hover {
  color: var(--site-ink);
}

[data-theme="dark"] .site-link-btn.secondary,
[data-theme="system"] .site-link-btn.secondary {
  background: rgba(220, 232, 240, 0.08);
  border-color: rgba(220, 232, 240, 0.18);
  color: var(--site-ink);
}

/* admin-page dark overrides */
[data-theme="dark"] .admin-panel,
[data-theme="system"] .admin-panel {
  background: var(--site-panel-strong);
  border-color: var(--site-line);
  color: var(--site-ink);
}

[data-theme="dark"] .admin-page .profile-input,
[data-theme="system"] .admin-page .profile-input {
  background-color: #1e2d3a;
  border-color: rgba(220, 232, 240, 0.18);
  color: var(--site-ink);
}

[data-theme="dark"] .admin-page .profile-input::placeholder,
[data-theme="system"] .admin-page .profile-input::placeholder {
  color: rgba(220, 232, 240, 0.3);
}

[data-theme="dark"] .admin-page select.profile-input,
[data-theme="system"] .admin-page select.profile-input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%237fa0b8'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
  background-size: 10px 6px;
  appearance: none;
  padding-right: 1.8rem;
}

[data-theme="dark"] .drop-zone,
[data-theme="system"] .drop-zone {
  background: rgba(220, 232, 240, 0.04);
  border-color: rgba(220, 232, 240, 0.15);
}

[data-theme="dark"] .image-preview,
[data-theme="system"] .image-preview {
  background: rgba(220, 232, 240, 0.04);
  border-color: rgba(220, 232, 240, 0.10);
}

[data-theme="dark"] .admin-map-list li,
[data-theme="system"] .admin-map-list li {
  border-bottom-color: rgba(220, 232, 240, 0.10);
}

/* system: OSがダークならダーク適用 */
@media (prefers-color-scheme: dark) {
  [data-theme="system"] {
    --site-bg: #111c26;
    --site-bg-end: #131f2a;
    --site-panel: rgba(20, 34, 48, 0.92);
    --site-panel-strong: #162130;
    --site-ink: #dce8f0;
    --site-muted: #7fa0b8;
    --site-line: rgba(220, 232, 240, 0.10);
    --site-accent: #e07840;
    --site-accent-deep: #c8632a;
    --site-secondary: #4ab8d4;
    --site-shadow: 0 22px 60px rgba(0, 0, 0, 0.35);
  }
}

@media (prefers-color-scheme: light) {
  [data-theme="system"] {
    --site-bg: #f3efe4;
    --site-bg-end: #ebe3d2;
    --site-panel: rgba(255, 250, 240, 0.88);
    --site-panel-strong: #fffaf0;
    --site-ink: #102432;
    --site-muted: #536271;
    --site-line: rgba(16, 36, 50, 0.12);
    --site-accent: #c8632a;
    --site-accent-deep: #8d3e14;
    --site-secondary: #0f596c;
    --site-shadow: 0 22px 60px rgba(16, 36, 50, 0.14);
  }
}

/* theme toggle button */
.theme-btn-group {
  display: inline-flex;
}

.theme-btn-group button {
  background: none;
  border: 1px solid var(--site-line);
  color: var(--site-muted);
  font-size: 0.78rem;
  padding: 0.3rem 0.7rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
  margin-left: -1px;
}

.theme-btn-group button:first-child {
  border-radius: 999px 0 0 999px;
  margin-left: 0;
}

.theme-btn-group button:last-child {
  border-radius: 0 999px 999px 0;
}

.theme-btn-group button.active {
  background: var(--site-secondary);
  color: #fff;
  border-color: var(--site-secondary);
  position: relative;
  z-index: 1;
}

.theme-btn-group button:hover:not(.active) {
  background: var(--site-line);
  color: var(--site-ink);
}

/* hero-panel / metric-tile dark overrides */
[data-theme="dark"] .hero-panel,
[data-theme="dark"] .page-hero,
[data-theme="system"] .hero-panel,
[data-theme="system"] .page-hero {
  background:
    linear-gradient(140deg, rgba(20, 34, 50, 0.96), rgba(16, 28, 44, 0.90)),
    linear-gradient(135deg, rgba(10, 60, 80, 0.15), rgba(180, 80, 20, 0.10));
  border-color: rgba(220, 232, 240, 0.08);
}

[data-theme="dark"] .metric-tile,
[data-theme="system"] .metric-tile {
  background: rgba(220, 232, 240, 0.05);
  border-color: rgba(220, 232, 240, 0.10);
}

[data-theme="dark"] .content-card,
[data-theme="system"] .content-card {
  background: var(--site-panel-strong);
  border-color: var(--site-line);
}

[data-theme="dark"] .art-callout,
[data-theme="system"] .art-callout {
  background:
    linear-gradient(135deg, rgba(61, 43, 35, 0.96), rgba(43, 36, 39, 0.94)),
    var(--site-panel-strong);
  border-color: rgba(223, 145, 86, 0.24);
}

[data-theme="dark"] .feedback-callout,
[data-theme="system"] .feedback-callout {
  background:
    linear-gradient(135deg, rgba(22, 55, 66, 0.96), rgba(20, 38, 52, 0.94)),
    var(--site-panel-strong);
  border-color: rgba(74, 184, 212, 0.22);
}

/* press page */
.press-main {
  display: grid;
  gap: 0;
}

.press-hero {
  align-items: center;
}

.press-note {
  margin-top: 18px;
}

.press-quote {
  margin: 0 0 18px;
  padding: 20px 22px;
  border-left: 4px solid var(--site-accent);
  border-radius: 18px;
  background: rgba(200, 99, 42, 0.08);
  color: var(--site-ink);
  font-size: clamp(1.12rem, 2vw, 1.45rem);
  line-height: 1.6;
  font-weight: 700;
}

.press-facts,
.press-contact {
  margin: 0;
  display: grid;
  gap: 12px;
}

.press-facts div,
.press-contact div {
  display: grid;
  grid-template-columns: minmax(120px, 180px) minmax(0, 1fr);
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--site-line);
}

.press-facts div:last-child,
.press-contact div:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.press-facts dt,
.press-contact dt {
  color: var(--site-muted);
  font-weight: 700;
}

.press-facts dd,
.press-contact dd {
  margin: 0;
  color: var(--site-ink);
}

.press-feature-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.press-shot-grid,
.press-download-grid,
.press-qa-list {
  display: grid;
  gap: 18px;
}

.press-shot-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.press-shot-card {
  padding: 18px;
}

.press-shot-link {
  display: block;
}

.press-shot-card img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  border-radius: 18px;
  border: 1px solid var(--site-line);
  background: rgba(16, 36, 50, 0.08);
}

.press-shot-card figcaption {
  margin-top: 14px;
  color: var(--site-muted);
  line-height: 1.7;
}

.press-download-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.press-download-card {
  display: grid;
  gap: 6px;
  text-decoration: none;
  color: inherit;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.press-download-card:hover {
  transform: translateY(-1px);
  border-color: rgba(200, 99, 42, 0.3);
  box-shadow: 0 18px 36px rgba(16, 36, 50, 0.1);
}

.press-download-card strong {
  font-size: 1.04rem;
}

.press-download-card span {
  color: var(--site-muted);
  line-height: 1.7;
}

.press-qa-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.press-qa-list h3 {
  font-size: 1.08rem;
  margin-bottom: 10px;
}

/* artwork submission page */
.submission-page .section-block {
  margin-top: clamp(42px, 6vw, 72px);
}

.submission-card {
  padding: clamp(22px, 3vw, 32px);
}

.submission-key-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.submission-key-item {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
  padding: 20px;
  border: 1px solid rgba(15, 89, 108, 0.14);
  border-radius: 20px;
  background: rgba(15, 89, 108, 0.06);
}

.submission-key-item.is-deadline {
  border-color: rgba(200, 99, 42, 0.2);
  background: linear-gradient(135deg, rgba(200, 99, 42, 0.12), rgba(247, 207, 115, 0.13));
}

.submission-key-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  border-radius: 17px;
  background: var(--site-panel-strong);
  color: var(--site-accent-deep);
  box-shadow: 0 8px 22px rgba(16, 36, 50, 0.09);
  font-size: 1.05rem;
  font-weight: 800;
}

.submission-key-label,
.submission-key-value,
.submission-card-kicker,
.submission-apply-lead,
.submission-login-note {
  margin: 0;
}

.submission-key-label {
  color: var(--site-muted);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.submission-key-value {
  display: grid;
  gap: 3px;
  margin-top: 5px;
  color: var(--site-ink);
}

.submission-key-value strong {
  font-size: clamp(1.08rem, 2vw, 1.35rem);
  line-height: 1.35;
}

.submission-key-value span {
  color: var(--site-muted);
  font-size: 0.84rem;
  line-height: 1.5;
}

.submission-note {
  margin-top: 18px;
  padding: 19px 20px 19px 24px;
  border-left: 4px solid var(--site-secondary);
  border-radius: 8px 18px 18px 8px;
  background: rgba(15, 89, 108, 0.055);
}

.submission-note h3,
.submission-guideline-item h3,
.submission-rights-card h3 {
  margin: 0;
  color: var(--site-ink);
}

.submission-note h3 {
  font-size: 1rem;
}

.submission-note p {
  margin: 6px 0 0;
}

.submission-selection-list {
  display: grid;
  gap: 7px;
  margin: 10px 0 0;
  padding-left: 1.25rem;
  color: var(--site-muted);
  line-height: 1.65;
}

.submission-selection-list li::marker {
  color: var(--site-secondary);
}

.submission-selection-list strong {
  color: var(--site-ink);
}

.submission-spec-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 0;
}

.submission-spec-grid > div {
  padding: 20px;
  border-radius: 20px;
  background: linear-gradient(145deg, rgba(16, 36, 50, 0.045), rgba(15, 89, 108, 0.07));
}

.submission-spec-grid dt {
  color: var(--site-muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.submission-spec-grid dd {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin: 8px 0 0;
}

.submission-spec-grid dd strong {
  color: var(--site-ink);
  font-size: clamp(1.12rem, 2vw, 1.4rem);
}

.submission-spec-grid dd span {
  color: var(--site-muted);
  font-size: 0.82rem;
}

.submission-guideline-list {
  display: grid;
  margin-top: 22px;
  border-top: 1px solid var(--site-line);
}

.submission-guideline-item {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 16px;
  padding: 22px 2px;
  border-bottom: 1px solid var(--site-line);
}

.submission-guideline-item:last-child {
  padding-bottom: 2px;
  border-bottom: 0;
}

.submission-guideline-number {
  color: var(--site-accent);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.submission-guideline-item h3 {
  font-size: 1.04rem;
}

.submission-guideline-item p {
  margin: 6px 0 0;
}

.submission-rights-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.submission-rights-card {
  position: relative;
  overflow: hidden;
  padding: 26px;
}

.submission-rights-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: linear-gradient(180deg, var(--site-accent), #e4a34d);
}

.submission-card-kicker {
  color: var(--site-accent-deep) !important;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.submission-rights-card h3 {
  margin-top: 8px;
  font-size: 1.18rem;
}

.submission-rights-card p:last-child {
  margin: 12px 0 0;
}

.submission-apply-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  background:
    linear-gradient(135deg, rgba(15, 89, 108, 0.07), rgba(200, 99, 42, 0.08)),
    var(--site-panel);
}

.submission-apply-lead {
  color: var(--site-ink) !important;
  font-size: 1.04rem;
  font-weight: 700;
}

.submission-login-note {
  margin-top: 8px;
  font-size: 0.84rem;
}

.submission-apply-actions {
  flex: 0 0 auto;
  margin-top: 0;
}

[data-theme="dark"] .submission-key-item,
[data-theme="system"] .submission-key-item {
  border-color: rgba(220, 232, 240, 0.11);
  background: rgba(220, 232, 240, 0.045);
}

[data-theme="dark"] .submission-key-item.is-deadline,
[data-theme="system"] .submission-key-item.is-deadline {
  border-color: rgba(224, 120, 64, 0.2);
  background: linear-gradient(135deg, rgba(224, 120, 64, 0.12), rgba(247, 207, 115, 0.05));
}

[data-theme="dark"] .submission-note,
[data-theme="system"] .submission-note {
  background: rgba(74, 184, 212, 0.065);
}

[data-theme="dark"] .submission-spec-grid > div,
[data-theme="system"] .submission-spec-grid > div {
  background: linear-gradient(145deg, rgba(220, 232, 240, 0.035), rgba(74, 184, 212, 0.06));
}

[data-theme="dark"] .submission-card-kicker,
[data-theme="system"] .submission-card-kicker {
  color: var(--site-accent) !important;
}

@media (max-width: 1100px) {
  .press-feature-grid,
  .press-shot-grid,
  .press-download-grid,
  .press-qa-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .press-facts div,
  .press-contact div {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .press-quote {
    padding: 18px;
    font-size: 1.02rem;
  }

  .submission-key-grid,
  .submission-spec-grid,
  .submission-rights-grid {
    grid-template-columns: 1fr;
  }

  .submission-key-item {
    padding: 17px;
  }

  .submission-key-icon {
    width: 46px;
    height: 46px;
    border-radius: 15px;
  }

  .submission-guideline-item {
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 10px;
  }

  .submission-apply-card {
    display: grid;
    gap: 20px;
  }

  .submission-apply-actions {
    width: 100%;
  }

  .submission-apply-actions .site-link-btn {
    flex: 1 1 100%;
  }
}

[data-theme="dark"] .map-card,
[data-theme="system"] .map-card {
  background: var(--site-panel-strong);
  border-color: var(--site-line);
}

[data-theme="dark"] .site-footer,
[data-theme="system"] .site-footer {
  border-top-color: var(--site-line);
}

/* Map cards (used on maps.html and mode pages) */
.mc-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:1rem;}
.mc{display:flex;flex-direction:column;border-radius:10px;overflow:hidden;background:var(--site-panel,#fff);border:1px solid var(--site-line,#e0e0e0);text-decoration:none;color:inherit;transition:box-shadow .15s,transform .15s;}
.mc:hover{box-shadow:0 4px 16px rgba(0,0,0,.12);transform:translateY(-2px);}
.mc-thumb{width:100%;aspect-ratio:16/9;object-fit:cover;background:var(--site-panel-strong,#f5f5f5);image-rendering:pixelated;}
.mc-thumb-placeholder{width:100%;aspect-ratio:16/9;background:linear-gradient(135deg,var(--site-panel-strong,#e8e8e8),var(--site-line,#d0d0d0));}
.mc-body{padding:.75rem 1rem;}
.mc-title{margin:0;font-size:1rem;font-weight:700;line-height:1.4;}
.mc-rate{margin-left:.5rem;font-size:.8em;font-weight:400;opacity:.65;}
.mc-summary{margin:.35rem 0 0;font-size:.85rem;line-height:1.5;opacity:.7;}

/* FAQ */
.faq-list { margin: 0; }
.faq-list dt { font-weight: 700; margin-top: 1.25rem; }
.faq-list dt:first-child { margin-top: 0; }
.faq-list dd { margin: .35rem 0 0; padding: 0; line-height: 1.7; opacity: .85; }

/* 法務文書の英訳に付ける「日本語版が正文」注記。日本語表示時は不要なので隠す。 */
.legal-translation-notice {
  border-left: 3px solid var(--site-secondary, #0f596c);
  padding-left: 0.7rem;
  font-style: italic;
}
html[lang="ja"] .legal-translation-notice { display: none; }

.page-lang-switcher { margin: 0 0 1rem; }

/* upload 画面の言語別入力（表示名・説明）。 */
.map-translation-fields {
  display: grid;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
}
.map-translation-group {
  display: grid;
  gap: 0.25rem;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--site-line);
  border-radius: 6px;
  background: var(--site-bg);
}
.map-translation-group .profile-label { margin: 0; font-size: 0.78rem; }

/* ヘッダーのコレクション要約チップ（ISSUE #605）
   直近の実績アイコンを数個と残数だけ出し、詳細はコレクション帳へ送る。 */
/* 実績チップは、実績を持つユーザーにだけコレクション API が返ってから現れる。
   出る／出ないでヘッダーの幅が動くと、それがそのままレイアウトシフトになるので、
   hidden のあいだも器を置いて幅だけ確保する。
   以前ここを display: none にしたのは「空のピルが見えていた」ためだが、
   visibility なら見えないまま幅は残せる。 */
.site-collection-chip[hidden] {
  display: inline-flex;
  visibility: hidden;
}

.site-collection-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--site-line, rgba(16, 36, 50, 0.15));
  background: var(--site-panel, rgba(255, 255, 255, 0.55));
  text-decoration: none;
  color: inherit;
  line-height: 1;
  /* アイコン 3 個＋残数 3 桁の実測。実績が増えても幅を動かさない。 */
  min-width: 116px;
  justify-content: center;
}

.site-collection-chip:hover {
  border-color: rgba(212, 175, 55, 0.6);
}

.site-collection-chip-icon {
  font-size: 0.95rem;
}

.site-collection-chip-more {
  font-size: 0.68rem;
  font-weight: 700;
  opacity: 0.7;
  margin-left: 0.1rem;
  font-variant-numeric: tabular-nums;
}

/* 狭い画面ではアイコン1つと残数だけにする。ヘッダーは他の要素と場所を取り合うので、
   横に伸ばすとタイトルやログインボタンを押し出してしまう。 */
@media (max-width: 560px) {
  .site-collection-chip { padding: 0.2rem 0.4rem; min-width: 70px; }
  .site-collection-chip-icon:not(:first-child) { display: none; }
}

/* ドロップダウン内のテーマ・言語（ISSUE #605）
   以前はプロフィール設定ダイアログの中にあった。見た目の切り替えのために
   設定ダイアログを開かせるのは遠回りなので、メニューへ移した。 */
.site-dropdown-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.55rem 0.85rem;
  border-top: 1px solid var(--site-line);
}

.site-dropdown-group-label {
  font-size: 0.66rem;
  letter-spacing: 0.06em;
  opacity: 0.6;
}

/* メニュー内ではボタン群を詰めて置く。ダイアログと同じ余白だと縦に伸びすぎる。 */
.site-dropdown-group .theme-btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.site-dropdown-group .theme-btn-group button {
  padding: 0.22rem 0.5rem;
  font-size: 0.72rem;
}

/* メニューは min-width が狭いので、ボタン群が入る幅を確保する。 */
.site-dropdown-menu {
  min-width: 180px;
}

/* 右下に固定する隠し要素（試験）。ホームだけに出す。
   z-index: 0 にして、z-index: 1 の .site-shell（カード・フッター）の後ろに回す。
   画像は余白を詰めてあり、下端が画面の端に接する。タップ判定は js/mascot.js が行う
   （.site-shell が前面にあり、pointer-events では拾えないため）。 */
.mascot-overlay {
  display: none;
  position: fixed;
  right: 8px;
  bottom: 0;
  z-index: 0;
  width: clamp(80px, 11vw, 120px);
  height: auto;
  pointer-events: none;
  user-select: none;
}

body.route-home .mascot-overlay {
  display: block;
}

@media (prefers-reduced-motion: reduce) {
  body.route-home .mascot-overlay {
    display: none;
  }
}
