/* ============================================================
   秒速！朝礼カンペ - スタイルシート (Mobile-First)
   ============================================================ */

:root {
  --bg-primary: #f8fafc;
  --bg-card: #ffffff;
  --bg-subtle: #f1f5f9;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-script: #1e293b;
  --border-color: #e2e8f0;
  
  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  
  --accent-gold: #d97706;
  --accent-green: #16a34a;
  --dark-prompter-bg: #090d16;
  --dark-prompter-text: #f8fafc;

  --script-font-size: 22px;
  --script-line-height: 1.9;
}

/* 黒背景カンペモード（直射日光・屋外・老眼対策） */
body.dark-mode {
  --bg-primary: #050811;
  --bg-card: #0f172a;
  --bg-subtle: #1e293b;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-script: #ffffff;
  --border-color: #334155;
  --primary-light: #1e293b;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Hiragino Sans", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-main);
  line-height: 1.5;
  padding: 12px;
  transition: background-color 0.2s, color 0.2s;
}

.app-container {
  max-width: 540px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

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

.logo-area {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-badge {
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 6px;
  border-radius: 4px;
  letter-spacing: 0.05em;
}

.logo-title {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.icon-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

/* セレクターカード（3タップUI） */
.selector-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

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

.group-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.required-badge {
  font-size: 10px;
  background: #f1f5f9;
  color: #475569;
  padding: 1px 5px;
  border-radius: 3px;
}

body.dark-mode .required-badge {
  background: #334155;
  color: #cbd5e1;
}

/* ボタン群・チップUI */
.button-toggle-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
}

.chip-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.chip-btn.span-two {
  grid-column: span 2;
}

.chip-grid.three-col {
  grid-template-columns: 1fr 1fr 1fr;
}

.chip-btn {
  background: var(--bg-subtle);
  border: 1.5px solid transparent;
  color: var(--text-main);
  padding: 10px 6px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 44px;
  transition: all 0.15s ease;
}

.chip-btn small {
  font-size: 10px;
  font-weight: 400;
  color: var(--text-muted);
}

.chip-btn.active {
  background: var(--primary-light);
  border-color: var(--primary-color);
  color: var(--primary-color);
  font-weight: 700;
}

body.dark-mode .chip-btn.active {
  background: #1e3a8a;
  border-color: #3b82f6;
  color: #93c5fd;
}

body.dark-mode .chip-btn.active small {
  color: #bfdbfe;
}

/* カレンダー日付ピッカー（透明オーバーレイ方式） */
.custom-date-box {
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.custom-date-box input[type="date"] {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0.001; /* 完全に透明だがクリックを直接受ける */
  cursor: pointer;
  z-index: 2;
  border: none;
  background: transparent;
}

.custom-date-box .display-label {
  pointer-events: none;
  z-index: 1;
}

/* 天候アコーディオン */
.weather-details {
  border-top: 1px dashed var(--border-color);
  padding-top: 8px;
}

.weather-summary {
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  font-weight: 600;
}

.mt-2 { margin-top: 8px; }

/* カンペ表示カード（本番用） */
.script-display-card {
  background: var(--bg-card);
  border: 2px solid var(--primary-color);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.08);
}

body.dark-mode .script-display-card {
  border-color: #3b82f6;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

.script-meta-header {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 10px;
}

.meta-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}

.badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
  background: var(--bg-subtle);
  color: var(--text-main);
}

.badge-accent {
  background: var(--primary-color);
  color: #fff;
}

.badge-count {
  background: #fef3c7;
  color: #92400e;
  margin-left: auto;
}

body.dark-mode .badge-count {
  background: #78350f;
  color: #fde68a;
}

.script-title {
  font-size: 16px;
  font-weight: 800;
  margin-bottom: 4px;
  line-height: 1.4;
}

.script-fact {
  font-size: 11px;
  color: var(--text-muted);
}

/* プロンプター・ツールバー */
.prompter-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-subtle);
  border-radius: 10px;
  padding: 6px 10px;
  gap: 8px;
}

.tool-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.tool-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.tool-btn.active {
  background: #dcfce7;
  border-color: #22c55e;
  color: #15803d;
}

body.dark-mode .tool-btn.active {
  background: #14532d;
  border-color: #22c55e;
  color: #86efac;
}

.indicator {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
  display: inline-block;
}

.font-label {
  font-size: 12px;
  font-weight: 700;
  min-width: 32px;
  text-align: center;
}

/* 台本テキスト本文エリア（棒読み特化） */
.script-body-container {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
  max-height: 480px;
  overflow-y: auto;
  scroll-behavior: smooth;
}

body.dark-mode .script-body-container {
  background: #000000;
  border-color: #1e293b;
}

.script-text-content {
  font-size: var(--script-font-size);
  line-height: var(--script-line-height);
  color: var(--text-script);
  font-weight: 500;
  letter-spacing: 0.03em;
  word-break: keep-all;
  overflow-wrap: break-word;
}

/* 台本内の段落・ト書きスタイル */
.script-text-content p {
  margin-bottom: 1.2em;
}

.script-pause-marker {
  display: inline-block;
  background: #fee2e2;
  color: #991b1b;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  margin: 6px 0;
  vertical-align: middle;
}

body.dark-mode .script-pause-marker {
  background: #7f1d1d;
  color: #fecaca;
}

/* アクション行 */
.script-action-row {
  display: flex;
  gap: 8px;
}

.action-btn {
  flex: 1;
  padding: 12px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.action-btn.secondary {
  background: var(--bg-subtle);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.action-btn.primary {
  background: var(--primary-color);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}

.action-btn.primary:hover {
  background: var(--primary-hover);
}

/* PWAインストールバナー（お守り訴求） */
.pwa-install-banner {
  background: linear-gradient(135deg, #1e293b, #0f172a);
  color: #ffffff;
  border-radius: 16px;
  padding: 16px;
  display: flex;
  gap: 12px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.15);
  animation: fadeIn 0.3s ease;
}

/* ★ PWA（ホーム画面から起動）環境では、インストール案内バナーを自動で完全非表示 */
@media all and (display-mode: standalone) {
  .pwa-install-banner {
    display: none !important;
  }
}

.banner-icon {
  font-size: 32px;
  flex-shrink: 0;
}

.banner-content {
  flex: 1;
}

.banner-title {
  font-size: 15px;
  font-weight: 800;
  margin-bottom: 4px;
}

.banner-desc {
  font-size: 12px;
  color: #cbd5e1;
  line-height: 1.5;
  margin-bottom: 8px;
}

.banner-perks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  color: #67e8f9;
}

/* フッター */
.app-footer {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  padding: 16px 0 24px;
}

/* ============================================================
   日付選択モーダル (100%確実に動作するUI)
   ============================================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.15s ease-out;
}

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

.modal-card {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  max-width: 420px;
  width: 100%;
  padding: 22px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

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

.modal-title {
  font-size: 17px;
  font-weight: 800;
}

.modal-close {
  background: var(--bg-subtle);
  border: none;
  font-size: 16px;
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.modal-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.modal-input-wrap input[type="date"] {
  width: 100%;
  padding: 12px 14px;
  font-size: 16px;
  font-weight: 700;
  font-family: inherit;
  border-radius: 10px;
  border: 1.5px solid var(--border-color);
  background: var(--bg-subtle);
  color: var(--text-main);
  outline: none;
  cursor: pointer;
}

.modal-input-wrap input[type="date"]:focus {
  border-color: var(--primary-color);
}

.modal-quick-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.quick-chip {
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  color: var(--text-main);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.quick-chip:hover, .quick-chip.active {
  background: var(--primary-light);
  border-color: var(--primary-color);
  color: var(--primary-color);
}

body.dark-mode .quick-chip:hover, body.dark-mode .quick-chip.active {
  background: #1e3a8a;
  border-color: #3b82f6;
  color: #93c5fd;
}

/* ============================================================
   チケット管理 & チャージUIスタイル
   ============================================================ */

/* ヘッダーのチケットバッジボタン */
.ticket-badge-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ticket-badge-btn:hover {
  background: #fde68a;
  transform: translateY(-1px);
}

body.dark-mode .ticket-badge-btn {
  background: #78350f;
  color: #fef3c7;
  border-color: #b45309;
}

.ticket-icon {
  font-size: 14px;
}

/* チケット残数ゼロ時のすりガラス・ロックオーバーレイ */
.script-body-container {
  position: relative;
}

.ticket-lock-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  border-radius: 12px;
  animation: fadeIn 0.2s ease;
}

body.dark-mode .ticket-lock-overlay {
  background: rgba(15, 23, 42, 0.92);
}

.lock-card {
  text-align: center;
  max-width: 380px;
  width: 100%;
  padding: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
}

.lock-icon {
  font-size: 36px;
  margin-bottom: 8px;
}

.lock-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 8px;
}

.lock-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 16px;
}

.lock-price-badge {
  background: var(--bg-subtle);
  border: 1.5px dashed var(--border-color);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 18px;
}

.lock-badge-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  background: #10b981;
  color: #ffffff;
  padding: 2px 8px;
  border-radius: 9999px;
  margin-bottom: 6px;
}

.lock-price {
  font-size: 15px;
  color: var(--text-main);
}

.lock-price strong {
  font-size: 24px;
  color: var(--primary-color);
}

.pulse-btn {
  animation: pulseGlow 2s infinite;
}

@keyframes pulseGlow {
  0% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.4); }
  70% { box-shadow: 0 0 0 10px rgba(37, 99, 235, 0); }
  100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
}

/* チャージモーダル詳細 */
.charge-card {
  max-width: 440px;
}

.charge-hero {
  text-align: center;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 16px;
}

.charge-icon-circle {
  font-size: 32px;
  width: 56px;
  height: 56px;
  margin: 0 auto 10px;
  background: #fef3c7;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

body.dark-mode .charge-icon-circle {
  background: #78350f;
}

.charge-hero-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 6px;
}

.charge-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

.charge-plan-box {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.04), rgba(59, 130, 246, 0.08));
  border: 2px solid var(--primary-color);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 16px;
}

body.dark-mode .charge-plan-box {
  background: rgba(30, 58, 138, 0.2);
  border-color: #3b82f6;
}

.plan-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.plan-name {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-main);
}

.plan-tag {
  font-size: 11px;
  font-weight: 700;
  background: #ef4444;
  color: #fff;
  padding: 2px 8px;
  border-radius: 9999px;
}

.plan-price-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 12px;
}

.plan-amount {
  font-size: 32px;
  font-weight: 900;
  color: var(--primary-color);
}

.plan-unit {
  font-size: 13px;
  color: var(--text-muted);
}

.plan-features {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-main);
}

.charge-btn-large {
  width: 100%;
  padding: 14px;
  font-size: 16px;
  font-weight: 800;
  margin-bottom: 14px;
}

.charge-footer-note {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
}

/* 開発テスト用コントロールボックス */
.dev-test-charge-box {
  margin-top: 14px;
  padding: 10px;
  background: var(--bg-subtle);
  border: 1px dashed #94a3b8;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dev-label {
  font-size: 10px;
  font-weight: 700;
  color: #64748b;
}

.btn-dev-charge {
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 700;
  background: #10b981;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.btn-dev-charge:hover {
  background: #059669;
}

.btn-dev-reset {
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 700;
  background: #64748b;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.btn-dev-reset:hover {
  background: #475569;
}

