﻿/* 昭和レトロ × 温かみのあるモダンデザイン */
:root {
  --color-bg: #2a1f18;
  --color-card-bg: #3c2f25;
  --color-accent: #e67e22;
  --color-accent-hover: #d35400;
  --color-water: #3498db;
  --color-sand: #f1c40f;
  --color-danger: #e74c3c;
  --color-text: #f7ede2;
  --color-text-muted: #d4a373;
  --color-border: #6b4f3b;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--color-bg);
  font-family: var(--font-family);
  color: var(--color-text);
  touch-action: none; /* スマホでのデフォルトスクロールやピンチを無効化 */
}

/* ==========================================
   1. オープニング動画画面
   ========================================== */
.intro-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #000;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: opacity 1.2s ease, visibility 1.2s;
}

.intro-screen.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.video-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

#intro-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

#intro-canvas-fallback {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none; /* 動画がない場合のみJSで表示 */
}

.intro-overlay-ui {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 24px;
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(0,0,0,0.4) 0%, transparent 30%, transparent 60%, rgba(0,0,0,0.7) 100%);
  z-index: 10;
}

.intro-caption {
  margin-top: auto;
  margin-bottom: 24px;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0,0,0,0.8);
  animation: caption-fade 4s ease-in-out infinite alternate;
}

.caption-text {
  font-size: 1.2rem;
  font-weight: bold;
  letter-spacing: 0.05em;
  color: #ffe6cc;
  font-family: "Hiragino Mincho ProN", "Yu Mincho", serif;
}

.caption-sub {
  font-size: 0.95rem;
  color: #f0cfb3;
  margin-top: 6px;
}

@keyframes caption-fade {
  0% { opacity: 0.85; transform: translateY(0); }
  100% { opacity: 1; transform: translateY(-4px); }
}

.intro-controls {
  position: absolute;
  top: 20px;
  right: 20px;
  display: flex;
  gap: 10px;
  pointer-events: auto;
}

.intro-btn {
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #fff;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.85rem;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: all 0.2s;
}

.intro-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: #fff;
}

.skip-btn {
  background: rgba(230, 126, 34, 0.8);
  border-color: #e67e22;
  font-weight: bold;
}
.skip-btn:hover {
  background: rgba(211, 84, 0, 0.95);
}

/* ==========================================
   2. タイトル画面
   ========================================== */
.title-screen {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 900;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #150a04;
  overflow-y: auto;
  padding: 24px 16px;
  transition: opacity 0.8s ease, transform 0.8s ease, visibility 0.8s;
}

.title-screen.hidden {
  display: none;
  opacity: 0;
  pointer-events: none;
}

.title-screen.fade-out {
  opacity: 0;
  transform: scale(1.04);
  visibility: hidden;
  pointer-events: none;
}

.title-bg {
  position: absolute;
  inset: 0;
  background-image: url('title_bg.png');
  background-size: cover;
  background-position: center bottom;
  background-repeat: no-repeat;
  filter: brightness(0.65) saturate(1.15);
  pointer-events: none;
}

.title-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: 
    radial-gradient(circle at 50% 45%, rgba(25, 12, 6, 0.4) 0%, rgba(10, 5, 2, 0.82) 85%),
    linear-gradient(to bottom, rgba(0, 0, 0, 0.45) 0%, transparent 35%, rgba(10, 5, 2, 0.88) 100%);
  pointer-events: none;
}

.title-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 620px;
  width: 100%;
  animation: title-appear 0.9s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes title-appear {
  0% { opacity: 0; transform: translateY(20px); }
  100% { opacity: 1; transform: translateY(0); }
}

.title-badge {
  display: inline-block;
  background: rgba(230, 126, 34, 0.2);
  border: 1px solid rgba(230, 126, 34, 0.6);
  color: #ffb885;
  font-size: 0.8rem;
  letter-spacing: 0.15em;
  padding: 4px 14px;
  border-radius: 12px;
  margin-bottom: 12px;
}

.main-title {
  font-size: 2.8rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: #fff2e0;
  font-family: "Hiragino Mincho ProN", "Yu Mincho", serif;
  text-shadow: 0 4px 16px rgba(0, 0, 0, 0.6), 0 0 30px rgba(255, 140, 50, 0.4);
  line-height: 1.2;
}

.sub-title-text {
  font-size: 1.2rem;
  color: #ffd8a8;
  letter-spacing: 0.25em;
  margin-top: 6px;
  font-family: "Hiragino Mincho ProN", "Yu Mincho", serif;
}

.title-catchcopy {
  font-size: 0.95rem;
  color: #e5c2a3;
  margin: 18px 0 28px;
  line-height: 1.8;
  max-width: 480px;
}

.title-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: 100%;
  max-width: 360px;
}

.btn-title-start {
  width: 100%;
  padding: 16px 24px;
  background: linear-gradient(135deg, #f39c12 0%, #e67e22 50%, #d35400 100%);
  color: #fff;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-radius: 40px;
  font-size: 1.2rem;
  font-weight: bold;
  letter-spacing: 0.08em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  box-shadow: 0 6px 24px rgba(230, 126, 34, 0.5), inset 0 1px 2px rgba(255, 255, 255, 0.4);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  animation: pulse-start 2s infinite ease-in-out;
}

@keyframes pulse-start {
  0%, 100% { transform: scale(1); box-shadow: 0 6px 24px rgba(230, 126, 34, 0.5); }
  50% { transform: scale(1.03); box-shadow: 0 8px 30px rgba(243, 156, 18, 0.75); }
}

.btn-title-start:hover {
  transform: scale(1.05);
  background: linear-gradient(135deg, #f1c40f 0%, #f39c12 50%, #e67e22 100%);
}

.btn-title-start:active {
  transform: scale(0.98);
}

.btn-sparkle {
  font-size: 1.3rem;
}

.btn-arrow {
  font-size: 0.9rem;
  opacity: 0.8;
  margin-left: 4px;
}

.title-sub-actions {
  display: flex;
  gap: 10px;
  width: 100%;
}

.btn-title-sub {
  flex: 1;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--color-border);
  color: #f7ede2;
  border-radius: 8px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-title-sub:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: #ffd8a8;
}

/* ルール概要カード */
.title-rules-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 32px;
  width: 100%;
}

.rule-chip {
  background: rgba(43, 31, 24, 0.7);
  border: 1px solid rgba(107, 79, 59, 0.4);
  border-radius: 8px;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.chip-icon {
  font-size: 1.4rem;
}

.chip-body strong {
  display: block;
  font-size: 0.85rem;
  color: #ffd8a8;
}

.chip-body span {
  display: block;
  font-size: 0.7rem;
  color: #c0a48c;
  margin-top: 2px;
  line-height: 1.3;
}

.title-footer-note {
  position: relative;
  z-index: 2;
  margin-top: 24px;
  font-size: 0.75rem;
  color: #a89078;
}

/* ==========================================
   3. メインアプリコンテナ
   ========================================== */
#app-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  position: relative;
  background: radial-gradient(circle at 50% 30%, #5c3b28 0%, #2e1d13 70%, #160c07 100%);
}

/* レトロ夕暮れ背景 */
#retro-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    linear-gradient(to bottom, rgba(20, 10, 5, 0.72) 0%, rgba(10, 5, 2, 0.88) 100%),
    url('title_bg.png');
  background-size: cover;
  background-position: center bottom;
  background-repeat: no-repeat;
  filter: blur(2px) brightness(0.65);
  pointer-events: none;
  z-index: 1;
}

/* ヘッダー */
#game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: rgba(42, 31, 24, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--color-border);
  z-index: 10;
}

.header-title h1 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #fff2e0;
  display: inline-block;
}

.header-title .sub-title {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-left: 6px;
}

.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.icon-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--color-border);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  color: #fff;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.btn {
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-primary {
  background: linear-gradient(135deg, #e67e22, #d35400);
  color: #fff;
  box-shadow: 0 2px 6px rgba(211, 84, 0, 0.4);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #f39c12, #e67e22);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.12);
  color: #f7ede2;
  border: 1px solid var(--color-border);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.2);
}

.btn-save {
  background: linear-gradient(135deg, #27ae60, #229954);
  color: #fff;
  box-shadow: 0 2px 6px rgba(39, 174, 96, 0.4);
}
.btn-save:hover {
  background: linear-gradient(135deg, #2ecc71, #27ae60);
}

/* ステータスパネル */
#status-panel {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding: 8px 16px;
  background: rgba(25, 18, 14, 0.7);
  border-bottom: 1px solid rgba(107, 79, 59, 0.5);
  z-index: 10;
}

.status-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.status-item .label {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.status-item .value {
  font-size: 1rem;
  font-weight: bold;
  color: #ffd8a8;
}

.status-item .sub-value {
  font-size: 0.7rem;
  color: #a89078;
}

.status-item .value-mini {
  font-size: 0.75rem;
  font-weight: 600;
  align-self: flex-end;
}

.meter-bar {
  width: 100%;
  height: 8px;
  background: #1e1510;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.meter-fill {
  height: 100%;
  transition: width 0.15s ease-out;
  border-radius: 3px;
}

.gloss-color {
  background: linear-gradient(90deg, #d35400, #f39c12, #fff275);
}

.moisture-color {
  background: linear-gradient(90deg, #e74c3c 0%, #3498db 35%, #2ecc71 70%, #3498db 100%);
}

.sweet-spot-guide {
  position: absolute;
  left: 40%;
  width: 40%;
  top: 0;
  bottom: 0;
  background: rgba(46, 204, 113, 0.25);
  border-left: 1px dashed rgba(255,255,255,0.6);
  border-right: 1px dashed rgba(255,255,255,0.6);
  pointer-events: none;
}

.danger-bar {
  background: #2a1515;
}

.crack-color {
  background: linear-gradient(90deg, #e67e22, #e74c3c);
}

/* 汎用非表示クラス */
.hidden {
  display: none !important;
}

/* 速度警告インジケーター */
#speed-warning {
  position: absolute;
  top: 130px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(231, 76, 60, 0.92);
  color: white;
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 15px rgba(231, 76, 60, 0.6);
  z-index: 20;
  animation: pulse-danger 0.5s infinite alternate;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

#speed-warning.hidden {
  display: none !important;
}

@keyframes pulse-danger {
  0% { transform: translateX(-50%) scale(0.97); }
  100% { transform: translateX(-50%) scale(1.05); }
}

/* メイン3D領域 */
#canvas-container {
  flex: 1;
  position: relative;
  width: 100%;
  overflow: hidden;
  cursor: grab;
  z-index: 2;
}

#canvas-container:active {
  cursor: grabbing;
}

#dango-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

#guide-overlay {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.5);
  padding: 8px 16px;
  border-radius: 20px;
  pointer-events: none;
  opacity: 0.85;
  transition: opacity 0.5s;
  text-align: center;
}

.guide-text {
  font-size: 0.85rem;
  color: #fff;
  line-height: 1.4;
}

/* フッター操作 */
#game-controls {
  padding: 12px 16px;
  background: rgba(30, 22, 17, 0.9);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 10;
}

.control-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.btn-action {
  flex: 1;
  max-width: 320px;
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.95rem;
  font-weight: bold;
}

.water-btn {
  background: linear-gradient(135deg, #2980b9, #1f618d);
  color: white;
  box-shadow: 0 3px 8px rgba(41, 128, 185, 0.4);
}
.water-btn:hover {
  background: linear-gradient(135deg, #3498db, #2980b9);
}
.water-btn:active {
  transform: scale(0.97);
}

.sand-btn {
  background: linear-gradient(135deg, #b7950b, #7d6608);
  color: #fffdf5;
  box-shadow: 0 3px 8px rgba(183, 149, 11, 0.4);
}
.sand-btn:hover {
  background: linear-gradient(135deg, #d4ac0d, #b7950b);
}
.sand-btn:active {
  transform: scale(0.97);
}

.btn-icon {
  font-size: 1.3rem;
}

.hint-box {
  text-align: center;
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

/* モーダル汎用 */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
  opacity: 1;
  transition: opacity 0.2s;
}

.modal.hidden {
  display: none;
  opacity: 0;
  pointer-events: none;
}

.modal-content {
  background: #362920;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
}

.modal-content.large-modal {
  max-width: 820px;
}

.modal-content.danger-content {
  max-width: 500px;
  border-color: var(--color-danger);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid var(--color-border);
  background: #2b1f18;
}

.modal-header h2 {
  font-size: 1.15rem;
  color: #ffd8a8;
}

.close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--color-text-muted);
  cursor: pointer;
  line-height: 1;
}
.close-btn:hover {
  color: white;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* 完成記念モーダルのレイアウト */
@media (min-width: 640px) {
  #modal-finish .modal-body {
    flex-direction: row;
    gap: 24px;
    align-items: flex-start;
  }
}

.finish-preview-box {
  display: flex;
  justify-content: center;
  align-items: center;
  background: #1c140e;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

#photo-card-canvas {
  width: 100%;
  max-width: 280px;
  height: auto;
  aspect-ratio: 4/5;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
  border-radius: 4px;
  background: #fff;
}

.finish-info-form {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.form-group input {
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid var(--color-border);
  background: #261b14;
  color: #fff;
  font-size: 0.95rem;
}

.form-group input:focus {
  outline: none;
  border-color: var(--color-accent);
}

.pedestal-options {
  display: flex;
  gap: 8px;
}

.pedestal-btn {
  flex: 1;
  padding: 8px;
  font-size: 0.8rem;
  background: #2b1f18;
  border: 1px solid var(--color-border);
  color: var(--color-text);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.pedestal-btn.active {
  background: var(--color-accent);
  color: white;
  border-color: var(--color-accent);
}

.finish-stats-summary {
  background: #2b1f18;
  padding: 12px;
  border-radius: 6px;
  font-size: 0.85rem;
  line-height: 1.6;
}

.rank-title {
  color: #f39c12;
  font-size: 1rem;
}

.finish-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

/* 泥だんご棚（コレクション図鑑） */
.gallery-lead {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  padding: 8px 0;
}

.gallery-card {
  background: #261b14;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
  transition: transform 0.2s;
}

.gallery-card:hover {
  transform: translateY(-3px);
  border-color: var(--color-accent);
}

.gallery-thumb {
  width: 100%;
  aspect-ratio: 4/5;
  object-fit: cover;
  background: #19110d;
}

.gallery-info {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.gallery-name {
  font-size: 0.9rem;
  font-weight: bold;
  color: #ffd8a8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gallery-meta {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.gallery-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.gallery-btn {
  flex: 1;
  padding: 5px;
  font-size: 0.75rem;
  border-radius: 4px;
  border: 1px solid var(--color-border);
  background: #362920;
  color: #fff;
  cursor: pointer;
}
.gallery-btn:hover {
  background: var(--color-accent);
}

.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--color-border);
  background: #2b1f18;
  display: flex;
  justify-content: space-between;
}

.btn-danger-text {
  background: none;
  border: none;
  color: #e74c3c;
  font-size: 0.8rem;
  cursor: pointer;
}
.btn-danger-text:hover {
  text-decoration: underline;
}

/* ゲームオーバー画面 */
.broken-icon {
  font-size: 3rem;
  margin-bottom: 10px;
}

.gameover-text {
  font-size: 1.05rem;
  color: #ff9999;
  font-weight: bold;
  margin-bottom: 8px;
}

.gameover-stats {
  font-size: 0.9rem;
  color: #ffd8a8;
  margin-bottom: 12px;
}

.broken-memorial {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-bottom: 20px;
}

.modal-actions-center {
  display: flex;
  gap: 12px;
  justify-content: center;
}

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

/* スマホ表示の最適化 */
@media (max-width: 600px) {
  .main-title {
    font-size: 2.1rem;
  }
  .sub-title-text {
    font-size: 1rem;
  }
  .title-catchcopy {
    font-size: 0.85rem;
    margin: 14px 0 20px;
  }
  .btn-title-start {
    font-size: 1.05rem;
    padding: 14px 20px;
  }
  .title-rules-summary {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .rule-chip {
    flex-direction: row;
    text-align: left;
    padding: 8px 12px;
    gap: 12px;
  }
  
  #status-panel {
    grid-template-columns: repeat(2, 1fr);
    row-gap: 8px;
    padding: 8px 12px;
  }
  
  .header-title h1 {
    font-size: 1.05rem;
  }
  
  .header-title .sub-title {
    display: none;
  }
  
  .btn {
    padding: 6px 10px;
    font-size: 0.8rem;
  }
  
  .control-actions {
    flex-direction: column;
    gap: 8px;
  }
  
  .btn-action {
    max-width: 100%;
    padding: 10px;
  }
}
/* ==========================================
   4. 全国ランキング（番付表）UI
   ========================================== */
.ranking-lead {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  line-height: 1.5;
  background: rgba(20, 10, 5, 0.5);
  padding: 10px 14px;
  border-radius: 6px;
  border-left: 3px solid var(--color-accent);
}

.ranking-table-container {
  width: 100%;
  overflow-x: auto;
  background: #261b14;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.4);
}

.ranking-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.88rem;
  min-width: 540px;
}

.ranking-table th {
  background: #1f140e;
  color: #ffd8a8;
  padding: 12px 14px;
  font-weight: 600;
  border-bottom: 2px solid var(--color-border);
  white-space: nowrap;
}

.ranking-table td {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(107, 79, 59, 0.35);
  color: #f7ede2;
  vertical-align: middle;
}

.ranking-table tbody tr:hover {
  background: rgba(230, 126, 34, 0.12);
}

.ranking-table tbody tr.my-rank {
  background: rgba(243, 156, 18, 0.22);
  border-left: 3px solid #f39c12;
}

.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-weight: bold;
  font-size: 0.85rem;
}

.rank-1 {
  background: linear-gradient(135deg, #f1c40f, #d4ac0d);
  color: #1a1000;
  box-shadow: 0 0 10px rgba(241, 196, 15, 0.6);
}

.rank-2 {
  background: linear-gradient(135deg, #bdc3c7, #95a5a6);
  color: #1a1a1a;
  box-shadow: 0 0 8px rgba(189, 195, 199, 0.5);
}

.rank-3 {
  background: linear-gradient(135deg, #e67e22, #b9770e);
  color: #fff;
  box-shadow: 0 0 8px rgba(230, 126, 34, 0.5);
}

.rank-normal {
  color: #c0a48c;
  background: rgba(255, 255, 255, 0.05);
}

.score-cell {
  font-weight: bold;
  color: #f1c40f !important;
  font-size: 1rem;
  letter-spacing: 0.03em;
}

.player-name-cell {
  font-weight: 600;
  color: #fff !important;
}

.dango-name-cell {
  color: #ffd8a8;
  font-style: italic;
}

.ranking-status-msg {
  text-align: center;
  padding: 24px;
  color: var(--color-text-muted);
  font-size: 0.95rem;
}