:root {
  --bg-top: #7c1d1d;
  --bg-mid: #450a0a;
  --bg-bottom: #1e0505;
  --gold: #fbbf24;
  --gold-light: #fef08a;
  --red: #dc2626;
  --card-bg: rgba(255, 251, 245, 0.96);
  --text-main: #1f2937;
  --text-muted: #6b7280;
  --border-gold: #f59e0b;
  --shadow-lg: 0 20px 45px rgba(0, 0, 0, 0.45);
}

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

html,
body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif;
  background: radial-gradient(circle at 50% 18%, #b91c1c 0%, var(--bg-mid) 55%, var(--bg-bottom) 100%);
  color: var(--text-main);
  padding-bottom: 48px;
}

/* 紙吹雪キャンバス */
#confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 200;
}

/* ヘッダー＆ガーランド */
.site-header {
  position: relative;
  text-align: center;
  padding: 36px 16px 18px;
  color: #fff;
}

.bunting {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  display: flex;
  justify-content: space-between;
  overflow: hidden;
  pointer-events: none;
}

.bunting span {
  flex: 1 1 0;
  max-width: 36px;
  height: 24px;
  background: var(--gold);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.25));
}

.bunting span:nth-child(3n + 1) {
  background: #ef4444;
}
.bunting span:nth-child(3n + 2) {
  background: #fde047;
}
.bunting span:nth-child(3n) {
  background: #ffffff;
}

/* SVG アイコン共通スタイル */
.svg-icon {
  display: inline-block;
  width: 1.15em;
  height: 1.15em;
  vertical-align: -0.18em;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  flex-shrink: 0;
}

.festival-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(90deg, #fde047, #f59e0b, #fde047);
  color: #7c2d12;
  font-weight: 800;
  font-size: 0.85rem;
  padding: 5px 16px;
  border-radius: 999px;
  letter-spacing: 0.05em;
  box-shadow: 0 4px 14px rgba(251, 191, 36, 0.45);
  margin-bottom: 10px;
  max-width: 100%;
}

.festival-badge .svg-icon {
  width: 1em;
  height: 1em;
  vertical-align: -0.1em;
}

.site-title {
  font-size: clamp(1.5rem, 5.5vw, 2.55rem);
  font-weight: 900;
  letter-spacing: 0.03em;
  line-height: 1.25;
  color: #fffbeb;
  text-shadow: 0 3px 0 #991b1b, 0 6px 18px rgba(0, 0, 0, 0.5);
  margin-bottom: 8px;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.site-subtitle {
  font-size: clamp(0.8rem, 3.2vw, 0.95rem);
  color: #fecaca;
  line-height: 1.45;
}

.top-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 14px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.35);
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: transform 0.15s ease, background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.24);
  transform: translateY(-1px);
}

/* メインレイアウト */
.main-container {
  max-width: 1060px;
  width: 100%;
  margin: 0 auto;
  padding: 8px 16px;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.95fr);
  gap: 24px;
  align-items: start;
}

.main-container > * {
  min-width: 0;
  width: 100%;
}

@media (max-width: 860px) {
  .main-container {
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
  }
}

/* ステージカード */
.stage-card {
  background: var(--card-bg);
  border: 3px solid var(--border-gold);
  border-radius: 24px;
  padding: 22px 20px;
  box-shadow: var(--shadow-lg), inset 0 0 0 3px #fff3c4;
  position: relative;
  overflow: hidden;
}

.status-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #fef3c7;
  border: 1.5px solid #f59e0b;
  color: #92400e;
  padding: 9px 14px;
  border-radius: 16px;
  font-weight: 700;
  font-size: 0.9rem;
  line-height: 1.35;
  margin-bottom: 12px;
  text-align: center;
}

.status-banner.already-drawn {
  background: #f3f4f6;
  border-color: #d1d5db;
  color: #4b5563;
}

.status-banner.unlimited {
  background: #dbeafe;
  border-color: #60a5fa;
  color: #1e40af;
}

.status-dot {
  width: 10px;
  height: 10px;
  flex-shrink: 0;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25);
}

.status-banner.already-drawn .status-dot {
  background: #9ca3af;
  box-shadow: none;
}

.status-banner.unlimited .status-dot {
  background: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}

.garagara-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.guide-bubble {
  background: #fff;
  border: 2px solid #f59e0b;
  color: #92400e;
  font-weight: 700;
  font-size: 0.88rem;
  line-height: 1.4;
  padding: 8px 16px;
  border-radius: 16px;
  position: relative;
  margin-bottom: 6px;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.15);
  text-align: center;
  max-width: 100%;
}

.guide-bubble::after {
  content: "";
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 8px 8px 0;
  border-style: solid;
  border-color: #f59e0b transparent transparent;
}

.machine-wrapper {
  position: relative;
  width: 100%;
  max-width: 390px;
  aspect-ratio: 420 / 340;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.garagara-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.svg-drum,
.svg-handle {
  transform-box: fill-box;
  transform-origin: 50% 50%;
}

/* ガラガラ回転アニメーション */
.machine-wrapper.spinning .svg-drum {
  animation: drumRotate 1.7s cubic-bezier(0.35, 0.05, 0.25, 1) forwards;
}

.machine-wrapper.spinning .svg-handle {
  animation: handleRotate 1.7s cubic-bezier(0.35, 0.05, 0.25, 1) forwards;
}

@keyframes drumRotate {
  0% {
    transform: rotate(0deg);
  }
  20% {
    transform: rotate(-35deg);
  }
  100% {
    transform: rotate(720deg);
  }
}

@keyframes handleRotate {
  0% {
    transform: rotate(0deg);
  }
  20% {
    transform: rotate(-35deg);
  }
  100% {
    transform: rotate(720deg);
  }
}

/* 玉の飛び出しアニメーション（画面幅に応じた%指定でスマホでもズレない） */
.rolling-ball {
  position: absolute;
  width: 6.8%;
  height: 8.4%;
  border-radius: 50%;
  top: 40.5%;
  left: 60.8%;
  z-index: 10;
  box-shadow: inset -4px -4px 8px rgba(0, 0, 0, 0.35), inset 4px 4px 8px rgba(255, 255, 255, 0.7), 0 4px 8px rgba(0, 0, 0, 0.35);
}

.rolling-ball.drop-anim {
  animation: ballRollOut 0.78s cubic-bezier(0.25, 0.8, 0.35, 1) forwards;
}

@keyframes ballRollOut {
  0% {
    transform: translate(0%, 0%) scale(0.5);
    opacity: 0;
  }
  20% {
    transform: translate(15%, 145%) scale(1);
    opacity: 1;
  }
  58% {
    transform: translate(168%, 238%) rotate(180deg);
  }
  78% {
    transform: translate(258%, 195%) rotate(290deg);
  }
  100% {
    transform: translate(300%, 238%) rotate(360deg) scale(1.12);
    opacity: 1;
  }
}

/* 玉のカラーバリエーション */
.ball-gold {
  background: radial-gradient(circle at 32% 30%, #fffbeb 0%, #fde047 28%, #f59e0b 68%, #92400e 100%);
  border: 1.5px solid #fef08a;
}

.ball-red {
  background: radial-gradient(circle at 32% 30%, #fecaca 0%, #ef4444 35%, #b91c1c 75%, #7f1d1d 100%);
}

.ball-blue {
  background: radial-gradient(circle at 32% 30%, #dbeafe 0%, #3b82f6 35%, #1d4ed8 75%, #1e3a8a 100%);
}

.ball-green {
  background: radial-gradient(circle at 32% 30%, #d1fae5 0%, #10b981 35%, #047857 75%, #064e3b 100%);
}

.ball-white {
  background: radial-gradient(circle at 32% 30%, #ffffff 0%, #f1f5f9 55%, #cbd5e1 85%, #94a3b8 100%);
  border: 1px solid #cbd5e1;
}

/* スピンボタン */
.action-area {
  text-align: center;
  width: 100%;
  margin-top: 6px;
}

.spin-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: linear-gradient(180deg, #ef4444 0%, #dc2626 52%, #b91c1c 100%);
  color: #fff;
  border: 3px solid #fde047;
  padding: 15px 36px;
  max-width: 100%;
  font-size: 1.15rem;
  font-weight: 900;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 6px 0 #7f1d1d, 0 12px 24px rgba(220, 38, 38, 0.4);
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.spin-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  filter: brightness(1.06);
  box-shadow: 0 8px 0 #7f1d1d, 0 14px 28px rgba(220, 38, 38, 0.5);
}

.spin-btn:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow: 0 3px 0 #7f1d1d, 0 6px 12px rgba(220, 38, 38, 0.35);
}

.spin-btn:disabled {
  background: linear-gradient(180deg, #9ca3af, #6b7280);
  border-color: #d1d5db;
  box-shadow: 0 4px 0 #4b5563;
  cursor: not-allowed;
  opacity: 0.85;
}

.reset-timer {
  margin-top: 10px;
  font-size: 0.84rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* 本日の結果ボックス */
.today-result-box {
  margin-top: 18px;
  width: 100%;
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border: 2px dashed #f59e0b;
  border-radius: 16px;
  padding: 14px 16px;
  text-align: center;
}

.spin-btn .svg-icon {
  width: 1.3em;
  height: 1.3em;
}

.today-result-header {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  font-size: 0.84rem;
  font-weight: 800;
  color: #b45309;
  margin-bottom: 8px;
}

.today-result-body {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 12px;
}

.ball-mini {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: inset -3px -3px 6px rgba(0, 0, 0, 0.3), 0 2px 5px rgba(0, 0, 0, 0.2);
}

.today-result-info {
  text-align: left;
  min-width: 0;
}

.today-tier-name {
  font-size: 0.84rem;
  font-weight: 800;
  color: #92400e;
}

.today-prize-name {
  font-size: 1rem;
  font-weight: 900;
  color: #1f2937;
  word-break: break-word;
}

.today-result-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.today-cta-btn {
  padding: 11px 20px !important;
  font-size: 0.95rem !important;
  width: 100%;
  max-width: 320px;
}

.secondary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: #fff;
  color: #b45309;
  border: 1.5px solid #f59e0b;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.secondary-btn:hover {
  background: #fef3c7;
}

/* サイドバー（等級一覧＆履歴） */
.info-sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}

.info-card {
  background: var(--card-bg);
  border: 2px solid var(--border-gold);
  border-radius: 20px;
  padding: 18px 18px;
  box-shadow: var(--shadow-lg);
  min-width: 0;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid #fde68a;
}

.card-header h2 {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 1.05rem;
  font-weight: 800;
  color: #7c2d12;
}

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

.text-btn {
  background: none;
  border: none;
  color: #b45309;
  font-size: 0.8rem;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
}

.prize-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.prize-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border: 1px solid #f3e8d2;
  border-radius: 12px;
  padding: 10px 12px;
  min-width: 0;
}

.prize-item-details {
  flex: 1;
  min-width: 0;
}

.prize-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
}

.prize-tier-badge {
  font-weight: 800;
  font-size: 0.86rem;
  color: #7c2d12;
}

.prize-prob-badge {
  font-size: 0.74rem;
  font-weight: 700;
  color: #6b7280;
  background: #f3f4f6;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.prize-item-name {
  font-weight: 700;
  font-size: 0.92rem;
  color: #111827;
  margin-top: 3px;
  word-break: break-word;
}

/* 履歴リスト */
.history-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.84rem;
  background: #fff;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid #f3f4f6;
  min-width: 0;
}

.history-ball {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  flex-shrink: 0;
}

.history-date {
  color: var(--text-muted);
  font-size: 0.76rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.history-prize {
  font-weight: 700;
  color: #1f2937;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}


.history-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 16px 0;
}

/* モーダル共通 */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 5, 5, 0.75);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  z-index: 150;
  animation: fadeIn 0.2s ease;
}

.hidden {
  display: none !important;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-card {
  background: #fffdf9;
  border: 3px solid var(--border-gold);
  border-radius: 24px;
  width: 100%;
  max-height: 92vh;
  max-height: 92dvh;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.55);
  position: relative;
  overflow: hidden;
}

/* 結果モーダル */
.result-modal-card {
  max-width: 440px;
  padding: 24px 20px 20px;
  text-align: center;
  overflow-y: auto;
  animation: popUp 0.35s cubic-bezier(0.22, 1.28, 0.36, 1);
}

@keyframes popUp {
  0% {
    transform: scale(0.75);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.result-rays {
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: repeating-conic-gradient(
    from 0deg,
    rgba(253, 224, 71, 0.22) 0deg 15deg,
    transparent 15deg 30deg
  );
  animation: slowSpin 18s linear infinite;
  pointer-events: none;
  z-index: 0;
}

@keyframes slowSpin {
  to {
    transform: rotate(360deg);
  }
}

.result-modal-card > * {
  position: relative;
  z-index: 1;
}

.result-badge-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #fef3c7;
  color: #b45309;
  font-weight: 900;
  font-size: 0.82rem;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid #f59e0b;
  margin-bottom: 6px;
  max-width: 100%;
}

.result-date-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #7c2d12;
  margin-bottom: 8px;
}

.result-ball-showcase {
  display: flex;
  justify-content: center;
  margin: 4px 0 12px;
}

.modal-ball {
  width: 78px;
  height: 78px;
  border-radius: 50%;
  box-shadow: inset -10px -10px 20px rgba(0, 0, 0, 0.35), inset 8px 8px 16px rgba(255, 255, 255, 0.8), 0 12px 26px rgba(0, 0, 0, 0.3);
}

.modal-tier-title {
  font-size: clamp(1.45rem, 6vw, 1.9rem);
  font-weight: 900;
  color: #991b1b;
  margin-bottom: 4px;
}

.modal-prize-title {
  font-size: clamp(1.05rem, 4.5vw, 1.25rem);
  font-weight: 800;
  color: #111827;
  margin-bottom: 6px;
  word-break: break-word;
}

.modal-prize-desc {
  font-size: 0.86rem;
  color: #4b5563;
  margin-bottom: 14px;
  line-height: 1.45;
}

/* キャンペーンリンク適用ボックス（結果画面の主役導線） */
.campaign-apply-box {
  background: linear-gradient(180deg, #fffbeb 0%, #fef3c7 100%);
  border: 2px solid #f59e0b;
  border-radius: 16px;
  padding: 12px 14px 14px;
  margin-bottom: 14px;
  box-shadow: 0 6px 18px rgba(245, 158, 11, 0.2);
}

.campaign-apply-notice {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.8rem;
  color: #b91c1c;
  line-height: 1.4;
  margin-bottom: 10px;
}

.campaign-cta-btn .cta-main {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.campaign-cta-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 100%;
  text-decoration: none;
  background: linear-gradient(180deg, #10b981 0%, #059669 55%, #047857 100%);
  color: #ffffff;
  border: 3px solid #fde047;
  padding: 14px 18px;
  border-radius: 999px;
  font-size: 1.08rem;
  font-weight: 900;
  box-shadow: 0 5px 0 #064e3b, 0 10px 22px rgba(5, 150, 105, 0.4);
  transition: transform 0.12s ease, filter 0.15s ease;
  animation: pulseCta 1.8s infinite ease-in-out;
}

.campaign-cta-btn:hover {
  filter: brightness(1.06);
  transform: translateY(-2px);
}

.campaign-cta-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #064e3b;
}

.cta-sub {
  font-size: 0.75rem;
  font-weight: 700;
  color: #d1fae5;
}

@keyframes pulseCta {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.025);
  }
}

.modal-sub-close-btn {
  background: #f3f4f6;
  color: #4b5563;
  border: 1px solid #d1d5db;
  padding: 9px 28px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
}

.modal-sub-close-btn:hover {
  background: #e5e7eb;
}

/* パスワード認証モーダル */
.password-modal-card {
  max-width: 380px;
  padding: 24px 20px;
  text-align: center;
}

.password-modal-title {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 1.15rem;
  color: #7c2d12;
  margin-bottom: 8px;
}

.password-modal-desc {
  font-size: 0.85rem;
  color: #4b5563;
  margin-bottom: 14px;
  line-height: 1.45;
}

.password-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.password-verify-input {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid #cbd5e1;
  border-radius: 10px;
  font-size: 16px;
  text-align: center;
  letter-spacing: 0.1em;
}

.password-verify-input:focus {
  outline: none;
  border-color: #f59e0b;
}

.password-error-msg {
  font-size: 0.82rem;
  font-weight: 700;
  color: #dc2626;
  margin: 0;
}

.password-modal-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 6px;
}

.admin-password-config-box {
  background: #fffbeb;
  border: 1.5px solid #fcd34d;
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-password-input-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding-left: 4px;
}

.password-hint {
  font-size: 0.78rem;
  color: #64748b;
}

/* 管理モーダル */
.admin-modal-card {
  max-width: 780px;
  overflow-y: auto;
  padding: 22px 20px;
}

.admin-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 2px solid #fde68a;
  padding-bottom: 12px;
  margin-bottom: 16px;
}

.admin-modal-header h2 {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 1.15rem;
  color: #7c2d12;
}

.close-x-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f3f4f6;
  border: none;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 50%;
  font-size: 1rem;
  cursor: pointer;
  color: #4b5563;
  transition: background 0.15s ease, color 0.15s ease;
}

.close-x-btn:hover {
  background: #e5e7eb;
  color: #111827;
}

.admin-section {
  margin-bottom: 18px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 14px;
}

.admin-section h3 {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.96rem;
  color: #1f2937;
  margin-bottom: 6px;
}

.admin-section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.admin-inline-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.file-upload-label {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.admin-help {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 12px;
  line-height: 1.45;
}

.admin-quick-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.admin-date-sim-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  background: #f8fafc;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}

.sim-date-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 700;
  color: #334155;
}

.admin-date-input {
  padding: 6px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 700;
}

.admin-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.86rem;
  line-height: 1.35;
  cursor: pointer;
  border: 1.5px solid #f59e0b;
  background: #fef3c7;
  color: #92400e;
  transition: background 0.15s ease;
}

.admin-action-btn:hover {
  background: #fde68a;
}

.export-js-btn {
  background: #ecfdf5;
  border-color: #10b981;
  color: #065f46;
}

.export-js-btn:hover {
  background: #d1fae5;
}

/* エクセル貼り付けエリア */
.paste-box-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.excel-paste-textarea {
  width: 100%;
  padding: 10px;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  font-family: monospace;
  font-size: 14px;
  resize: vertical;
}

.paste-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.paste-actions-row .admin-action-btn {
  flex: 1 1 220px;
}

/* 49日分の日別URL一覧アコーディオン */
.daily-links-accordion {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
  padding: 8px 12px;
}

.daily-links-accordion summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 800;
  color: #7c2d12;
  cursor: pointer;
  padding: 4px 0;
}

.daily-links-table-wrap {
  margin-top: 10px;
  max-height: 300px;
  overflow: auto;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
}

.daily-links-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  min-width: 640px;
}

.daily-links-table th,
.daily-links-table td {
  padding: 6px 8px;
  border-bottom: 1px solid #f1f5f9;
  text-align: left;
}

.daily-links-table th {
  position: sticky;
  top: 0;
  background: #fef3c7;
  color: #92400e;
  font-weight: 800;
  z-index: 1;
}

.daily-date-cell {
  font-weight: 800;
  white-space: nowrap;
  color: #1e293b;
}

.daily-url-input {
  width: 100%;
  min-width: 105px;
  padding: 5px 6px;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  font-size: 13px;
}

.unlimited-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.86rem;
  font-weight: 700;
  color: #1e40af;
  cursor: pointer;
}

.unlimited-toggle input {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.admin-table-wrapper {
  width: 100%;
}

.admin-prize-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.admin-prize-table th,
.admin-prize-table td {
  padding: 8px;
  border-bottom: 1px solid #f3f4f6;
  text-align: left;
  vertical-align: middle;
}

.admin-prize-table th {
  color: #6b7280;
  font-weight: 700;
  font-size: 0.78rem;
}

.admin-tier-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  white-space: nowrap;
}

.admin-input {
  width: 100%;
  padding: 7px 9px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 16px;
}

.admin-input-sub {
  margin-top: 5px;
  font-size: 14px;
  color: #4b5563;
}

.admin-weight-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.admin-weight-input {
  width: 72px;
  padding: 7px 8px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  text-align: right;
  font-weight: 700;
  font-size: 16px;
}

.admin-calc-prob {
  font-size: 0.8rem;
  color: #6b7280;
  min-width: 54px;
}

.admin-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid #e2e8f0;
}

.admin-footer-export-btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.export-sub-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 8px;
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  color: #334155;
  cursor: pointer;
  transition: all 0.2s ease;
}

.export-sub-btn:hover {
  background: #ecfdf5;
  border-color: #10b981;
  color: #065f46;
}

.export-sub-btn .svg-icon {
  width: 16px;
  height: 16px;
}

.save-btn {
  padding: 11px 28px;
  font-size: 1rem;
}

/* トースト通知 */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100vw - 32px);
  background: #111827;
  color: #fff;
  padding: 11px 18px;
  border-radius: 16px;
  font-size: 0.85rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.4;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
  z-index: 300;
}

/* ==========================================
   スマートフォン向けレスポンシブ最適化
   ========================================== */
@media (max-width: 600px) {
  body {
    padding-bottom: 32px;
  }

  .site-header {
    padding: 30px 12px 14px;
  }

  .bunting span {
    height: 18px;
  }

  .festival-badge {
    font-size: 0.76rem;
    padding: 4px 12px;
  }

  .main-container {
    padding: 4px 12px;
    gap: 16px;
  }

  .stage-card {
    padding: 16px 14px;
    border-radius: 20px;
  }

  .status-banner {
    font-size: 0.82rem;
    padding: 8px 10px;
  }

  .guide-bubble {
    font-size: 0.8rem;
    padding: 7px 12px;
  }

  .spin-btn {
    width: 100%;
    max-width: 310px;
    padding: 14px 20px;
    font-size: 1.05rem;
  }

  .info-card {
    padding: 14px 14px;
    border-radius: 18px;
  }

  .result-modal-card {
    padding: 20px 16px 18px;
  }

  .campaign-cta-btn {
    font-size: 0.98rem;
    padding: 13px 14px;
  }

  /* 管理画面のテーブルをスマホでは縦並びカード化 */
  .admin-modal-card {
    padding: 16px 14px;
  }

  .admin-prize-table thead {
    display: none;
  }

  .admin-prize-table,
  .admin-prize-table tbody,
  .admin-prize-table tr,
  .admin-prize-table td {
    display: block;
    width: 100%;
  }

  .admin-prize-table tr {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 10px;
    margin-bottom: 10px;
    background: #fafafa;
  }

  .admin-prize-table td {
    padding: 4px 0;
    border-bottom: none;
  }

  .admin-weight-wrap {
    justify-content: flex-start;
    margin-top: 4px;
  }

  .admin-weight-wrap::before {
    content: "当選重み:";
    font-size: 0.8rem;
    font-weight: 700;
    color: #4b5563;
  }

  .admin-modal-footer {
    flex-direction: column-reverse;
    align-items: stretch;
    gap: 12px;
  }

  .admin-footer-export-btns {
    width: 100%;
    justify-content: stretch;
  }

  .export-sub-btn {
    flex: 1 1 45%;
    justify-content: center;
  }

  .save-btn {
    width: 100%;
  }
}
