/* ===========================
   CSS変数
=========================== */
:root {
  --bg-page: #06070d;
  --paper: #12161f;
  --paper-mid: #0e1118;
  --paper-warm: #0a0d14;
  --line: rgba(80, 160, 220, 0.12);
  --text: #e8eeff;
  --muted: #6888a8;
  --accent: #ff8c20;
  --accent-strong: #ff5500;
  --green: #00c870;
  --blue: #2060c0;
  --cyan: #00c8e8;
  --warn: #ffd040;
  --panel-shadow: 0 12px 40px rgba(0, 0, 0, 0.75), 0 2px 8px rgba(0, 160, 240, 0.07);
  --r-xl: 26px;
  --r-lg: 18px;
  --r-md: 12px;
}

/* ===========================
   リセット・ベース
=========================== */
* { box-sizing: border-box; }

html {
  overflow-x: hidden;
}

body {
  margin: 0;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  overflow-x: hidden;
  font-family: "Hiragino Sans", "Yu Gothic UI", "Meiryo", sans-serif;
  color: var(--text);
  background:
    radial-gradient(ellipse at 20% 10%, rgba(0, 180, 255, 0.04), transparent 40%),
    radial-gradient(ellipse at 80% 90%, rgba(255, 120, 0, 0.03), transparent 40%),
    linear-gradient(170deg, #04050a 0%, #080c16 50%, #050608 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    90deg,
    rgba(255,255,255,0.015) 0, rgba(255,255,255,0.015) 1px,
    transparent 1px, transparent 160px
  );
  pointer-events: none;
}

h1, h2, h3, p { margin-top: 0; }

/* ===========================
   シェル・ヘッダー
=========================== */
.app-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: min(1360px, calc(100% - 28px));
  margin: 0 auto;
  padding: 14px 0 0;
}

.app-shell > main {
  flex: 1;
  display: flex;
  flex-direction: column;
}


/* ===========================
   トップバー
=========================== */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
  background: rgba(8, 14, 28, 0.97);
  border-bottom: 1px solid rgba(0, 180, 255, 0.25);
}

.top-bar-inner {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 20px;
  width: min(1360px, calc(100% - 28px));
  margin: 0 auto;
  padding: 11px 0;
  font-size: 1rem;
  color: #8aaac8;
}

.top-bar-label {
  margin-right: 4px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: rgba(180, 210, 240, 0.4);
}

.top-bar a {
  color: #00c8e8;
  font-size: 1rem;
  font-weight: 700;
  text-decoration: none;
  transition: color 120ms;
}

.top-bar a:hover {
  color: #ffffff;
}

/* ===========================
   サイトフッター・広告スロット
=========================== */
.site-footer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  padding: 14px 0 18px;
  border-top: 1px solid var(--line);
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: auto;
}

.site-footer a {
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 120ms;
}

.site-footer a:hover {
  color: var(--text);
}

.footer-sep {
  opacity: 0.3;
}

.ad-slot {
  width: min(960px, calc(100vw - 28px));
  margin: 16px auto 0;
}

.site-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
  color: #e8f0ff;
}

.header-meta { display: grid; gap: 3px; }

.eyebrow {
  margin: 0;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #00c0d8;
}

.header-clock {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 700;
  color: #ffd040;
}

h1 {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 3.4rem);
  line-height: 1;
  color: #ffffff;
  text-shadow: 0 2px 12px rgba(0,0,0,0.5);
}

.title-accent {
  color: var(--accent);
}

.lead {
  margin: 0;
  color: #7090b0;
  font-size: 0.9rem;
  line-height: 1.7;
  text-align: right;
}

/* ===========================
   画面制御
=========================== */
.screen { display: none; }
.screen.active { display: block; }

/* ゲーム画面はフレックスチェーンで高さを継承 */
#game-screen.active {
  flex: 1;
  display: flex;
  flex-direction: column;
}
#game-screen .screen-frame {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* ===========================
   パネル共通
=========================== */
.panel {
  border: 2px solid rgba(80, 160, 220, 0.16);
  border-radius: var(--r-lg);
  background: linear-gradient(180deg, #161b28 0%, #10141e 100%);
  box-shadow: var(--panel-shadow);
}

/* ===========================
   ラベル・バッジ系
=========================== */
.label {
  display: block;
  margin: 0 0 4px;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}

.badge {
  display: inline-flex;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(255, 240, 200, 0.9);
  border: 1.5px solid rgba(140, 53, 32, 0.28);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.task-kicker {
  margin: 0 0 2px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.mini-note {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
}

/* ===========================
   3カラムレイアウト
=========================== */
.title-layout {
  display: flex;
  justify-content: center;
  align-items: start;
  gap: 16px;
}

/* ===========================
   タイトルサイドバー（広告枠のみ）
=========================== */
.title-sidebar {
  width: 130px;
  flex-shrink: 0;
  padding-top: 16px;
}

.sidebar-ad {
  width: 100%;
}

/* ===========================
   タイトル ヒーローアイコン（右上）
=========================== */
.title-hero-icons {
  position: absolute;
  top: 14px;
  right: 16px;
  display: flex;
  gap: 14px;
  align-items: center;
  z-index: 5;
}

.title-hero-icon-btn {
  background: none;
  border: none;
  font-size: 1.95rem;
  line-height: 1;
  color: rgba(145, 188, 228, 0.48);
  cursor: pointer;
  padding: 4px 5px;
  transition: color 150ms, transform 150ms;
}

.title-hero-icon-btn:hover {
  color: rgba(195, 225, 255, 0.9);
  transform: scale(1.12);
}

/* ===========================
   説明カード タブ切り替え
=========================== */
.title-desc-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid rgba(75, 125, 185, 0.2);
  margin-bottom: 14px;
}

.title-desc-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 5px 14px 8px;
  margin-bottom: -1px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  color: rgba(135, 172, 210, 0.48);
  cursor: pointer;
  transition: color 150ms, border-bottom-color 150ms;
}

.title-desc-tab.is-active {
  color: rgba(190, 220, 252, 0.92);
  border-bottom-color: rgba(80, 158, 232, 0.7);
}

.title-desc-tab:hover:not(.is-active) {
  color: rgba(175, 210, 245, 0.82);
  background: rgba(60, 110, 170, 0.1);
  border-radius: 4px 4px 0 0;
}

.desc-panel[hidden] { display: none; }

.desc-howto-list {
  padding-left: 1.3em;
  margin: 0 0 12px;
  font-size: 0.84rem;
  line-height: 1.7;
  color: var(--muted);
}

.desc-howto-tips {
  margin-top: 8px;
}

/* ===========================
   説明文カード
=========================== */
.title-description {
  margin-top: 12px;
  text-align: left;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(100, 160, 220, 0.22);
  border-radius: 12px;
  padding: 24px 28px;
  width: 88%;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

.desc-section {
  margin-bottom: 0;
}

.desc-section--last {
  margin-bottom: 0;
}

.desc-divider {
  border: none;
  border-top: 1px solid rgba(100, 160, 220, 0.15);
  margin: 16px 0;
}

.desc-heading {
  font-size: 1.0rem;
  font-weight: 900;
  color: #a8d8f0;
  letter-spacing: 0.06em;
  margin: 0 0 10px;
  padding-bottom: 6px;
  border-bottom: 2px solid rgba(100, 180, 240, 0.25);
}

.desc-body {
  font-size: 0.84rem;
  line-height: 1.9;
  color: #b8cfe0;
  margin: 0;
}

.desc-subheading {
  font-size: 0.88rem;
  font-weight: 800;
  color: #8ec8e8;
  margin: 0 0 8px;
  letter-spacing: 0.04em;
}

.desc-list {
  margin: 0;
  padding-left: 0;
  list-style: none;
  font-size: 0.83rem;
  line-height: 2.0;
  color: #9ab8cc;
}

.desc-list li::before {
  content: "・";
  color: #5599bb;
  margin-right: 2px;
}

/* モバイル用ナビはデスクトップで非表示 */
.title-mobile-nav {
  display: none;
}

@media (max-width: 900px) {
  .title-sidebar { display: none; }

  .title-mobile-nav {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 16px;
    flex-wrap: wrap;
  }


  .title-description {
    width: 90%;
  }
}

.screen-frame {
  width: min(960px, calc(100vw - 28px));
  margin: 0 auto;
}

.side-rail,
.frame-rail {
  display: grid;
  gap: 12px;
  align-content: start;
}

/* ===========================
   レールカード
=========================== */
.rail-card,
.compact-card {
  padding: 12px;
}

.rail-card h3 {
  margin-bottom: 8px;
  font-size: 0.92rem;
  color: var(--text);
}

.rail-menu,
.best-records,
.last-result-summary,
.link-list {
  display: grid;
  gap: 7px;
}

.rail-button {
  min-height: 40px;
  border: 2px solid rgba(80, 140, 200, 0.2);
  border-radius: 10px;
  background: linear-gradient(180deg, #1e2838 0%, #141e2c 100%);
  color: #a0b8d8;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 100ms, filter 100ms;
}

.rail-button:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.promo-card {
  background: linear-gradient(180deg, #14182a 0%, #0e1220 100%);
}

.promo-link {
  display: block;
  margin-bottom: 4px;
  color: var(--accent-strong);
  text-decoration: none;
  font-weight: 900;
  font-size: 1.02rem;
}

.promo-card p,
.link-list a {
  color: var(--muted);
  font-size: 0.85rem;
  text-decoration: none;
}

.link-list a:hover { color: var(--accent); }

/* === 自己ベストカード === */
.best-records { gap: 10px; }

.best-record-card {
  padding: 14px 16px;
  border-radius: 12px;
  border: 1.5px solid rgba(0, 160, 220, 0.25);
  background: rgba(10, 25, 45, 0.6);
}

.best-record-card[data-difficulty="white"] {
  background: linear-gradient(135deg, #0a2030 0%, #112e44 100%);
  border-color: rgba(0, 200, 240, 0.45);
}
.best-record-card[data-difficulty="normal"] {
  background: linear-gradient(135deg, #281a08 0%, #362210 100%);
  border-color: rgba(255, 160, 40, 0.5);
}
.best-record-card[data-difficulty="black"] {
  background: linear-gradient(135deg, #1a0808 0%, #260c0c 100%);
  border-color: rgba(220, 60, 40, 0.45);
}

.brc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.brc-company {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  opacity: 0.85;
}
.best-record-card[data-difficulty="white"] .brc-company { color: #80e8ff; }
.best-record-card[data-difficulty="normal"] .brc-company { color: #ffd890; }
.best-record-card[data-difficulty="black"]  .brc-company { color: #ffb8a8; }

.brc-rank {
  font-size: 1.0rem;
  font-weight: 900;
  opacity: 0.75;
}

.brc-time {
  font-size: 1.65rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  margin-bottom: 3px;
}
.best-record-card[data-difficulty="white"] .brc-time { color: #c8f4ff; }
.best-record-card[data-difficulty="normal"] .brc-time { color: #ffe8b0; }
.best-record-card[data-difficulty="black"]  .brc-time { color: #ffd0c0; }

.brc-status {
  font-size: 0.8rem;
  opacity: 0.8;
  margin-bottom: 4px;
}
.brc-sub {
  font-size: 0.7rem;
  opacity: 0.5;
}
.brc-unplayed {
  font-size: 0.85rem;
  opacity: 0.35;
  margin-top: 8px;
}

/* === 直近の退勤カード === */
.lrs-card {
  border-radius: 12px;
  padding: 16px;
  border: 1.5px solid rgba(0, 160, 220, 0.3);
  background: rgba(10, 25, 45, 0.6);
}
.lrs-card[data-difficulty="white"] {
  background: linear-gradient(135deg, #0a2030 0%, #112e44 100%);
  border-color: rgba(0, 200, 240, 0.4);
}
.lrs-card[data-difficulty="normal"] {
  background: linear-gradient(135deg, #281a08 0%, #362210 100%);
  border-color: rgba(255, 160, 40, 0.45);
}
.lrs-card[data-difficulty="black"] {
  background: linear-gradient(135deg, #1a0808 0%, #260c0c 100%);
  border-color: rgba(220, 60, 40, 0.4);
}

.lrs-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.lrs-rank {
  font-size: 1.0rem;
  font-weight: 900;
  opacity: 0.85;
}

.lrs-company {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  opacity: 0.8;
}
.lrs-card[data-difficulty="white"] .lrs-company { color: #80e8ff; }
.lrs-card[data-difficulty="normal"] .lrs-company { color: #ffd890; }
.lrs-card[data-difficulty="black"]  .lrs-company { color: #ffb8a8; }

.lrs-time {
  font-size: 2.0rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}
.lrs-card[data-difficulty="white"] .lrs-time { color: #c8f4ff; }
.lrs-card[data-difficulty="normal"] .lrs-time { color: #ffe8b0; }
.lrs-card[data-difficulty="black"]  .lrs-time { color: #ffd0c0; }

.lrs-status {
  font-size: 0.88rem;
  font-weight: 700;
  opacity: 0.9;
  margin-bottom: 8px;
}
.lrs-detail {
  font-size: 0.72rem;
  opacity: 0.5;
}
.lrs-empty {
  font-size: 0.85rem;
  opacity: 0.45;
}

/* ===========================
   タイトル中央ステージ
=========================== */
.office-title-stage {
  position: relative;
  flex: 1;
  min-width: 0;
  max-width: min(960px, calc(100vw - 28px));
  min-height: clamp(520px, 44vw, 620px);
  padding: clamp(24px, 3vw, 40px) clamp(20px, 3vw, 36px) 28px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border-width: 3px;
  border-color: rgba(0, 180, 255, 0.1);
  background:
    radial-gradient(circle at 50% 16%, rgba(0, 180, 255, 0.05), transparent 24%),
    linear-gradient(180deg, #030408 0%, #070b14 100%);
}

.office-title-stage::before {
  display: none;
}

.office-title-stage::after {
  display: none;
}


/* ===========================
   タイトルボード
=========================== */
.title-board {
  position: relative;
  z-index: 4;
  width: min(100%, 980px);
  margin: 0 auto;
  text-align: center;
}

.title-plaque {
  padding: 0;
}

.title-logo-image {
  display: block;
  width: min(80%, 640px);
  max-width: 640px;
  height: auto;
  margin: 0 auto;
  object-fit: contain;
  filter: drop-shadow(0 18px 44px rgba(0, 0, 0, 0.52));
}

.game-title-text {
  margin: 10px 0 8px;
  font-size: clamp(2.6rem, 5.8vw, 4.4rem);
  line-height: 1;
  font-weight: 900;
  letter-spacing: 0.04em;
  color: #e8eeff;
  text-shadow:
    0 2px 0 rgba(255,255,255,0.4),
    0 4px 16px rgba(80, 30, 10, 0.2),
    2px 2px 0 rgba(150, 80, 40, 0.15);
}

.title-subcopy {
  margin: 0;
  color: #7090b0;
  font-size: 0.95rem;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(255,255,255,0.3);
}

.diff-label {
  margin-bottom: 8px;
}

.portal-card {
  margin-top: 8px;
  padding: 10px 12px 12px;
  background: rgba(14, 18, 30, 0.88);
  backdrop-filter: blur(6px);
  border: 2px solid rgba(0, 180, 240, 0.15);
  border-radius: var(--r-lg);
}

.difficulty-grid {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 2px;
}

.difficulty-card {
  min-width: 118px;
  padding: 8px 10px;
  border: 2px solid rgba(80, 140, 200, 0.2);
  border-radius: 999px;
  background: rgba(20, 26, 42, 0.85);
  color: #b0c8e8;
  cursor: pointer;
  text-align: center;
  transition: transform 120ms, border-color 120ms, background 120ms, box-shadow 120ms;
}

.difficulty-card:hover,
.difficulty-card.selected {
  transform: translateY(-2px);
  border-color: rgba(0, 200, 240, 0.55);
  background: rgba(0, 25, 55, 0.85);
  box-shadow: 0 4px 12px rgba(0, 180, 240, 0.2);
}

.difficulty-name,
.difficulty-desc,
.difficulty-rate { display: block; }

.difficulty-name {
  font-size: 0.86rem;
  font-weight: 900;
  margin-bottom: 2px;
}

.difficulty-desc {
  font-size: 0.7rem;
  color: var(--muted);
}

.difficulty-rate {
  font-size: 0.66rem;
  font-weight: 800;
  color: var(--accent);
  margin-top: 4px;
}

.title-actions {
  display: grid;
  gap: 10px;
  width: min(280px, 100%);
  margin: 14px auto 0;
}

/* ===========================
   ボタン
=========================== */
.primary-button,
.secondary-button,
.ghost-button {
  width: 100%;
  min-height: 50px;
  border-radius: 16px;
  font: inherit;
  font-size: 1rem;
  font-weight: 900;
  cursor: pointer;
  transition: transform 100ms, filter 100ms, box-shadow 100ms;
  letter-spacing: 0.04em;
}

.primary-button {
  border: 2px solid #c04010;
  background: linear-gradient(180deg, #e06020 0%, #b04010 100%);
  color: #ffffff;
  box-shadow: 0 4px 0 #702008;
}

.secondary-button {
  border: 2px solid #0070a0;
  background: linear-gradient(180deg, #0090c0 0%, #005880 100%);
  color: #e0f8ff;
  box-shadow: 0 4px 0 #003050;
}

.ghost-button {
  border: 2px solid rgba(80, 140, 200, 0.28);
  background: linear-gradient(180deg, #1e2a38 0%, #141e2c 100%);
  color: #90b0d0;
  box-shadow: 0 4px 0 #080e18;
}

.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover {
  transform: translateY(-2px);
  filter: brightness(1.08);
  box-shadow: 0 6px 0 rgba(0,0,0,0.4);
}

.primary-button:active,
.secondary-button:active,
.ghost-button:active {
  transform: translateY(1px);
  box-shadow: 0 2px 0 rgba(0,0,0,0.4);
}

.game-nav-row {
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.game-nav-btn {
  flex: 1;
  width: auto;
  min-height: 34px;
  padding: 6px 12px;
  font-size: 0.85rem;
}

.stage-button {
  font-size: 1.2rem;
  min-height: 54px;
}

.stage-sub-button { min-height: 46px; }


/* ===========================
   準備画面
=========================== */
.ready-layout {
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(960px, calc(100vw - 28px));
  margin: 0 auto;
  min-height: 560px;
  padding: 16px;
  box-sizing: border-box;
}

.ready-panel {
  position: relative;
  width: min(560px, 100%);
  padding: 14px 32px 28px;
  text-align: center;
}

.ready-title {
  margin: 8px 0 6px;
  font-size: clamp(1.4rem, 3.2vw, 2rem);
  font-weight: 900;
  color: var(--text);
}

.ready-difficulty {
  margin: 0 0 16px;
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--accent);
}

.ready-difficulty[data-difficulty="white"] { color: #80e8ff; }
.ready-difficulty[data-difficulty="normal"] { color: #ffd890; }
.ready-difficulty[data-difficulty="black"]  { color: #ffb8a8; }

.ready-hint {
  margin: 0 0 20px;
  font-size: 0.95rem;
  color: var(--muted);
  font-weight: 700;
}

.ready-space-hint {
  margin: 16px 0 8px;
  font-size: 1.15rem;
  font-weight: 900;
  color: var(--cyan);
  letter-spacing: 0.04em;
  animation: pulse-hint 2s ease-in-out infinite;
  cursor: pointer;
}

@keyframes pulse-hint {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.55; }
}

/* ===========================
   難易度選択画面（ready screen）
=========================== */
.ready-diff-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 6px 0 6px;
  width: 100%;
}

.ready-diff-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  border: 2px solid transparent;
  border-radius: 14px;
  cursor: pointer;
  text-align: left;
  transition: transform 150ms, box-shadow 150ms, border-color 150ms, background 150ms;
  width: 100%;
}

.ready-diff-card:hover {
  transform: translateY(-3px);
}

.ready-diff-card.selected {
  transform: translateY(-3px);
}

/* ホワイト企業：シアン系 */
.ready-diff-white {
  background: linear-gradient(135deg, #0a2030 0%, #112e44 100%);
  border-color: rgba(0, 200, 240, 0.5);
  color: #80e8ff;
}
.ready-diff-white:hover { background: linear-gradient(135deg, #0d2838 0%, #153650 100%); }
.ready-diff-white.selected { border-color: #00c8e8; box-shadow: 0 0 20px rgba(0,200,240,0.25), 0 6px 16px rgba(0,0,0,0.3); }

/* ふつうの企業：オレンジ・アンバー系（存在感強化） */
.ready-diff-normal {
  background: linear-gradient(135deg, #281a08 0%, #362210 100%);
  border-color: rgba(255, 160, 40, 0.6);
  color: #ffd890;
}
.ready-diff-normal:hover { background: linear-gradient(135deg, #301e0a 0%, #3e2a14 100%); }
.ready-diff-normal.selected { border-color: #ffaa30; box-shadow: 0 0 20px rgba(255,160,40,0.28), 0 6px 16px rgba(0,0,0,0.3); }

/* ブラック企業：深い赤・ダーク */
.ready-diff-black {
  background: linear-gradient(135deg, #1a0808 0%, #260c0c 100%);
  border-color: rgba(220, 60, 40, 0.55);
  color: #ffb8a8;
}
.ready-diff-black:hover { background: linear-gradient(135deg, #1e0a0a 0%, #2c0e0e 100%); }
.ready-diff-black.selected { border-color: #e04030; box-shadow: 0 0 20px rgba(220,60,40,0.3), 0 6px 16px rgba(0,0,0,0.3); }

.ready-diff-icon {
  flex-shrink: 0;
  width: 86px;
  height: 86px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  overflow: hidden;
  background: transparent;
}

.diff-icon-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
  display: block;
  mix-blend-mode: screen;
  transition: transform 150ms, filter 150ms;
}

.ready-diff-card:hover .diff-icon-img,
.ready-diff-card.selected .diff-icon-img {
  transform: scale(1.08);
}

.ready-diff-white .diff-icon-img {
  filter: drop-shadow(0 0 10px rgba(0, 200, 240, 0.7)) brightness(1.1);
}
.ready-diff-white:hover .diff-icon-img,
.ready-diff-white.selected .diff-icon-img {
  filter: drop-shadow(0 0 18px rgba(0, 200, 240, 1.0)) brightness(1.2);
}

.ready-diff-normal .diff-icon-img {
  filter: drop-shadow(0 0 10px rgba(255, 160, 40, 0.8)) brightness(1.15) contrast(1.1);
}
.ready-diff-normal:hover .diff-icon-img,
.ready-diff-normal.selected .diff-icon-img {
  filter: drop-shadow(0 0 18px rgba(255, 160, 40, 1.0)) brightness(1.25) contrast(1.1);
}

.ready-diff-black .diff-icon-img {
  filter: drop-shadow(0 0 10px rgba(220, 60, 40, 0.7)) brightness(1.1) contrast(1.25);
}
.ready-diff-black:hover .diff-icon-img,
.ready-diff-black.selected .diff-icon-img {
  filter: drop-shadow(0 0 18px rgba(220, 60, 40, 1.0)) brightness(1.2) contrast(1.3);
}

@media (max-width: 600px) {
  .ready-diff-icon {
    width: 64px;
    height: 64px;
  }
}

.ready-diff-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  text-align: center;
  align-items: center;
}

.ready-diff-name {
  font-size: 1.18rem;
  font-weight: 900;
  letter-spacing: 0.03em;
}

.ready-diff-desc {
  font-size: 0.78rem;
  opacity: 0.82;
  line-height: 1.5;
}

.ready-diff-rate {
  font-size: 0.74rem;
  font-weight: 800;
  margin-top: 4px;
  opacity: 0.9;
}

.diff-back-btn {
  font-size: 0.9rem;
  color: #7090b0;
  border-color: rgba(80, 140, 200, 0.2);
  min-height: 40px;
}
.diff-back-btn:hover {
  color: #a0c8e8;
  border-color: rgba(80, 140, 200, 0.45);
}

.ready-selected-label {
  margin: 0 0 12px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent);
}

/* ゲーム画面 ナビゲーションボタン行 */
.game-nav-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 4px;
}

.game-nav-btn {
  width: 100%;
  font-size: 1.5rem;
  font-weight: 500;
  color: #3a5468;
  padding: 5px 10px;
  border-radius: 7px;
  border-color: rgba(255,255,255,0.06);
}

.game-nav-btn:hover {
  color: #7aA8c8;
}

/* タイトル画面スタートブロック */
.title-start-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  margin-top: 12px;
}

.title-action-button {
  width: 75%;
  max-width: 420px;
}

.title-sub-buttons {
  display: none;
}

.title-action-start {
  border-color: #7a3f12;
  background: linear-gradient(180deg, #ffb347 0%, #ff8a3d 55%, #f36b2c 100%);
  color: #fffdf6;
  box-shadow: 0 4px 0 #7a3f12;
}

.title-action-howto {
  border-color: #1e3a52;
  background: linear-gradient(180deg, #3d6585 0%, #274a64 100%);
  color: #ddeeff;
  box-shadow: 0 4px 0 #132436;
}

.title-action-settings {
  border-color: #2a3636;
  background: linear-gradient(180deg, #485858 0%, #303e3e 100%);
  color: #d8e8e8;
  box-shadow: 0 4px 0 #161e1e;
}

.title-action-records {
  border-color: #3a2448;
  background: linear-gradient(180deg, #624878 0%, #422e56 100%);
  color: #e8d8f8;
  box-shadow: 0 4px 0 #221433;
}

/* ===========================
   ゲーム画面・結果画面 共通フレーム
=========================== */
.frame-main {
  min-width: 0;
  width: 100%;
}

.compact-card p { margin-bottom: 0; }

.tip-text {
  font-size: 0.84rem;
  color: var(--muted);
  line-height: 1.6;
  margin: 0;
}

/* ===========================
   ゲーム画面 グリッド（単一ビューポート）
=========================== */
.game-main-grid {
  flex: 1;
  display: grid;
  grid-template-rows: auto auto auto auto auto;
  gap: 4px;
  min-height: 560px;
}

/* ===========================
   ステータスグリッド
=========================== */
.status-grid {
  display: block;
}

.stat-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  text-align: center;
}

.stat-label {
  display: block;
  margin-bottom: 2px;
  font-size: 0.7rem;
  color: #8ec8e8;
  font-weight: 700;
}

.main-time-value {
  font-size: clamp(2rem, 7vw, 3.2rem);
  font-weight: 900;
  color: var(--text);
  line-height: 1;
  letter-spacing: 0.03em;
  transition: color 1s ease, text-shadow 1s ease;
}

.main-time-row {
  position: relative;
  display: flex;
  align-items: center;
}

.penalty-float {
  position: absolute;
  left: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.9rem;
  font-weight: 900;
  color: #ff3333;
  text-shadow: 0 0 6px rgba(255, 50, 50, 0.7);
  pointer-events: none;
  opacity: 0;
  white-space: nowrap;
}

.penalty-float.is-active {
  animation: penalty-flash 0.8s ease-out forwards;
}

@keyframes penalty-flash {
  0%   { opacity: 1; transform: translateY(-50%) scale(1.3); }
  20%  { opacity: 1; transform: translateY(-50%) scale(1.0); }
  100% { opacity: 0; transform: translateY(-50%) scale(0.9); }
}

.sub-time-row {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 5px;
  opacity: 0.75;
}

.sub-time-label {
  font-size: 0.6rem;
  color: #8ec8e8;
  font-weight: 700;
}

.sub-time-value {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text);
  transition: color 1s ease;
}

.sub-time-value.is-overtime {
  color: #ff4040;
}

.sub-time-row:has(.sub-time-value.is-overtime) .sub-time-label {
  display: none;
}

.accent-panel {
  background: linear-gradient(180deg, #0a2040 0%, #0e2848 100%);
}

#main-time-panel {
  position: relative;
  overflow: visible;
}

/* ===========================
   円形タイマーゲージ
=========================== */
.timer-gauge-svg {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 108%;
  max-width: 168px;
  aspect-ratio: 1;
  pointer-events: none;
  z-index: 0;
  overflow: visible;
}

.timer-gauge-track {
  fill: none;
  stroke: rgba(0, 180, 255, 0.12);
  stroke-width: 5;
}

.timer-gauge-arc {
  fill: none;
  stroke: rgba(0, 180, 255, 0.45);
  stroke-width: 8;
  stroke-linecap: butt;
  stroke-dasharray: 301.6;
  stroke-dashoffset: 301.6;
  transform: rotate(-90deg);
  transform-origin: 60px 60px;
}

.timer-gauge-center {
  fill: rgba(0, 180, 255, 0.25);
}

#game-screen.game-overtime .timer-gauge-arc {
  stroke: rgba(255, 80, 60, 0.45);
  animation: gauge-overtime-pulse 2s ease-in-out infinite;
}

#game-screen.game-overtime .timer-gauge-center {
  fill: rgba(255, 80, 60, 0.3);
}

@keyframes gauge-overtime-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

.stat-panel > *:not(.timer-gauge-svg) {
  position: relative;
  z-index: 1;
}

.warn-panel {
  background: linear-gradient(180deg, #201800 0%, #281e00 100%);
}

/* ===========================
   残業突入演出
=========================== */
#game-screen.game-overtime .task-panel {
  background: linear-gradient(180deg, #1c0d0d 0%, #130808 100%);
}

#game-screen.game-overtime .main-time-value {
  color: #ff6060;
  text-shadow: 0 0 16px rgba(200, 0, 0, 0.5);
}

#game-screen.game-overtime .stat-label {
  color: #cc7070;
}

.penalty-panel .timer-gauge-svg {
  animation: gauge-penalty-pulse 0.5s ease-in-out infinite alternate;
}

.penalty-panel .timer-gauge-arc {
  stroke: rgba(255, 215, 0, 0.95);
}

.penalty-panel .timer-gauge-track {
  stroke: rgba(255, 215, 0, 0.3);
}

.penalty-panel .timer-gauge-center {
  fill: rgba(255, 215, 0, 0.6);
}

@keyframes gauge-penalty-pulse {
  from { filter: drop-shadow(0 0 4px rgba(255, 215, 0, 0.6)); }
  to   { filter: drop-shadow(0 0 14px rgba(255, 215, 0, 1.0)); }
}

/* 残業中のミスは濃い赤で発光 */
#game-screen.game-overtime .penalty-panel .timer-gauge-svg {
  animation: gauge-penalty-overtime-pulse 0.5s ease-in-out infinite alternate;
}

#game-screen.game-overtime .penalty-panel .timer-gauge-arc {
  stroke: rgba(220, 30, 30, 1.0);
}

#game-screen.game-overtime .penalty-panel .timer-gauge-track {
  stroke: rgba(200, 20, 20, 0.4);
}

#game-screen.game-overtime .penalty-panel .timer-gauge-center {
  fill: rgba(220, 30, 30, 0.7);
}

@keyframes gauge-penalty-overtime-pulse {
  from { filter: drop-shadow(0 0 4px rgba(200, 0, 0, 0.7)); }
  to   { filter: drop-shadow(0 0 16px rgba(220, 0, 0, 1.0)); }
}

/* ===========================
   プログレスバー（コンパクト）
=========================== */
.progress-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.progress-label-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0 2px;
}

.progress-label-left {
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #8ec8e8;
  text-transform: uppercase;
}

.progress-label-right {
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.03em;
}

.progress-bar-wrap {
  display: flex;
  align-items: center;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  border-radius: 0;
}

.progress-bar {
  position: relative;
  overflow: visible;
  flex: 1;
  height: 10px;
  border: 1px solid rgba(0, 180, 255, 0.3);
  border-radius: 999px;
  background: rgba(0, 15, 40, 0.6);
  box-shadow: 0 0 8px rgba(0, 180, 255, 0.1) inset;
}

.progress-fill {
  position: relative;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0070d0 0%, #00c8e8 50%, #00e870 100%);
  box-shadow: 0 0 10px rgba(0, 200, 232, 0.5);
  transition: width 220ms ease, background 600ms ease;
}


.progress-pct {
  position: absolute;
  right: -2px;
  top: 50%;
  transform: translate(100%, -50%);
  margin-left: 6px;
  font-size: 1.08rem;
  font-weight: 700;
  color: #00c8e8;
  white-space: nowrap;
  pointer-events: none;
}

/* ===========================
   タスクパネル
=========================== */
.task-panel {
  position: relative;
  padding: 6px 12px 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.task-header {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin-bottom: 6px;
}

.task-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.difficulty-chip {
  padding: 5px 10px;
  border: 2px solid rgba(0, 180, 240, 0.22);
  border-radius: 999px;
  background: rgba(0, 30, 60, 0.5);
  color: #00c8e8;
  font-size: 0.78rem;
  font-weight: 900;
  white-space: nowrap;
  flex-shrink: 0;
}

.difficulty-chip[data-difficulty="white"]  { color: #80e8ff; border-color: rgba(0, 200, 240, 0.4); }
.difficulty-chip[data-difficulty="normal"] { color: #ffd890; border-color: rgba(255, 160, 40, 0.4); }
.difficulty-chip[data-difficulty="black"]  { color: #ffb8a8; border-color: rgba(220, 60, 40, 0.4); }

.sentence-panel {
  padding: 8px 14px;
  border: 2px solid rgba(80, 160, 220, 0.28);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(14, 26, 52, 0.97) 0%, rgba(10, 20, 40, 0.97) 100%);
  margin-bottom: 6px;
  flex-shrink: 0;
}

.prompt-japanese {
  margin: 2px 0 4px;
  font-size: clamp(1.1rem, 2.4vw, 1.7rem);
  font-weight: 900;
  line-height: 3.2;
  color: var(--text);
  word-break: break-all;
  overflow-wrap: break-word;
  text-wrap: balance;
  ruby-align: center;
}

.prompt-japanese rt {
  font-size: 0.55em;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1;
}

/* かなカラーコーディング（ルビ内で使用） */
.kana-done    { color: #5db882; }
.kana-current { color: #ffd234; }
.kana-pending { color: #7a9ab8; }

.prompt-romaji {
  margin: 0;
  font-family: "Menlo", "Consolas", "Courier New", monospace;
  font-size: 0.85rem;
  color: #b0c4d8;
  word-break: break-all;
  letter-spacing: 0.04em;
}

/* ===========================
   タイピングプレビュー
=========================== */
.typing-preview {
  min-height: 48px;
  margin-bottom: 8px;
  padding: 8px 14px;
  border: 2px solid rgba(60, 130, 220, 0.35);
  border-radius: 14px;
  background: rgba(3, 6, 14, 0.98);
  font-family: "Menlo", "Consolas", "Courier New", monospace;
  font-size: 1.2rem;
  line-height: 1.8;
  word-break: break-all;
  letter-spacing: 0.06em;
  flex-shrink: 0;
}

.char-correct {
  color: #5db882;
  font-weight: 700;
}
.char-current {
  color: #ffd234;
  font-weight: 700;
}
.char-pending { color: #6888a0; }

.input-wrap {
  display: grid;
  gap: 4px;
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--muted);
  flex-shrink: 0;
}

.input-wrap input {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 3px solid rgba(88,62,34,0.22);
  border-radius: 14px;
  background: rgba(255, 252, 238, 0.98);
  font: inherit;
  font-size: 1rem;
  color: var(--text);
  transition: border-color 120ms, background 120ms;
}

.input-wrap input:focus {
  outline: 3px solid rgba(130, 50, 30, 0.18);
  border-color: rgba(130, 50, 30, 0.48);
}

.input-wrap input.input-error {
  border-color: #ccaa00;
  background: rgba(220, 180, 0, 0.08);
}


.typing-preview.input-error {
  border-color: #ccaa00 !important;
  background: rgba(220, 180, 0, 0.08) !important;
}

.game-ime-input {
  position: absolute;
  top: 0;
  left: -9999px;
  width: 1px;
  height: 1px;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.game-ime-input:focus {
  outline: none;
}

/* ===========================
   下部グリッド（メトリクス＋イベント）
=========================== */
.event-panel {
  padding: 8px 12px;
}

.result-section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.result-section-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}

.result-sub-nav-btn {
  background: rgba(30, 65, 105, 0.45);
  border: 1px solid rgba(100, 165, 225, 0.45);
  border-radius: 7px;
  color: #a8d4f5;
  font: inherit;
  font-size: 1.1rem;
  font-weight: 700;
  padding: 2px 10px;
  cursor: pointer;
  transition: background 120ms, border-color 120ms, color 120ms;
}

.result-sub-nav-btn:hover {
  background: rgba(40, 85, 135, 0.6);
  border-color: rgba(120, 185, 240, 0.65);
  color: #c8e6ff;
}

.result-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px dashed rgba(80, 140, 200, 0.12);
  font-size: 1rem;
}

.result-row:last-child { border-bottom: 0; }

.result-row strong {
  font-size: 1.1rem;
  font-weight: 900;
}

.event-panel {
  background: linear-gradient(180deg, #1c1400 0%, #241a00 100%);
}

.event-message {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.7;
  color: var(--text);
}

/* ===========================
   結果画面
=========================== */
.result-hero {
  position: relative;
  margin-bottom: 16px;
  padding: 28px 24px 24px;
  text-align: center;
  background:
    radial-gradient(ellipse at 50% 40%, rgba(0, 80, 160, 0.12) 0%, transparent 70%),
    linear-gradient(180deg, #0c1c34 0%, #081426 100%);
}

.result-hero-label {
  position: absolute;
  top: 16px;
  left: 18px;
  margin: 0;
  padding: 0;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--muted);
  text-transform: uppercase;
}

.result-hero-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  width: 100%;
}

.result-hero-action-btn {
  flex: 1;
  min-height: 44px;
  border-radius: 12px;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 100ms, filter 100ms, box-shadow 100ms;
}

.result-hero-action-primary {
  /* 中央：最も目立つ明るい青 */
  color: #e0f0ff;
  background: linear-gradient(180deg, #2272cc 0%, #1450a0 100%);
  border: 1.5px solid #3d8fe0;
  box-shadow: 0 3px 0 #0a2e60, 0 0 12px rgba(34, 114, 204, 0.3);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.result-hero-action-teal {
  /* 左：転職する・中程度のシアン青緑 */
  color: #7ae8f0;
  background: linear-gradient(180deg, rgba(0, 120, 145, 0.5) 0%, rgba(0, 85, 110, 0.45) 100%);
  border: 1.5px solid rgba(0, 195, 225, 0.5);
  box-shadow: 0 2px 0 rgba(0, 50, 70, 0.5);
}

.result-hero-action-ghost {
  /* 右：退社する・落ち着いたダーク */
  color: #7ba8c8;
  background: rgba(18, 36, 60, 0.45);
  border: 1.5px solid rgba(100, 150, 200, 0.28);
  box-shadow: none;
}

.result-hero-action-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
}

.result-hero-action-btn:active {
  transform: translateY(1px);
  filter: brightness(0.95);
}


.result-hero-topright {
  position: absolute;
  top: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.result-hero-settings-btn {
  background: none;
  border: none;
  color: rgba(160, 200, 235, 0.45);
  font-size: 1.72rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  transition: color 120ms;
}

.result-hero-settings-btn:hover {
  color: rgba(160, 200, 235, 0.85);
}

.hero-share-btn {
  padding: 6px 14px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.04em;
  transition: background 120ms;
}

.hero-share-btn:hover {
  background: rgba(255, 255, 255, 0.16);
}

.result-hero-badges {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0 0 4px;
  flex-wrap: wrap;
}

.result-record-badge {
  padding: 5px 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, #d4a020, #a07010);
  color: #fff8e0;
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.06em;
}

.result-hero h2 {
  margin: 6px 0 4px;
  font-size: clamp(3rem, 7vw, 5rem);
  line-height: 0.92;
  font-weight: 900;
  color: var(--text);
}

.result-status {
  margin: 0 0 4px;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--muted);
}

.result-rank-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  justify-content: center;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.result-rank {
  margin: 0;
  font-size: 2.4rem;
  font-weight: 900;
  letter-spacing: 0.05em;
}

.result-title {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 700;
}

.result-compare {
  margin-top: 12px;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.3);
  font-size: 0.88rem;
  color: var(--muted);
  display: grid;
  gap: 4px;
}

.result-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 16px;
}

.result-stats,
.result-actions {
  padding: 12px 14px;
}

.result-actions {
  padding: 12px 14px;
}

.result-primary-btn,
.result-secondary-btn {
  width: 100%;
  border-radius: 14px;
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 100ms, filter 100ms, box-shadow 100ms;
}

.result-primary-btn {
  min-height: 60px;
  font-size: 1.15rem;
  color: #ffffff;
  background: linear-gradient(180deg, #f07030 0%, #c04818 100%);
  border: 2px solid #a03810;
  box-shadow: 0 4px 0 #702008, 0 1px 6px rgba(200, 80, 20, 0.3);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.result-secondary-btn {
  min-height: 54px;
  font-size: 1.05rem;
  color: #d0e8ff;
  background: linear-gradient(180deg, #1e3a58 0%, #142840 100%);
  border: 2px solid #1e4068;
  box-shadow: 0 4px 0 #0a1828;
}

.result-primary-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
  box-shadow: 0 6px 0 #702008, 0 2px 10px rgba(200, 80, 20, 0.35);
}

.result-secondary-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.12);
  box-shadow: 0 6px 0 #0a1828;
}

.result-primary-btn:active,
.result-secondary-btn:active {
  transform: translateY(1px);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.4);
}

.share-text-box {
  padding: 10px 12px;
  border: 2px solid rgba(80, 140, 200, 0.2);
  border-radius: 10px;
  background: rgba(8, 12, 22, 0.85);
  font-family: "Menlo", "Consolas", "Courier New", monospace;
  font-size: 0.78rem;
  line-height: 1.7;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-all;
  user-select: all;
  max-height: 160px;
  overflow-y: auto;
}


.result-hero.is-overtime .result-status {
  color: var(--accent-strong);
}

/* ランク別カラー（ランク・称号名に共通適用） */
.rank-color-sss { color: #F6C344; }
.rank-color-ss  { color: #FF8A3D; }
.rank-color-s   { color: #FFD84D; }
.rank-color-a   { color: #7CFF6B; }
.rank-color-b   { color: #4DE3FF; }
.rank-color-c   { color: #5FA8FF; }
.rank-color-d   { color: #9B7BFF; }
.rank-color-e   { color: #9AA3B2; }
.rank-color-f   { color: #FF5C5C; }

/* ランク一覧テーブル（result-actions内） */

.rank-table-inner {
  display: grid;
  grid-template-columns: 58px 1fr auto;
  font-size: 0.82rem;
}

.rank-table-header {
  display: contents;
}

.rank-table-header > span {
  padding: 4px 8px 6px;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  white-space: nowrap;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.rank-table-header > span:nth-child(2),
.rank-table-row > span:nth-child(2) {
  justify-content: center;
  text-align: center;
}

.rank-table-row {
  display: contents;
}

.rank-table-row > span {
  padding: 5px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
}

.rank-table-row.is-current > span {
  background: rgba(255, 195, 60, 0.1);
  font-weight: 700;
}

.rank-table-row.is-current > span:first-child {
  border-left: 3px solid var(--accent);
  padding-left: 5px;
  border-radius: 6px 0 0 6px;
}

.rank-table-row.is-current > span:last-child {
  border-radius: 0 6px 6px 0;
}

.rank-table-rank-cell {
  font-weight: 900;
  letter-spacing: 0.04em;
}

.rank-table-score-cell {
  color: var(--muted);
  font-size: 0.78rem;
}

/* ===========================
   マイルストーンフラッシュ
=========================== */
.milestone-flash {
  position: fixed;
  top: 38%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.88);
  padding: 9px 26px;
  border-radius: 10px;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #fff;
  pointer-events: none;
  opacity: 0;
  z-index: 800;
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.milestone-flash.is-show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.milestone-flash--half {
  background: rgba(0, 160, 80, 0.92);
  box-shadow: 0 4px 20px rgba(0, 200, 100, 0.3);
}

.milestone-flash--near {
  background: rgba(180, 120, 0, 0.92);
  box-shadow: 0 4px 20px rgba(240, 180, 0, 0.3);
}

.milestone-flash--overtime {
  background: rgba(180, 20, 20, 0.95);
  box-shadow: 0 4px 24px rgba(255, 40, 40, 0.5);
  font-size: 1.4rem;
  letter-spacing: 0.1em;
}

.milestone-flash--midnight {
  background: rgba(10, 10, 40, 0.97);
  box-shadow: 0 4px 28px rgba(80, 80, 200, 0.6);
  font-size: 1.4rem;
  letter-spacing: 0.1em;
  color: #aaaaff;
}

/* ===========================
   集計演出オーバーレイ
=========================== */
.tally-overlay {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: rgba(6, 7, 13, 0.96);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.tally-overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.tally-content {
  text-align: center;
}

.tally-dots {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 28px;
}

.tally-dots span {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--accent);
  animation: tally-bounce 1.1s ease-in-out infinite;
}

.tally-dots span:nth-child(2) { animation-delay: 0.18s; }
.tally-dots span:nth-child(3) { animation-delay: 0.36s; }

@keyframes tally-bounce {
  0%, 100% { opacity: 0.25; transform: translateY(0); }
  50%       { opacity: 1;    transform: translateY(-10px); }
}

.tally-main-text {
  margin: 0 0 10px;
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.04em;
}


/* ===========================
   モーダル
=========================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 12, 20, 0.72);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal-overlay[hidden] { display: none; }

.modal-box {
  position: relative;
  width: min(480px, 100%);
  padding: 28px 28px 24px;
  text-align: left;
  animation: modalIn 180ms ease;
}

#records-modal .modal-box {
  width: min(640px, 100%);
}

/* 設定モーダル */
.settings-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 24px;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid rgba(80, 140, 200, 0.12);
}

.settings-row:first-child {
  border-top: 1px solid rgba(80, 140, 200, 0.12);
}

.settings-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.settings-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}

.settings-desc {
  font-size: 0.75rem;
  color: var(--muted);
}

.settings-speaker-btn {
  font-size: 1.5rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid rgba(80, 140, 200, 0.3);
  background: rgba(80, 140, 200, 0.1);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 120ms, border-color 120ms;
  flex-shrink: 0;
}

.settings-speaker-btn:hover {
  background: rgba(80, 140, 200, 0.2);
  border-color: rgba(80, 140, 200, 0.5);
}

.settings-speaker-btn[data-muted="true"] {
  background: rgba(180, 60, 60, 0.15);
  border-color: rgba(180, 60, 60, 0.4);
}

.settings-slider-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.settings-slider {
  width: 100px;
  height: 4px;
  accent-color: var(--accent, #00a0dc);
  cursor: pointer;
}

.settings-slider-val {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  min-width: 28px;
  text-align: right;
}

.settings-badge {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  background: rgba(0, 160, 220, 0.08);
  padding: 4px 10px;
  border-radius: 8px;
}

.records-modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

@keyframes modalIn {
  from { transform: scale(0.94) translateY(8px); opacity: 0; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-title {
  margin: 10px 0 16px;
  font-size: 1.6rem;
  font-weight: 900;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 36px;
  height: 36px;
  border: 2px solid rgba(80, 140, 200, 0.2);
  border-radius: 50%;
  background: rgba(20, 26, 40, 0.8);
  color: #a0b8d8;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.how-to-list {
  padding-left: 1.4em;
  line-height: 2;
  margin: 0 0 16px;
  color: var(--text);
}

.how-to-tips {
  padding: 14px;
  border-radius: 12px;
  background: rgba(0, 20, 50, 0.5);
  border: 2px dashed rgba(0, 160, 220, 0.2);
  margin-bottom: 16px;
}

.how-to-tips ul {
  padding-left: 1.3em;
  line-height: 1.9;
  margin: 6px 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.modal-ok-btn {
  margin-top: 4px;
}

/* ===========================
   起床！フラッシュ
=========================== */
@keyframes kiso-flash-anim {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
  30%  { opacity: 1; transform: translate(-50%, -50%) scale(1.15); }
  55%  { opacity: 1; transform: translate(-50%, -50%) scale(1.0); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.3); }
}

.screen-mute-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 10;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid rgba(80, 140, 200, 0.25);
  background: rgba(10, 20, 40, 0.6);
  font-size: 1.35rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.55;
  transition: opacity 150ms, background 150ms;
}

.screen-mute-btn:hover {
  opacity: 1;
  background: rgba(20, 40, 70, 0.9);
}

.screen-mute-btn[data-muted="true"] {
  opacity: 0.8;
  border-color: rgba(180, 60, 60, 0.45);
}

.kiso-flash {
  position: fixed;
  inset: 0;
  z-index: 9000;
  pointer-events: none;
  display: none;
}

.kiso-flash span {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.5);
  font-size: clamp(3rem, 10vw, 6rem);
  font-weight: 900;
  color: #fff;
  text-shadow: 0 0 40px rgba(255,255,255,0.6), 0 4px 24px rgba(0,0,0,0.6);
  letter-spacing: 0.08em;
  opacity: 0;
}

.kiso-flash.is-active span {
  animation: kiso-flash-anim 0.75s ease-out forwards;
}

/* ===========================
   モバイル警告
=========================== */
.mobile-warning {
  position: fixed;
  inset: 0;
  background: rgba(8, 10, 16, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}

.mobile-warning[hidden] { display: none; }

.mobile-warning-box {
  width: min(400px, 100%);
  padding: 32px 28px;
  border: 2px solid rgba(80, 160, 220, 0.2);
  border-radius: var(--r-lg);
  background: linear-gradient(180deg, #161b28 0%, #10141e 100%);
  text-align: center;
}

.mobile-warning-title {
  margin-bottom: 10px;
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--accent);
}

.mobile-warning-body {
  margin-bottom: 20px;
  font-size: 0.95rem;
  color: var(--muted);
  line-height: 1.7;
}

/* ===========================
   レスポンシブ
=========================== */

@media (max-width: 900px) {
  .status-grid { display: block; }

  .task-header,
  .panel-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .game-main-grid {
    height: auto;
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100% - 16px, 960px);
    padding-top: 14px;
  }

  .side-rail,
  .frame-rail {
    grid-template-columns: 1fr;
  }

  .status-grid      { grid-template-columns: 1fr 1fr 1fr; }
  .result-grid      { grid-template-columns: 1fr; }

  .office-title-stage {
    min-height: 460px;
    padding: 20px 12px 24px;
  }

  .title-logo-image {
    width: 90%;
  }

  .lead { text-align: left; }
}

/* ===========================
   開発者ウィジェット（右下固定）
=========================== */
.developer-widget {
  position: fixed;
  bottom: 14px;
  right: 14px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  pointer-events: none;
}

.developer-widget * { pointer-events: auto; }

.dev-app-banner {
  background: rgba(40, 30, 20, 0.82);
  backdrop-filter: blur(4px);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 0.72rem;
}

.dev-app-banner a {
  color: #f5e4c0;
  text-decoration: none;
  white-space: nowrap;
}
.dev-app-banner a:hover { text-decoration: underline; }

.dev-links {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(30, 20, 10, 0.82);
  backdrop-filter: blur(4px);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 0.75rem;
}

.dev-links a {
  color: #f0d8a0;
  text-decoration: none;
  font-weight: 700;
  white-space: nowrap;
}
.dev-links a:hover { text-decoration: underline; }

.dev-sep { color: rgba(240, 216, 160, 0.4); }
