/* ========================================
   disc_roulette_tool - Styles
   暗いホールでも見やすいダークテーマ
   ======================================== */

:root {
  --bg-dark: #1a1a2e;
  --bg-card: #16213e;
  --bg-input: #0f3460;
  --text-main: #eaeaea;
  --text-sub: #a0a0a0;
  --accent: #e94560;
  --accent-hover: #ff6b6b;
  --success: #00d9ff;
  --border: #2a2a4a;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Hiragino Sans', sans-serif;
  background: var(--bg-dark);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  max-width: 600px;
  margin: 0 auto;
  padding: 20px;
}

/* ========== Header ========== */
.header {
  text-align: center;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.header h1 {
  font-size: 2.5rem;
  font-weight: 400;
  color: var(--accent);
  margin: 0;
  letter-spacing: 0.2em;
  text-shadow:
    0 0 10px var(--accent),
    0 0 20px var(--accent),
    0 0 40px rgba(233, 69, 96, 0.5);
  font-family: 'DotGothic16', sans-serif;
}

.subtitle {
  color: var(--text-sub);
  font-size: 0.9rem;
}

/* ========== Section ========== */
.section {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}

.section-title {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--accent);
}

/* ========== Tabs ========== */
.tab-container {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.tab-btn {
  flex: 1;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 2px solid var(--border);
  border-radius: 8px;
  color: var(--text-sub);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.tab-btn:hover {
  border-color: var(--accent);
  color: var(--text-main);
}

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

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ========== Roulette Box ========== */
.roulette-box {
  text-align: center;
}

.roulette-box h3 {
  font-size: 1rem;
  color: var(--text-sub);
  margin-bottom: 20px;
}

/* ========== Buttons ========== */
.btn {
  padding: 14px 28px;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #ff6b6b);
  color: white;
  box-shadow: 0 4px 15px rgba(233, 69, 96, 0.4);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(233, 69, 96, 0.5);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--bg-input);
  color: var(--text-main);
  border: 2px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--accent);
}

.btn-large {
  width: 100%;
  padding: 18px;
  font-size: 1.1rem;
}

.btn-small {
  padding: 8px 12px;
  font-size: 0.8rem;
}

.btn-danger {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 6px 12px;
  font-size: 0.75rem;
}

.btn-danger:hover {
  background: var(--accent);
  color: white;
}

/* ========== Result Box ========== */
.result-box {
  margin-top: 24px;
  padding: 16px;
  background: var(--bg-input);
  border-radius: 12px;
  border: 2px solid var(--border);
}

.result-label {
  font-size: 0.85rem;
  color: var(--text-sub);
  margin-bottom: 16px;
}

.result-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-dark);
  border-radius: 8px;
  margin-bottom: 8px;
}

.result-item:last-child {
  margin-bottom: 0;
}

/* ========================================
   ⚠️ 警告: この枠サイズ設定は変更しないでください！
   リール画像のサイズがバラバラ（最大746x254px）のため、
   ここを変更するとルーレット時にガタガタ揺れます。
   ======================================== */

/* Horizontal layout for reels */
.result-horizontal {
  display: flex;
  gap: 6px;
}

.result-horizontal .reel-result-img {
  width: 100%;
  height: auto;
}

/* ⚠️ 変更禁止: 枠サイズ固定 */
.result-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px;
  background: var(--bg-dark);
  border-radius: 12px;
  /* 枠サイズ固定（最大画像746x254の比率を維持） */
  width: 160px;
  min-height: 80px;
}

/* ⚠️ 変更禁止: 画像表示サイズ固定 */
.result-column .reel-result-img {
  width: 100%;
  height: 55px;
  object-fit: contain;
  filter: brightness(1.1);
}

.reel-name {
  font-size: 0.9rem;
  color: var(--text-sub);
}

.reel-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--success);
  text-align: center;
}

.reel-result-img {
  width: 100%;
  height: auto;
  border-radius: 4px;
}

/* ========== History ========== */
.result-history {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-item {
  display: flex;
  gap: 8px;
  padding: 8px;
  background: var(--bg-dark);
  border-radius: 8px;
  opacity: 0.7;
}

.history-item img {
  flex: 1;
  max-width: 45%;
  height: auto;
  border-radius: 4px;
}

.group-label {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  padding: 4px 8px;
  background: var(--accent);
  color: white;
  font-size: 11px;
  font-weight: bold;
  border-radius: 4px;
  writing-mode: vertical-rl;
}

.color-label {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  padding: 4px 8px;
  color: white;
  font-size: 14px;
  font-weight: bold;
  border-radius: 4px;
  writing-mode: vertical-rl;
}

.color-blue {
  background: #3b82f6;
}

.color-red {
  background: #ef4444;
}

.color-result {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
}

.color-label-large {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  color: white;
  font-size: 24px;
  font-weight: bold;
  border-radius: 8px;
}

.btn-clear {
  margin-top: 12px;
  width: 100%;
}

/* ========== Machine Section ========== */
.machine-section {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.add-machine-form {
  display: flex;
  gap: 10px;
}

.input-text {
  flex: 1;
  padding: 14px 16px;
  background: var(--bg-input);
  border: 2px solid var(--border);
  border-radius: 10px;
  color: var(--text-main);
  font-size: 1rem;
}

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

.input-text::placeholder {
  color: var(--text-sub);
}

/* ========== Machine List ========== */
.machine-list-container {
  background: var(--bg-input);
  border-radius: 12px;
  padding: 16px;
}

.list-label {
  font-size: 0.85rem;
  color: var(--text-sub);
  margin-bottom: 12px;
}

.machine-list {
  list-style: none;
  max-height: 300px;
  overflow-y: auto;
}

.machine-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg-dark);
  border-radius: 8px;
  margin-bottom: 8px;
}

.machine-item:last-child {
  margin-bottom: 0;
}

.machine-item input[type="checkbox"] {
  width: 22px;
  height: 22px;
  accent-color: var(--accent);
  cursor: pointer;
}

.machine-name {
  flex: 1;
  font-size: 1rem;
}

.empty-message {
  text-align: center;
  color: var(--text-sub);
  font-size: 0.9rem;
  padding: 20px;
}

.empty-message.hidden {
  display: none;
}

/* ========== Machine Result ========== */
.result-machine {
  text-align: center;
}

.machine-result {
  font-size: 2rem;
  font-weight: 700;
  color: var(--success);
  margin-top: 12px;
  text-shadow: 0 0 20px rgba(0, 217, 255, 0.5);
}

/* ========== Footer ========== */
.footer {
  text-align: center;
  padding: 20px;
  color: var(--text-sub);
  font-size: 0.8rem;
}

/* ========== Reel Images ========== */
.btn-reel-toggle {
  margin-top: 16px;
  width: 100%;
}

/* ディスクアップ2 - パステルピンク */
#btn-show-reel-21,
#btn-close-reel-21 {
  background: linear-gradient(135deg, #ffb6c1, #ffc0cb);
  color: #333;
  border: none;
}

#btn-show-reel-21:hover,
#btn-close-reel-21:hover {
  background: linear-gradient(135deg, #ffc0cb, #ffd1dc);
}

/* ウルトラリミックス - パステルブルー */
#btn-show-reel,
#btn-close-reel {
  background: linear-gradient(135deg, #a8d8ea, #c5e8f7);
  color: #333;
  border: none;
}

#btn-show-reel:hover,
#btn-close-reel:hover {
  background: linear-gradient(135deg, #c5e8f7, #d4f1f9);
}

.reel-images {
  display: none;
  margin-top: 20px;
  background: var(--bg-dark);
  border-radius: 12px;
  padding: 16px;
  border: 1px solid var(--border);
}

.reel-images.show {
  display: block;
}

.reel-images-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.reel-images-header h4 {
  font-size: 1rem;
  color: var(--text-main);
}

.btn-close {
  background: transparent;
  color: var(--text-sub);
  border: 1px solid var(--border);
  padding: 6px 12px;
  font-size: 0.8rem;
}

.btn-close:hover {
  color: var(--text-main);
  border-color: var(--text-main);
}

.reel-image-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.reel-tab {
  flex: 1;
  padding: 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-sub);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

.reel-tab:hover {
  border-color: var(--accent);
  color: var(--text-main);
}

.reel-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.reel-image-container {
  text-align: center;
  overflow-x: auto;
}

.reel-img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}

/* ========== Animation ========== */
@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

.result-box.animating .reel-value,
.result-box.animating .machine-result {
  animation: pulse 0.1s ease-in-out;
}

/* ========== Responsive ========== */
@media (max-width: 480px) {
  .container {
    padding: 4px;
  }

  .header h1 {
    font-size: 1.2rem;
  }

  .section {
    padding: 8px;
    border-radius: 8px;
  }

  .section-title {
    font-size: 0.9rem;
    margin-bottom: 8px;
    padding-bottom: 6px;
  }

  .tab-btn {
    padding: 6px 8px;
    font-size: 0.7rem;
  }

  .btn-large {
    padding: 12px;
    font-size: 0.95rem;
  }

  .result-box {
    padding: 4px;
    margin-top: 12px;
  }

  .result-column {
    padding: 8px;
    gap: 6px;
  }

  .result-horizontal {
    gap: 6px;
  }

  .reel-result-img {
    /* 最大画像: 746x254px, アスペクト比約2.9:1 */
    /* モバイル幅約170pxで表示時、高さ約59px必要 */
    min-height: 65px;
    object-fit: contain;
  }

  .result-column {
    /* 枠の高さを固定して動かないようにする */
    min-height: 100px;
  }

  .reel-name {
    font-size: 0.8rem;
  }

  .result-item {
    padding: 8px 10px;
  }

  .reel-value {
    font-size: 1rem;
  }

  .machine-result {
    font-size: 1.6rem;
  }
}

.history-item {
  opacity: 1 !important;
}
