/* ===========================
   困りッチ - スタイルシート
   銀行アプリ風のダークテーマ
   =========================== */

:root {
  --bg: #0a0a1a;
  --card: #141428;
  --card-border: #1e1e3a;
  --surface: #1a1a35;
  --gold: #f0b832;
  --gold-dim: #a07820;
  --accent: #6c5ce7;
  --accent2: #a29bfe;
  --success: #00b894;
  --danger: #e74c3c;
  --warning: #fdcb6e;
  --text: #edf2f7;
  --text-dim: #8892a4;
  --radius: 14px;
  --radius-sm: 8px;
}

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

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  font-family: 'Zen Kaku Gothic New', sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

#app {
  width: 100%; height: 100%;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
}

/* ===== 画面遷移 ===== */
.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.screen.active {
  display: flex;
  opacity: 1;
}

/* ===== ボタン共通 ===== */
.btn {
  border: none; cursor: pointer;
  font-family: inherit;
  font-weight: 700;
  font-size: 1rem;
  padding: 12px 24px;
  border-radius: var(--radius);
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn:active { transform: scale(0.96); }

.btn-primary {
  background: linear-gradient(135deg, var(--gold), #e8a020);
  color: #1a1000;
  box-shadow: 0 4px 15px rgba(240, 184, 50, 0.3);
}
.btn-primary:active { box-shadow: 0 2px 8px rgba(240, 184, 50, 0.2); }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--card-border);
}

.btn-ghost {
  background: transparent;
  color: var(--accent2);
  border: 1px solid var(--accent);
}

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

.btn-icon {
  background: none; border: none; font-size: 1.3rem;
  cursor: pointer; padding: 4px;
}

.btn-back {
  background: none; border: none;
  color: var(--accent2); font-size: 1rem;
  cursor: pointer; font-family: inherit; font-weight: 700;
  padding: 8px 0;
}

/* ===== タイトル画面 ===== */
.title-bg {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 20px;
  background: radial-gradient(ellipse at 50% 30%, #1a1040 0%, var(--bg) 70%);
  padding: 30px 24px;
  overflow-y: auto;
}
.title-logo { text-align: center; }
.title-icon {
  font-size: 4rem;
  display: block;
  animation: float 3s ease-in-out infinite;
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}
.title-logo h1 {
  font-size: 2.5rem; font-weight: 900;
  background: linear-gradient(135deg, var(--gold), #ffe066, var(--gold-dim));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 4px;
}
.title-sub {
  font-size: 0.95rem; color: var(--accent2);
  margin-top: 4px; letter-spacing: 2px;
}

/* 難易度セレクター */
.difficulty-selector {
  text-align: center;
  width: 100%; max-width: 300px;
}
.difficulty-label {
  font-size: 0.8rem; color: var(--text-dim);
  margin-bottom: 8px; letter-spacing: 2px;
}
.difficulty-buttons {
  display: flex; gap: 6px;
}
.diff-btn {
  flex: 1;
  background: var(--surface);
  border: 2px solid var(--card-border);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-family: inherit;
  font-weight: 700;
  font-size: 0.8rem;
  padding: 10px 4px;
  cursor: pointer;
  transition: all 0.2s;
}
.diff-btn:active { transform: scale(0.96); }
.diff-btn.active {
  border-color: var(--gold);
  color: var(--gold);
  background: rgba(240, 184, 50, 0.1);
  box-shadow: 0 0 12px rgba(240, 184, 50, 0.15);
}
.difficulty-desc {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 8px;
  min-height: 1.2em;
}

.title-buttons {
  display: flex; flex-direction: column;
  gap: 10px; width: 100%; max-width: 280px;
}
.title-credit {
  font-size: 0.8rem; color: var(--text-dim);
  text-align: center;
}

/* ===== 遊びかた画面 ===== */
.howto-body {
  flex: 1; overflow-y: auto;
  padding: 16px;
  display: flex; flex-direction: column; gap: 16px;
  padding-bottom: 32px;
}
.howto-section {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 16px;
}
.howto-section h3 {
  font-size: 1rem; margin-bottom: 8px;
  color: var(--gold);
}
.howto-section p {
  font-size: 0.85rem; line-height: 1.6;
  color: var(--text);
  margin-bottom: 4px;
}
.howto-section strong { color: var(--accent2); }

.howto-flow {
  display: flex; flex-direction: column;
  align-items: center; gap: 4px;
  margin-top: 8px;
}
.flow-step {
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 700;
  width: 100%;
  text-align: center;
}
.flow-arrow {
  color: var(--gold);
  font-size: 0.8rem;
}

/* ===== デイスタート画面 ===== */
.daystart-container {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 20px; padding: 32px 24px;
  background: radial-gradient(ellipse at 50% 60%, #2d1020 0%, var(--bg) 70%);
}
.daystart-day {
  font-size: 1.4rem; font-weight: 900;
  color: var(--accent2);
}
.daystart-day span { font-size: 3rem; color: var(--gold); }
.daystart-demon {
  font-size: 5rem;
  animation: shake 0.5s ease-in-out infinite alternate;
}
@keyframes shake {
  0% { transform: rotate(-3deg); }
  100% { transform: rotate(3deg); }
}
.daystart-speech {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 16px 20px;
  text-align: center;
  max-width: 320px;
  position: relative;
}
.daystart-speech::before {
  content: '▲'; position: absolute; top: -14px; left: 50%;
  transform: translateX(-50%);
  color: var(--card); font-size: 1.2rem;
}
.speech-name {
  font-size: 0.8rem; color: var(--danger);
  font-weight: 700; margin-bottom: 6px;
}
.speech-text { font-size: 0.95rem; line-height: 1.5; }

.quota-label { font-size: 0.9rem; color: var(--text-dim); }
.quota-amount {
  font-size: 2.8rem; font-weight: 900;
  color: var(--gold);
  text-shadow: 0 0 20px rgba(240,184,50,0.4);
}

.penalty-info {
  background: rgba(231,76,60,0.15);
  border: 1px solid var(--danger);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-size: 0.85rem; color: #f88;
  text-align: center;
}

/* ===== メイン画面 ===== */
.main-header {
  background: var(--card);
  border-bottom: 1px solid var(--card-border);
  padding: 12px 16px 8px;
  flex-shrink: 0;
}
.header-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.header-day, .header-time {
  font-weight: 700; font-size: 0.95rem;
}
.header-actions {
  display: flex; gap: 8px;
}
.time-bar-container {
  width: 100%; height: 6px;
  background: var(--surface);
  border-radius: 3px; overflow: hidden;
}
.time-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 3px;
  transition: width 0.5s ease;
}

.main-body {
  flex: 1; overflow-y: auto;
  padding: 16px;
  display: flex; flex-direction: column; gap: 14px;
  padding-bottom: 24px;
}

/* 残金カード */
.money-card {
  background: linear-gradient(135deg, #1a1030, #0f1828);
  border: 1px solid var(--gold-dim);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
}
.money-label { font-size: 0.85rem; color: var(--text-dim); margin-bottom: 4px; }
.money-value {
  font-size: 2.4rem; font-weight: 900;
  color: var(--gold);
  transition: all 0.3s;
}
.money-value.zero { color: var(--success); }
.money-progress-bg {
  width: 100%; height: 8px;
  background: var(--surface);
  border-radius: 4px; margin: 10px 0 6px;
  overflow: hidden;
}
.money-progress {
  height: 100%;
  background: linear-gradient(90deg, var(--success), var(--warning), var(--danger));
  border-radius: 4px;
  transition: width 0.5s ease;
}
.money-sub { font-size: 0.8rem; color: var(--text-dim); }

/* パラメーター */
.params-row {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}
.param-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 10px 6px;
  display: flex; flex-direction: column;
  align-items: center; gap: 2px;
}
.param-icon { font-size: 1.3rem; }
.param-name { font-size: 0.7rem; color: var(--text-dim); }
.param-val { font-size: 1.3rem; font-weight: 900; color: var(--accent2); }

/* 睡眠情報 */
.sleep-info {
  font-size: 0.85rem; color: var(--text-dim);
  text-align: center;
  padding: 6px;
  background: var(--card);
  border-radius: var(--radius-sm);
}

/* アクションリスト */
.action-list {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.action-btn {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 14px 10px;
  display: flex; flex-direction: column;
  align-items: center; gap: 4px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  color: var(--text);
}
.action-btn:active {
  transform: scale(0.95);
  border-color: var(--accent);
}
.action-btn.disabled {
  opacity: 0.35;
  pointer-events: none;
}
.action-btn .action-icon { font-size: 1.8rem; }
.action-btn .action-name { font-size: 0.9rem; font-weight: 700; }
.action-btn .action-desc { font-size: 0.65rem; color: var(--text-dim); }
.action-btn .action-time { font-size: 0.7rem; color: var(--accent2); }

/* ===== モーダル ===== */
.modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  padding: 24px;
}
.modal-content {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 24px;
  width: 100%; max-width: 340px;
  text-align: center;
}
.modal-content h3 { font-size: 1.3rem; margin-bottom: 8px; }
.modal-buttons {
  display: flex; gap: 10px; margin-top: 16px;
}
.modal-buttons .btn { flex: 1; }

.slider-container { margin: 16px 0; }
.slider-container input[type="range"] {
  width: 100%; accent-color: var(--gold);
}
.slider-container p {
  margin-top: 8px; font-size: 1.1rem;
  font-weight: 700; color: var(--gold);
}

/* ===== ショップ画面 ===== */
.sub-header {
  background: var(--card);
  border-bottom: 1px solid var(--card-border);
  padding: 12px 16px;
  display: flex; align-items: center; gap: 12px;
  flex-shrink: 0;
}
.sub-header h2 { font-size: 1.1rem; }

.shop-list, .item-list, .collection-list {
  flex: 1; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 10px;
}

.shop-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex; align-items: center; gap: 14px;
  cursor: pointer;
  transition: all 0.2s;
}
.shop-card:active {
  border-color: var(--gold);
  transform: scale(0.98);
}
.shop-card.locked {
  opacity: 0.3; pointer-events: none;
}
.shop-card .shop-icon { font-size: 2rem; }
.shop-card .shop-info { flex: 1; }
.shop-card .shop-name { font-weight: 700; font-size: 1rem; }
.shop-card .shop-desc { font-size: 0.75rem; color: var(--text-dim); margin-top: 2px; }
.shop-card .shop-lock { font-size: 0.7rem; color: var(--danger); }
.shop-card .shop-arrow { color: var(--text-dim); }

.shop-money-bar {
  background: var(--surface);
  padding: 10px 16px;
  font-weight: 700; font-size: 0.95rem;
  color: var(--gold);
  text-align: center;
  flex-shrink: 0;
}

.item-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex; align-items: center; gap: 12px;
}
.item-card.purchased {
  border-color: var(--success);
  background: rgba(0,184,148,0.08);
}
.item-card.sold-out { opacity: 0.3; }
.item-icon { font-size: 1.8rem; }
.item-info { flex: 1; }
.item-name { font-weight: 700; font-size: 0.95rem; }
.item-price { font-size: 0.8rem; color: var(--gold); }
.item-tag {
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--surface);
  color: var(--text-dim);
  margin-top: 3px;
  display: inline-block;
}
.item-buy-btn {
  background: linear-gradient(135deg, var(--gold), #e8a020);
  color: #1a1000;
  border: none; border-radius: var(--radius-sm);
  padding: 8px 16px;
  font-weight: 700; font-size: 0.85rem;
  cursor: pointer; font-family: inherit;
  transition: all 0.2s;
  white-space: nowrap;
}
.item-buy-btn:active { transform: scale(0.95); }
.item-buy-btn:disabled {
  background: var(--surface);
  color: var(--text-dim);
  cursor: default;
}

.shop-footer {
  padding: 12px 16px;
  flex-shrink: 0;
  background: var(--card);
  border-top: 1px solid var(--card-border);
}

/* ===== イベントモーダル ===== */
.event-modal { text-align: center; }
.event-icon { font-size: 3.5rem; margin-bottom: 8px; }

/* ===== 1日終了画面 ===== */
.dayend-container {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 20px; padding: 32px 24px;
}
.dayend-icon { font-size: 4rem; }
.dayend-summary {
  width: 100%; max-width: 300px;
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px; overflow: hidden;
}
.summary-row {
  display: flex; justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--card-border);
  font-size: 0.95rem;
}
.summary-row:last-child { border-bottom: none; }
.summary-row.highlight {
  font-weight: 900; font-size: 1.1rem; color: var(--gold);
}
.summary-row.success { color: var(--success); }
.dayend-message {
  font-size: 0.9rem; color: var(--text-dim);
  text-align: center; max-width: 300px;
}

/* ===== ペナルティ画面 ===== */
.penalty-container {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 20px; padding: 32px 24px;
  background: radial-gradient(ellipse at 50% 40%, #3d0a0a 0%, var(--bg) 70%);
}
.penalty-demon {
  font-size: 6rem;
  animation: shake 0.3s ease-in-out infinite alternate;
}
.penalty-text {
  font-size: 1rem; line-height: 1.6;
  text-align: center;
  background: var(--card);
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  padding: 16px 20px;
  max-width: 320px;
  color: #f88;
}

/* ===== ゲームオーバー画面 ===== */
.gameover-container {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 20px; padding: 32px 24px;
}
.gameover-icon { font-size: 5rem; }
.gameover-stats {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px 24px;
  text-align: center;
}

/* ===== 図鑑画面 ===== */
.collection-list {
  display: grid !important;
  grid-template-columns: 1fr 1fr;
  gap: 10px; padding: 16px;
  align-content: start;
}
.collection-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 12px 8px;
  text-align: center;
}
.collection-card.unlocked {
  border-color: var(--gold-dim);
}
.collection-card.locked {
  opacity: 0.3;
}
.collection-icon { font-size: 1.8rem; }
.collection-name { font-size: 0.75rem; font-weight: 700; margin-top: 4px; }
.collection-price { font-size: 0.65rem; color: var(--gold); }

/* ===== トースト通知 ===== */
.toast {
  position: fixed;
  bottom: 80px; left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--card-border);
  color: var(--text);
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 700;
  z-index: 200;
  animation: toastIn 0.3s ease;
  white-space: nowrap;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ===== パラメータ変動アニメーション ===== */
.param-flash {
  animation: paramFlash 0.6s ease;
}
@keyframes paramFlash {
  0%, 100% { color: var(--accent2); }
  50% { color: var(--gold); transform: scale(1.2); }
}

/* ===== スクロールバー ===== */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-thumb {
  background: var(--card-border); border-radius: 4px;
}
