/* ==========================================================================
   CSS Variables & Design Tokens
   ========================================================================== */
:root {
  --bg-primary: #070814;
  --bg-secondary: #0d0f26;
  --bg-card: rgba(255, 255, 255, 0.03);
  --border-card: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.2);
  
  --text-primary: #f0f2fa;
  --text-secondary: #a0a5c0;
  --text-muted: #666a8a;
  
  --accent-gold: #ffd700;
  --accent-gold-rgb: 255, 215, 0;
  --accent-purple: #9d4edd;
  --accent-purple-glow: rgba(157, 78, 221, 0.4);
  --accent-blue: #00f2fe;
  --accent-pink: #ff007f;
  
  --success: #00e676;
  --danger: #ff1744;
  
  --font-title: 'Orbitron', 'Noto Sans JP', sans-serif;
  --font-body: 'Noto Sans JP', sans-serif;
  
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   Reset & Base Styles
   ========================================================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  line-height: 1.6;
}

/* ==========================================================================
   Background Space Effects (CSS Only Stars)
   ========================================================================== */
.stars-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
  background: radial-gradient(ellipse at bottom, #1b2735 0%, #090a0f 100%);
  overflow: hidden;
}

.stars-bg::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 80% 20%, rgba(157, 78, 221, 0.15) 0%, transparent 50%),
              radial-gradient(circle at 20% 80%, rgba(0, 242, 254, 0.1) 0%, transparent 50%);
  z-index: -1;
}

/* 星の瞬き */
.stars {
  width: 2px;
  height: 2px;
  background: transparent;
  box-shadow: 
    120px 200px #fff, 450px 300px #fff, 780px 100px #fff, 900px 400px #fff,
    230px 580px #fff, 600px 650px #fff, 820px 750px #fff, 130px 880px #fff,
    1100px 150px #fff, 1300px 500px #fff, 1400px 800px #fff, 1500px 250px #fff,
    300px 100px rgba(255,255,255,0.4), 680px 200px rgba(255,255,255,0.4), 
    1050px 600px rgba(255,255,255,0.4), 500px 850px rgba(255,255,255,0.4);
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  animation: starTwinkle 8s ease-in-out infinite alternate;
}

@keyframes starTwinkle {
  0% { opacity: 0.3; }
  100% { opacity: 1.0; }
}

/* ==========================================================================
   Layout Containers
   ========================================================================== */
.app-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  min-height: 100vh;
}

.app-header {
  text-align: center;
  margin-bottom: 0.5rem;
}

.logo {
  font-family: var(--font-title);
  font-size: 2.2rem;
  font-weight: 900;
  letter-spacing: 0.3rem;
  background: linear-gradient(135deg, var(--accent-gold) 0%, #fff 50%, var(--accent-blue) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.3));
  margin-bottom: 0.5rem;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
  letter-spacing: 0.05rem;
}

.main-content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.grid-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

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

/* ==========================================================================
   Glassmorphism Cards
   ========================================================================== */
.card {
  border-radius: 16px;
  padding: 1.8rem;
  position: relative;
  overflow: hidden;
  transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
}

.glass-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

.glass-card:hover {
  border-color: var(--border-hover);
  box-shadow: 0 8px 32px 0 rgba(157, 78, 221, 0.08);
}

.common-settings-card {
  padding: 1.2rem 1.8rem;
}

.card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-card);
  padding-bottom: 0.75rem;
  justify-content: space-between;
}

.card-header > div {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.card-header h2 {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.05rem;
}

.card-header .icon {
  font-size: 1.4rem;
}

/* ==========================================================================
   Forms & Controls
   ========================================================================== */
.form-group {
  margin-bottom: 1.2rem;
}

.form-group.row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.form-group.row.no-margin {
  margin-bottom: 0;
}

.form-group.row .col {
  flex: 1;
  min-width: 140px;
}

label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.label-with-desc {
  display: flex;
  flex-direction: column;
  margin-bottom: 0.75rem;
}

.label-with-desc .desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: normal;
  margin-top: 0.1rem;
}

input[type="text"],
input[type="date"],
select,
textarea {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-card);
  border-radius: 8px;
  color: var(--text-primary);
  padding: 0.75rem 1rem;
  font-family: inherit;
  font-size: 0.95rem;
  transition: all var(--transition-fast);
}

input[type="text"]:focus,
input[type="date"]:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent-purple);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 3px var(--accent-purple-glow);
}

/* カラーインプットのラッパー */
.color-input-wrapper {
  display: flex;
  gap: 0.5rem;
}

input[type="color"] {
  -webkit-appearance: none;
  border: none;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  cursor: pointer;
  background: transparent;
}

input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

input[type="color"]::-webkit-color-swatch {
  border: 1px solid var(--border-card);
  border-radius: 8px;
}

/* ==========================================================================
   Horoscope Source Media Tabs
   ========================================================================== */
.media-tabs-wrapper {
  display: flex;
  align-items: center;
  gap: 1rem;
  overflow-x: auto;
  padding: 0.2rem 0.5rem;
  scrollbar-width: none; /* Firefox */
}

.media-tabs-wrapper::-webkit-scrollbar {
  display: none; /* Safari, Chrome */
}

.media-tabs {
  display: flex;
  gap: 0.5rem;
}

.media-tab {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-card);
  color: var(--text-secondary);
  padding: 0.6rem 1.2rem;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-normal);
  font-family: inherit;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.media-tab:hover {
  border-color: var(--border-hover);
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}

.media-tab.active {
  background: linear-gradient(135deg, rgba(157, 78, 221, 0.2) 0%, rgba(0, 242, 254, 0.1) 100%);
  border-color: var(--accent-blue);
  color: #fff;
  box-shadow: 0 0 15px rgba(0, 242, 254, 0.2);
  font-weight: 700;
}

.media-tab-remove {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.media-tab-remove:hover {
  background: rgba(255, 23, 68, 0.2);
  color: #ff8a80;
}

.btn-delete-tab-action {
  background: rgba(255, 23, 68, 0.1);
  border: 1px solid rgba(255, 23, 68, 0.2);
  color: #ff8a80;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-delete-tab-action:hover {
  background: rgba(255, 23, 68, 0.3);
  color: #fff;
  border-color: var(--danger);
  box-shadow: 0 0 10px rgba(255, 23, 68, 0.3);
}

/* 媒体ごとの検証セクションを囲むボックス */
.media-specific-validation-box {
  background: rgba(255, 255, 255, 0.015);
  border: 1px dashed rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 1.2rem;
  margin-top: 1rem;
}

.validation-box-header {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent-blue);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
}

/* ==========================================================================
   Star Rating Component
   ========================================================================== */
.star-rating {
  display: inline-flex;
  gap: 0.25rem;
  direction: ltr;
}

.star {
  font-size: 1.3rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--transition-fast), transform var(--transition-fast);
}

.star:hover {
  transform: scale(1.2);
}

.star.active {
  color: var(--accent-gold);
  text-shadow: 0 0 8px rgba(var(--accent-gold-rgb), 0.5);
}

.rating-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  background: rgba(255, 255, 255, 0.02);
  padding: 1rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.rating-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.rating-item span {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* 検証用の大きい星 */
.large-star {
  font-size: 2.2rem;
  margin: 0 0.2rem;
}

.rating-helper {
  font-size: 0.85rem;
  color: var(--accent-gold);
  margin-top: 0.5rem;
  font-weight: 500;
  text-align: center;
  min-height: 1.2rem;
}

/* ==========================================================================
   Tabs (Segmented Controls)
   ========================================================================== */
.tab-control {
  display: flex;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-card);
  border-radius: 30px;
  padding: 3px;
  gap: 2px;
  position: relative;
}

.tab-btn {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  padding: 0.6rem 1rem;
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: 30px;
  cursor: pointer;
  transition: all var(--transition-normal);
  font-family: inherit;
}

.tab-btn:hover {
  color: var(--text-primary);
}

.tab-btn.active {
  background: linear-gradient(135deg, var(--accent-purple) 0%, #6f2dbd 100%);
  color: #fff;
  box-shadow: 0 2px 10px rgba(157, 78, 221, 0.3);
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.8rem 1.8rem;
  font-size: 0.95rem;
  font-weight: 700;
  border-radius: 30px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: all var(--transition-normal);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-purple) 100%);
  color: #fff;
  width: 100%;
}

.btn-glow:hover {
  box-shadow: 0 0 20px rgba(0, 242, 254, 0.5);
  transform: translateY(-2px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-card);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--accent-gold);
  color: var(--accent-gold);
}

.btn-danger {
  background: rgba(255, 23, 68, 0.1);
  border: 1px solid rgba(255, 23, 68, 0.3);
  color: #ff8a80;
}

.btn-danger:hover {
  background: rgba(255, 23, 68, 0.3);
  color: #fff;
}

.btn-sm {
  padding: 0.4rem 1rem;
  font-size: 0.8rem;
  font-weight: 500;
}

.action-wrapper {
  margin-top: 1.5rem;
}

/* ==========================================================================
   Dashboard & Stats Section
   ========================================================================== */
.stats-and-history-grid {
  display: grid;
  grid-template-columns: 1.3fr 1.7fr;
  gap: 1.5rem;
}

@media (max-width: 900px) {
  .stats-and-history-grid {
    grid-template-columns: 1fr;
  }
}

.stats-container {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.stats-container .stat-box:nth-child(5) {
  grid-column: span 2;
}

.stat-box {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  padding: 1rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

.stat-number {
  font-family: var(--font-title);
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--accent-blue);
  text-shadow: 0 0 5px rgba(0, 242, 254, 0.2);
}

#avg-validation {
  color: var(--accent-gold);
  text-shadow: 0 0 5px rgba(255, 215, 0, 0.2);
}

/* 的中率ランキングテーブルのスタイル */
.ranking-wrapper {
  margin-bottom: 1.5rem;
  background: rgba(255, 255, 255, 0.01);
  border: 1px solid var(--border-card);
  border-radius: 12px;
  padding: 1.2rem;
}

.ranking-wrapper h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.ranking-table-container {
  overflow-x: auto;
}

.ranking-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  text-align: left;
}

.ranking-table th,
.ranking-table td {
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.ranking-table th {
  color: var(--text-secondary);
  font-weight: 500;
}

.ranking-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.ranking-table td {
  color: var(--text-primary);
}

.rank-num {
  font-family: var(--font-title);
  font-weight: bold;
  display: inline-block;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  text-align: center;
  line-height: 20px;
}

.rank-1 { background: #ffd700; color: #000; }
.rank-2 { background: #c0c0c0; color: #000; }
.rank-3 { background: #cd7f32; color: #000; }

.empty-table-text {
  text-align: center;
  color: var(--text-muted);
  padding: 1.5rem 0 !important;
}

.analysis-box {
  background: rgba(157, 78, 221, 0.05);
  border-left: 3px solid var(--accent-purple);
  border-radius: 0 8px 8px 0;
  padding: 0.75rem 1rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* ==========================================================================
   History Section
   ========================================================================== */
.history-card {
  display: flex;
  flex-direction: column;
  max-height: 520px;
}

.history-card .card-header {
  justify-content: space-between;
}

.history-list-wrapper {
  overflow-y: auto;
  flex: 1;
  padding-right: 0.5rem;
}

/* カスタムスクロールバー */
.history-list-wrapper::-webkit-scrollbar {
  width: 6px;
}
.history-list-wrapper::-webkit-scrollbar-track {
  background: transparent;
}
.history-list-wrapper::-webkit-scrollbar-thumb {
  background: var(--border-card);
  border-radius: 3px;
}
.history-list-wrapper::-webkit-scrollbar-thumb:hover {
  background: var(--border-hover);
}

.empty-text {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 2rem;
}

.history-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.history-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-card);
  border-radius: 12px;
  padding: 1.2rem;
  position: relative;
  transition: all var(--transition-normal);
}

.history-item:hover {
  border-color: var(--border-hover);
  background: rgba(255, 255, 255, 0.04);
}

.history-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  padding-bottom: 0.4rem;
}

.history-date-sign {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.history-date {
  font-family: var(--font-title);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.history-sign {
  font-size: 0.75rem;
  background: rgba(157, 78, 221, 0.15);
  color: #d8b4fe;
  padding: 0.2rem 0.5rem;
  border-radius: 20px;
  border: 1px solid rgba(157, 78, 221, 0.3);
}

/* 履歴内の媒体別検証結果リスト */
.history-media-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.history-media-row {
  background: rgba(0, 0, 0, 0.25);
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.02);
}

.history-media-row-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.3rem;
}

.history-media-name {
  font-weight: bold;
  font-size: 0.8rem;
  color: var(--accent-blue);
}

.history-media-stars {
  color: var(--accent-gold);
  font-size: 0.8rem;
}

.history-media-details {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.7rem;
  color: var(--text-secondary);
}

.history-media-details span strong {
  color: var(--text-primary);
}

.history-review-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
  white-space: pre-wrap;
  background: rgba(255, 255, 255, 0.01);
  padding: 0.6rem;
  border-radius: 6px;
  border-left: 2px solid var(--text-muted);
}

.delete-item-btn {
  position: absolute;
  top: 1rem;
  right: 1.2rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
  padding: 0.2rem;
  border-radius: 4px;
  transition: all var(--transition-fast);
}

.delete-item-btn:hover {
  color: var(--danger);
  background: rgba(255, 23, 68, 0.1);
}

/* ==========================================================================
   Footer
   ========================================================================== */
.app-footer {
  text-align: center;
  margin-top: auto;
  padding: 2rem 0 1rem;
  border-top: 1px solid var(--border-card);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.offering-trigger {
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.1);
}

/* ==========================================================================
   Modal Standard styles
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(3, 4, 9, 0.85);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.close-modal {
  position: absolute;
  top: 1rem;
  right: 1.2rem;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1.8rem;
  cursor: pointer;
  transition: color var(--transition-fast);
}

.close-modal:hover {
  color: #fff;
}

/* ==========================================================================
   1. Mock Ad Modal Styles
   ========================================================================== */
.ad-modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-card);
  border-radius: 12px;
  width: 90%;
  max-width: 500px;
  padding: 1.8rem;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  animation: adFadeIn 0.3s ease-out;
}

@keyframes adFadeIn {
  0% { opacity: 0; transform: scale(0.97); }
  100% { opacity: 1; transform: scale(1); }
}

.ad-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 0.6rem;
}

.ad-badge {
  font-family: var(--font-body);
  background: rgba(255, 255, 255, 0.15);
  color: var(--text-secondary);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
  letter-spacing: 0.05rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.ad-timer {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.ad-body {
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.2);
  padding: 1.5rem;
  min-height: 180px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}

/* スポンサー広告のインナースタイル */
.ad-title {
  font-size: 1.15rem;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  font-weight: bold;
}

.ad-description {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 1.2rem;
  line-height: 1.5;
}

.ad-graphic {
  font-size: 2.2rem;
  margin-bottom: 0.75rem;
}

.ad-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-card);
  color: var(--text-primary);
  font-weight: 500;
  padding: 0.5rem 1.2rem;
  border-radius: 4px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.ad-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--border-hover);
}

.ad-footer {
  display: flex;
  justify-content: flex-end;
}

.btn-disabled {
  background: #333;
  color: #666;
  cursor: not-allowed;
  pointer-events: none;
}

/* ==========================================================================
   2. Offering (Donation) Modal Styles
   ========================================================================== */
.offering-modal-content {
  width: 90%;
  max-width: 480px;
  padding: 2.2rem 1.8rem;
  text-align: center;
  position: relative;
  background: linear-gradient(180deg, #16183a 0%, #0d0e26 100%);
  border: 1px solid rgba(255, 215, 0, 0.2);
  box-shadow: 0 0 40px rgba(255, 215, 0, 0.1);
}

.offering-header {
  margin-bottom: 1.5rem;
}

.shrine-gate {
  font-size: 3rem;
  color: #ff3333;
  filter: drop-shadow(0 0 10px rgba(255, 51, 51, 0.4));
  display: inline-block;
  margin-bottom: 0.5rem;
}

.offering-header h3 {
  font-size: 1.35rem;
  color: var(--accent-gold);
  margin-bottom: 0.25rem;
}

.offering-header p {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* お賽銭箱 */
.offering-box-wrapper {
  position: relative;
  height: 120px;
  margin: 1.5rem 0;
  display: flex;
  justify-content: center;
  align-items: flex-end;
}

.offering-box {
  width: 160px;
  height: 80px;
  background: linear-gradient(135deg, #8b4513 0%, #5c2c0e 100%);
  border: 4px solid #a0522d;
  border-radius: 4px 4px 12px 12px;
  position: relative;
  box-shadow: 0 10px 20px rgba(0,0,0,0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

.offering-box-slit {
  position: absolute;
  top: 0;
  left: 10%;
  width: 80%;
  height: 8px;
  background: #000;
  border-radius: 4px;
}

.offering-box-text {
  font-size: 1.1rem;
  font-weight: bold;
  color: var(--accent-gold);
  writing-mode: vertical-rl;
  letter-spacing: 0.5rem;
  opacity: 0.8;
  text-shadow: 1px 1px 2px #000;
}

/* コイン投入用のアニメーションエリア */
#coin-drop-area {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.falling-coin {
  position: absolute;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  animation: coinDropAnim 0.6s cubic-bezier(0.55, 0.055, 0.675, 0.19) forwards;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  font-weight: bold;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

@keyframes coinDropAnim {
  0% {
    transform: translateY(0) rotate(0deg) scale(1);
    opacity: 1;
  }
  80% {
    opacity: 1;
  }
  100% {
    transform: translateY(70px) rotate(360deg) scale(0.6);
    opacity: 0;
  }
}

/* お賽銭のコインセレクター */
.coin-selector p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.8rem;
}

.coin-buttons {
  display: flex;
  justify-content: space-around;
  gap: 0.5rem;
}

.coin-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  transition: transform var(--transition-fast);
}

.coin-btn:hover {
  transform: translateY(-4px);
}

.coin {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: bold;
  font-family: var(--font-title);
  color: rgba(0,0,0,0.7);
  box-shadow: inset 0 2px 4px rgba(255,255,255,0.4), 0 3px 6px rgba(0,0,0,0.4);
  position: relative;
}

.coin-bronze {
  background: linear-gradient(135deg, #d87a56 0%, #a0522d 100%);
  border: 2px solid #b8623d;
}

.coin-silver {
  background: linear-gradient(135deg, #e0e0e0 0%, #9e9e9e 100%);
  border: 2px solid #b0b0b0;
}

.coin-gold {
  background: linear-gradient(135deg, #ffd700 0%, #daa520 100%);
  border: 2px solid #e5c100;
  color: #4a3b00;
}

.coin-paper {
  width: 60px;
  height: 36px;
  border-radius: 4px;
  background: linear-gradient(135deg, #c8e6c9 0%, #81c784 100%);
  border: 1px dashed #4caf50;
  font-size: 0.7rem;
}

.coin-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* おみくじ結果表示 */
.offering-result-box {
  margin-top: 1.8rem;
  background: rgba(255, 215, 0, 0.05);
  border: 1px dashed var(--accent-gold);
  border-radius: 8px;
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  animation: fadeInResult 0.5s ease-out;
}

.offering-result-box.hidden {
  display: none;
}

@keyframes fadeInResult {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.omikuji-stamp {
  font-size: 1.5rem;
  font-weight: 900;
  background: #ff3333;
  color: #fff;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  box-shadow: 0 0 10px rgba(255, 51, 51, 0.3);
  flex-shrink: 0;
}

.omikuji-text {
  font-size: 0.8rem;
  text-align: left;
  color: var(--text-primary);
  line-height: 1.4;
}

/* ==========================================================================
   Zodiac & Input Visibility Improvements
   ========================================================================== */
select#zodiac-sign,
select#prediction-rank,
input[type="date"]#prediction-date {
  background-color: #ffffff !important;
  color: #0d0f26 !important;
  font-weight: 700 !important;
  border: 2px solid var(--accent-purple) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5) !important;
}

select#zodiac-sign option,
select#prediction-rank option {
  background-color: #ffffff !important;
  color: #0d0f26 !important;
  font-weight: 500 !important;
}

/* 履歴カードをホバー可能に */
.history-item {
  cursor: pointer;
}

.history-item:hover {
  transform: translateY(-2px);
  border-color: var(--accent-blue);
  box-shadow: 0 8px 24px rgba(0, 242, 254, 0.1);
}

/* ==========================================================================
   3. History Detail Modal Styles
   ========================================================================== */
.history-detail-modal-content {
  width: 90%;
  max-width: 750px;
  max-height: 85vh;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #101230 0%, #060718 100%);
  border: 1px solid rgba(0, 242, 254, 0.2);
  box-shadow: 0 0 40px rgba(0, 242, 254, 0.15);
  border-radius: 20px;
  position: relative;
}

.history-detail-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 1rem;
}

.history-detail-header .icon {
  font-size: 2.2rem;
  filter: drop-shadow(0 0 8px rgba(0, 242, 254, 0.4));
}

.history-detail-title-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.history-detail-date {
  font-family: var(--font-title);
  font-size: 1.5rem;
  font-weight: 900;
  color: #fff;
  letter-spacing: 0.05rem;
}

.history-detail-sign {
  font-size: 0.85rem;
  background: rgba(157, 78, 221, 0.2);
  color: #d8b4fe;
  padding: 0.2rem 0.75rem;
  border-radius: 20px;
  align-self: flex-start;
  border: 1px solid rgba(157, 78, 221, 0.4);
}

.history-detail-scroll-area {
  overflow-y: auto;
  flex: 1;
  padding-right: 0.5rem;
}

/* カスタムスクールバー */
.history-detail-scroll-area::-webkit-scrollbar {
  width: 6px;
}
.history-detail-scroll-area::-webkit-scrollbar-track {
  background: transparent;
}
.history-detail-scroll-area::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}
.history-detail-scroll-area::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

.detail-block {
  margin-bottom: 2rem;
}

.detail-block-title {
  font-size: 1rem;
  font-weight: bold;
  color: var(--accent-gold);
  margin-bottom: 0.75rem;
  border-left: 3px solid var(--accent-gold);
  padding-left: 0.5rem;
}

.detail-review-text {
  font-size: 1rem;
  line-height: 1.8;
  color: #e0e0ff;
  white-space: pre-wrap;
  background: rgba(255, 255, 255, 0.02);
  padding: 1.2rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

/* モーダル内媒体別表示 */
.detail-media-list-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.detail-media-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 1.2rem;
}

.detail-media-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  padding-bottom: 0.5rem;
}

.detail-media-name {
  font-size: 1.1rem;
  font-weight: bold;
  color: var(--accent-blue);
}

.detail-media-stars {
  color: var(--accent-gold);
  font-size: 1.1rem;
  letter-spacing: 0.1rem;
}

.detail-media-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1rem;
}

@media (max-width: 768px) {
  .detail-media-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 500px) {
  .detail-media-grid {
    grid-template-columns: 1fr;
  }
}

.detail-media-info-box {
  background: rgba(0, 0, 0, 0.2);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
}

.detail-media-info-box h5 {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

.detail-media-info-box p {
  color: #fff;
  font-weight: bold;
}

.detail-media-ratings {
  background: rgba(0, 0, 0, 0.2);
  padding: 1rem;
  border-radius: 8px;
  grid-column: span 3;
}

@media (max-width: 768px) {
  .detail-media-ratings {
    grid-column: span 2;
  }
}

@media (max-width: 500px) {
  .detail-media-ratings {
    grid-column: span 1;
  }
}

.detail-media-ratings h5 {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.detail-ratings-flex {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.detail-rating-bubble {
  background: rgba(255, 255, 255, 0.04);
  padding: 0.3rem 0.75rem;
  border-radius: 15px;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.detail-rating-label {
  color: var(--text-secondary);
}

.detail-rating-stars {
  color: var(--accent-gold);
}

.detail-media-memo {
  grid-column: span 3;
  background: rgba(255, 255, 255, 0.01);
  border-left: 3px solid var(--accent-purple);
  padding: 0.75rem 1rem;
  border-radius: 0 8px 8px 0;
  font-size: 0.85rem;
}

@media (max-width: 768px) {
  .detail-media-memo {
    grid-column: span 2;
  }
}

@media (max-width: 500px) {
  .detail-media-memo {
    grid-column: span 1;
  }
}

.detail-media-memo h5 {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

.detail-media-memo p {
  color: #e0e0ff;
  line-height: 1.5;
}

/* ==========================================================================
   Interactive Tab Renaming & Empty State Styles
   ========================================================================== */
/* 名前が空のタブのスタイル */
.media-tab.empty-name-tab span {
  color: var(--text-muted) !important;
  font-style: italic !important;
}

/* 編集可能な媒体名タイトルのスタイル */
#active-media-title-input,
#active-media-title-validation {
  cursor: pointer;
  transition: color var(--transition-fast), border-bottom var(--transition-fast);
  border-bottom: 1px dashed transparent;
  display: inline-block;
}

#active-media-title-input:hover,
#active-media-title-validation:hover {
  color: var(--accent-blue) !important;
  border-bottom-color: var(--accent-blue) !important;
}

/* ==========================================================================
   Media Dropdown & Placeholder Card Styles
   ========================================================================== */
.media-select-card {
  padding: 1rem 1.8rem;
}

.media-select-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.media-select-container label {
  margin-bottom: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.media-select-controls {
  flex: 1;
  max-width: 400px;
  min-width: 250px;
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.btn-rename-action {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-card);
  color: var(--text-primary);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.btn-rename-action:hover {
  background: rgba(0, 242, 254, 0.1);
  border-color: var(--accent-blue);
  box-shadow: 0 0 10px rgba(0, 242, 254, 0.2);
  transform: scale(1.05);
}

/* 媒体選択ドロップダウンの視認性重視スタイル */
select#media-dropdown {
  background-color: #ffffff !important;
  color: #0d0f26 !important;
  font-weight: 700 !important;
  border: 2px solid var(--accent-blue) !important;
  box-shadow: 0 2px 10px rgba(0, 242, 254, 0.25) !important;
  border-radius: 30px;
  padding: 0.6rem 1.5rem;
  cursor: pointer;
}

select#media-dropdown option {
  background-color: #ffffff !important;
  color: #0d0f26 !important;
  font-weight: 500 !important;
}

/* 媒体未登録時のプレースホルダーカード */
.no-media-card {
  text-align: center;
  padding: 4rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  max-width: 700px;
  margin: 2rem auto;
  border: 2px dashed var(--border-card);
}

.no-media-card h3 {
  font-size: 1.5rem;
  color: #fff;
}

.no-media-card p {
  color: var(--text-secondary);
  max-width: 480px;
  line-height: 1.6;
  font-size: 0.95rem;
}

.placeholder-icon {
  font-size: 4rem;
  filter: drop-shadow(0 0 15px rgba(157, 78, 221, 0.4));
  animation: floating 3s ease-in-out infinite;
}

@keyframes floating {
  0% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
  100% { transform: translateY(0); }
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   5. Interactive Tour (Speech Bubble) Styles
   ========================================================================== */
.tour-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(3, 4, 9, 0.65);
  backdrop-filter: blur(2px);
  z-index: 1000;
  pointer-events: auto;
  transition: opacity var(--transition-normal);
}

.tour-highlight {
  position: relative !important;
  z-index: 1001 !important;
  box-shadow: 0 0 0 4px var(--accent-purple), 0 8px 32px rgba(157, 78, 221, 0.4) !important;
  pointer-events: none; /* ハイライト中の要素は誤操作を防ぐためにツアー中操作不可にする */
}

.tour-bubble {
  position: absolute;
  width: 280px;
  background: linear-gradient(135deg, #16183a 0%, #0d0e26 100%);
  border: 2px solid var(--accent-purple);
  border-radius: 12px;
  padding: 1.2rem;
  box-shadow: 0 10px 30px rgba(157, 78, 221, 0.3);
  z-index: 1002;
  font-size: 0.85rem;
  animation: tourBubbleFade 0.25s ease-out;
  color: var(--text-primary);
}

@keyframes tourBubbleFade {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.tour-bubble-arrow {
  position: absolute;
  width: 0;
  height: 0;
  border: 8px solid transparent;
}

/* 矢印の向きごとのスタイル */
.tour-bubble.arrow-top .tour-bubble-arrow {
  border-bottom-color: var(--accent-purple);
  top: -16px;
  transform: translateX(-50%);
}
.tour-bubble.arrow-bottom .tour-bubble-arrow {
  border-top-color: var(--accent-purple);
  bottom: -16px;
  transform: translateX(-50%);
}
.tour-bubble.arrow-left .tour-bubble-arrow {
  border-right-color: var(--accent-purple);
  left: -16px;
  top: 50%;
  transform: translateY(-50%);
}
.tour-bubble.arrow-right .tour-bubble-arrow {
  border-left-color: var(--accent-purple);
  right: -16px;
  top: 50%;
  transform: translateY(-50%);
}

.tour-bubble h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent-gold);
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.tour-bubble p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 0.8rem;
}

.tour-bubble p strong {
  color: var(--accent-blue);
}

.tour-bubble-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 0.6rem;
  margin-top: 0.4rem;
}

#tour-progress {
  font-family: var(--font-title);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.tour-btn-group {
  display: flex;
  gap: 0.4rem;
}

.tour-btn-group .btn-sm {
  padding: 0.3rem 0.8rem;
  font-size: 0.75rem;
  border-radius: 4px;
}

.tour-skip-link {
  display: block;
  width: 100%;
  text-align: center;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.7rem;
  margin-top: 0.6rem;
  cursor: pointer;
  text-decoration: underline;
  transition: color var(--transition-fast);
}

.tour-skip-link:hover {
  color: var(--danger);
}

.edit-icon-hint {
  font-size: 0.85rem;
  margin-left: 6px;
  opacity: 0.5;
  transition: opacity var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
  cursor: pointer;
  display: inline-block;
  vertical-align: middle;
}

.rename-trigger:hover {
  color: var(--accent-blue) !important;
}

#active-media-title-input:hover + .edit-icon-hint,
#active-media-title-validation:hover + .edit-icon-hint,
.edit-icon-hint:hover {
  opacity: 1;
  color: var(--accent-blue);
  transform: scale(1.15);
}

/* ==========================================================================
   Draft Save and Editing UI
   ========================================================================== */
.btn-group-horizontal {
  display: flex;
  gap: 1rem;
  justify-content: stretch;
  flex-wrap: wrap;
  width: 100%;
}

.btn-group-horizontal .btn {
  flex: 1 1 200px;
}

.editing-draft-banner {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.8rem 1.2rem;
  background: rgba(255, 193, 7, 0.1);
  border: 1px solid rgba(255, 193, 7, 0.3);
  border-radius: 12px;
  margin-bottom: 1.5rem;
  color: var(--accent-gold);
  font-weight: 500;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.editing-draft-banner.hidden {
  display: none !important;
}

.draft-badge {
  background: rgba(255, 193, 7, 0.15);
  border: 1px solid var(--accent-gold);
  color: var(--accent-gold);
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  margin-left: 0.8rem;
  font-weight: bold;
  display: inline-block;
  vertical-align: middle;
}

.history-detail-actions {
  display: flex;
  justify-content: flex-end;
  padding: 1rem 1.5rem 1.5rem 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.history-detail-actions .btn {
  width: auto;
  padding: 0.6rem 1.5rem;
}


/* ==========================================================================
   Zodiac Sign Average Rank Display Box
   ========================================================================== */
.zodiac-rank-stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, rgba(157, 78, 221, 0.08) 0%, rgba(0, 242, 254, 0.04) 100%);
  border: 1px solid rgba(157, 78, 221, 0.15);
  border-radius: 12px;
  padding: 0.8rem 1.2rem;
  margin-bottom: 1.5rem;
  box-shadow: inset 0 0 10px rgba(157, 78, 221, 0.05);
  transition: all var(--transition-normal);
}

.zodiac-rank-stats:hover {
  border-color: rgba(0, 242, 254, 0.3);
  box-shadow: 0 4px 15px rgba(0, 242, 254, 0.05);
}

.zodiac-rank-stats .stats-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.zodiac-rank-stats .stats-label strong {
  color: var(--accent-blue);
  font-weight: bold;
}

.zodiac-rank-stats .stats-value {
  font-size: 1.25rem;
  font-weight: 900;
  color: var(--accent-gold);
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.3);
  font-family: var(--font-title);
}

/* ==========================================================================
   Detail Modal Media Grid (4-Column Layout)
   ========================================================================== */
.detail-media-grid {
  grid-template-columns: repeat(4, 1fr) !important;
}

.detail-media-ratings,
.detail-media-memo {
  grid-column: span 4 !important;
}

@media (max-width: 900px) {
  .detail-media-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .detail-media-ratings,
  .detail-media-memo {
    grid-column: span 2 !important;
  }
}

@media (max-width: 500px) {
  .detail-media-grid {
    grid-template-columns: 1fr !important;
  }
  .detail-media-ratings,
  .detail-media-memo {
    grid-column: span 1 !important;
  }
}
