/* ==========================================================================
   超モダン・グラスモーフィズム スタイルシート
   ========================================================================== */
:root {
  --bg-main: #f0f4fd;
  --glass-bg: rgba(255, 255, 255, 0.72);
  --glass-border: rgba(255, 255, 255, 0.85);
  --glass-shadow: 0 16px 36px rgba(31, 38, 135, 0.07);
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --accent: #ec4899;
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #ec4899 100%);
  --text-dark: #1e293b;
  --text-muted: #64748b;
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 10px;
  --font-family: 'Plus Jakarta Sans', 'Zen Kaku Gothic New', sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font-family);
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--bg-main);
  color: var(--text-dark);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* 背景オーロラアニメーション */
.aurora-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.blob {
  position: absolute;
  filter: blur(80px);
  border-radius: 50%;
  opacity: 0.55;
  animation: float 20s infinite alternate ease-in-out;
}

.blob-1 {
  width: 450px;
  height: 450px;
  background: #c7d2fe;
  top: -80px;
  left: -80px;
}

.blob-2 {
  width: 500px;
  height: 500px;
  background: #fbcfe8;
  top: 20%;
  right: -100px;
  animation-duration: 25s;
}

.blob-3 {
  width: 400px;
  height: 400px;
  background: #bae6fd;
  bottom: -60px;
  left: 30%;
  animation-duration: 18s;
}

.blob-4 {
  width: 350px;
  height: 350px;
  background: #fed7aa;
  bottom: 10%;
  right: 15%;
  animation-duration: 22s;
}

@keyframes float {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(40px, -30px) scale(1.08); }
  100% { transform: translate(-30px, 40px) scale(0.95); }
}

/* グラス共通クラス */
.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius-lg);
}

.glass-panel-glow {
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(28px) saturate(200%);
  border: 1.5px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 25px 60px rgba(99, 102, 241, 0.25), 0 0 40px rgba(236, 72, 153, 0.15);
  border-radius: var(--radius-lg);
}

/* コンテナレイアウト */
.app-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-height: 100vh;
}

/* ヘッダー */
.app-header {
  padding: 16px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-icon {
  width: 44px;
  height: 44px;
  background: var(--accent-gradient);
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: #fff;
  box-shadow: 0 8px 16px rgba(99, 102, 241, 0.3);
}

.brand-text h1 {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sub-badge {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.header-actions {
  display: flex;
  gap: 10px;
}

/* メイン2カラムレイアウト */
.main-layout {
  display: grid;
  grid-template-columns: 1fr 440px;
  gap: 24px;
  flex: 1;
}

@media (max-width: 1024px) {
  .main-layout {
    grid-template-columns: 1fr;
  }
}

/* ルーレットステージ */
.roulette-stage {
  padding: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  position: relative;
}

.wheel-outer-wrapper {
  position: relative;
  width: 100%;
  max-width: 520px;
  aspect-ratio: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: auto 0;
}

/* 上部インジケーター（針） */
.wheel-pointer {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  transition: transform 0.08s ease;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.2));
}

.pointer-tip {
  width: 32px;
  height: 42px;
  background: linear-gradient(180deg, #ff4757 0%, #ff6b81 100%);
  clip-path: polygon(50% 100%, 0 0, 100% 0);
  border-radius: 6px 6px 0 0;
}

.wheel-pointer.tick {
  transform: translateX(-50%) rotate(-12deg);
}

.canvas-box {
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

#rouletteCanvas {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.12), 0 0 0 10px rgba(255, 255, 255, 0.85);
  background: #ffffff;
}

/* 中央SPINボタン */
.center-spin-btn {
  position: absolute;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  border: 4px solid #ffffff;
  background: #ffffff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15), inset 0 2px 6px rgba(255, 255, 255, 0.8);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  z-index: 10;
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.18s ease;
}

.center-spin-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 12px 30px rgba(99, 102, 241, 0.35);
}

.center-spin-btn:active {
  transform: scale(0.94);
}

.center-spin-btn .spin-label {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: 0.05em;
}

.center-spin-btn .spin-play-icon {
  width: 14px;
  height: 14px;
  stroke: var(--accent);
  fill: var(--accent);
}

/* 下部コントロール */
.stage-controls {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 24px;
  gap: 16px;
  flex-wrap: wrap;
}

.quick-info {
  display: flex;
  gap: 12px;
}

.info-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.info-badge i {
  width: 16px;
  height: 16px;
}

/* 右側パネル */
.panel-section {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 580px;
  overflow: hidden;
}

.tabs-nav {
  display: flex;
  padding: 12px;
  background: rgba(255, 255, 255, 0.4);
  border-bottom: 1px solid rgba(255, 255, 255, 0.6);
  gap: 6px;
}

.tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 8px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.82rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn i {
  width: 15px;
  height: 15px;
}

.tab-btn.active {
  background: #ffffff;
  color: var(--primary);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.tab-content {
  display: none;
  padding: 20px;
  flex: 1;
  overflow-y: auto;
}

.tab-content.active {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ボタンスタイル */
.glass-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-dark);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

.glass-btn:hover {
  background: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.08);
}

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

.glass-btn.icon-only {
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 50%;
}

.glass-btn.btn-sm {
  padding: 6px 12px;
  font-size: 0.78rem;
  border-radius: var(--radius-sm);
}

.glass-btn.btn-large {
  padding: 14px 28px;
  font-size: 1rem;
}

.glass-btn.btn-primary {
  background: var(--accent-gradient);
  color: #fff;
  border: none;
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.35);
}

.glass-btn.btn-primary:hover {
  box-shadow: 0 10px 25px rgba(99, 102, 241, 0.5);
}

.glass-btn.btn-accent {
  background: var(--primary);
  color: #fff;
  border: none;
}

.danger-hover:hover {
  color: #ef4444;
  border-color: #fca5a5;
}

/* フォーム部品 */
.glass-input, .glass-textarea {
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.9rem;
  color: var(--text-dark);
  outline: none;
  transition: all 0.2s;
}

.glass-input:focus, .glass-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.add-item-form {
  display: flex;
  gap: 8px;
  align-items: center;
}

.color-picker {
  -webkit-appearance: none;
  border: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  cursor: pointer;
  background: transparent;
}

.color-picker::-webkit-color-swatch-wrapper { padding: 0; }
.color-picker::-webkit-color-swatch {
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.item-input { flex: 1; }

.weight-box {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.weight-input { width: 56px; text-align: center; }

.item-sub-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* アイテムリスト */
.items-list-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  max-height: 400px;
  padding-right: 4px;
}

.item-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}

.item-row.disabled {
  opacity: 0.45;
  background: rgba(240, 240, 240, 0.5);
}

.item-color-indicator {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.item-name {
  flex: 1;
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-weight-badge {
  font-size: 0.75rem;
  padding: 3px 8px;
  background: rgba(99, 102, 241, 0.1);
  color: var(--primary);
  border-radius: 12px;
  font-weight: 700;
}

.item-btn-remove {
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  transition: all 0.15s;
}

.item-btn-remove:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

/* 履歴・統計 */
.history-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.stats-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.stat-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 600;
}

.stat-bar-bg {
  height: 7px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 10px;
  overflow: hidden;
}

.stat-bar-fill {
  height: 100%;
  border-radius: 10px;
  transition: width 0.4s ease;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 250px;
  overflow-y: auto;
  margin-top: 10px;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.75);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}

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

/* プリセット */
.preset-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.preset-card {
  padding: 16px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all 0.2s ease;
}

.preset-card:hover {
  transform: translateY(-3px);
  border-color: var(--primary);
  box-shadow: 0 8px 18px rgba(99, 102, 241, 0.15);
}

.preset-icon { font-size: 1.6rem; }
.preset-title { font-size: 0.95rem; font-weight: 700; }
.preset-count { font-size: 0.75rem; color: var(--text-muted); }

/* 設定 */
.settings-group {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.setting-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.75);
  border-radius: var(--radius-md);
}

.setting-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.setting-info span { font-weight: 700; font-size: 0.88rem; }
.setting-info small { color: var(--text-muted); font-size: 0.75rem; }

.range-control {
  display: flex;
  align-items: center;
  gap: 10px;
}

.palette-presets {
  display: flex;
  gap: 8px;
}

.palette-chip {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.9);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 1rem;
  transition: transform 0.15s;
}

.palette-chip:hover { transform: scale(1.15); }

/* モーダル */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  width: 100%;
  max-width: 480px;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  transform: scale(0.92);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-backdrop.open .modal-card {
  transform: scale(1);
}

.winner-card {
  text-align: center;
  align-items: center;
}

.winner-trophy {
  width: 72px;
  height: 72px;
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  box-shadow: 0 10px 24px rgba(245, 158, 11, 0.35);
}

.winner-trophy i { width: 38px; height: 38px; }

.winner-eyebrow {
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  color: var(--primary);
}

.winner-title {
  font-size: 2.2rem;
  font-weight: 800;
  word-break: break-word;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.winner-stats-badge {
  font-size: 0.82rem;
  padding: 6px 16px;
  background: rgba(99, 102, 241, 0.1);
  color: var(--primary);
  border-radius: 20px;
  font-weight: 700;
}

.winner-actions {
  display: flex;
  flex-direction: column;
  width: 100%;
  gap: 10px;
}

.glass-textarea {
  width: 100%;
  height: 180px;
  resize: vertical;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}