:root {
  --bg: #12121f;
  --card: #1e1e32;
  --card-2: #27273f;
  --text: #eaeaf2;
  --muted: #9a9ab0;
  --accent: #ff8008;
  --accent-2: #ffc837;
  --danger: #e74c3c;
  --radius: 14px;
}

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

.hidden { display: none !important; }
button:disabled { opacity: 0.5; cursor: not-allowed; }

body {
  font-family: "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding-bottom: 96px; /* 常時バナー広告の高さぶん確保 */
}

/* 常時表示バナー広告（Web=AdSense。AdMobはアプリ専用） */
.ad-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8px 12px;
  font-size: 0.72rem;
  color: var(--muted);
  background: var(--card);
  border-top: 1px dashed #3a3a55;
  z-index: 50;
}

.app-header {
  text-align: center;
  padding: 22px 16px 12px;
  background: linear-gradient(160deg, #2b1055 0%, #4a1a6b 45%, var(--bg) 100%);
  background-size: 200% 200%;
  animation: header-glow 14s ease-in-out infinite alternate;
  position: relative;
}
@keyframes header-glow {
  from { background-position: 0% 0%; }
  to { background-position: 100% 100%; }
}
.app-header h1 { text-shadow: 0 2px 14px rgba(255, 128, 8, 0.35); }
.lang-select {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.12);
  color: var(--text);
  font-size: 0.75rem;
  font-weight: bold;
  cursor: pointer;
  width: auto;
  appearance: none;
  -webkit-appearance: none;
}
.lang-select:hover { background: rgba(255, 255, 255, 0.22); }
.lang-select option { background: var(--card); color: var(--text); }

.share-btn { width: 100%; margin-top: 12px; }
.app-header h1 { font-size: 1.5rem; letter-spacing: 0.04em; }
.tagline { color: var(--muted); font-size: 0.85rem; margin-top: 4px; }

.coin-bar {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.coin-bar span {
  background: var(--card-2);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 0.8rem;
  font-weight: bold;
}
.coin-balance { color: var(--accent-2); }

.tabs {
  display: flex;
  gap: 4px;
  padding: 10px 12px;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}
.tab {
  flex: 1;
  padding: 10px 4px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--card);
  color: var(--muted);
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, transform 0.12s;
}
.tab:hover { color: var(--text); transform: translateY(-1px); }
.tab.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #1a1a1a;
  font-weight: bold;
  box-shadow: 0 4px 16px rgba(255, 128, 8, 0.35);
}

main { max-width: 640px; margin: 0 auto; padding: 8px 14px; }

.tab-panel { display: none; }
.tab-panel.active { display: block; animation: panel-in 0.28s ease; }
@keyframes panel-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.card {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius);
  padding: 18px;
  margin: 14px 0;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.22);
}
.card h2 { font-size: 1.05rem; margin-bottom: 12px; color: var(--accent-2); }

/* 次のアラームまでのカウントダウン */
.next-alarm {
  margin: 14px 0;
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 200, 55, 0.35);
  background: linear-gradient(135deg, rgba(255, 128, 8, 0.14), rgba(255, 200, 55, 0.08));
  color: var(--accent-2);
  font-weight: bold;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* 名言カテゴリフィルタ */
.quote-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 4px;
}
.cat-chip {
  padding: 7px 14px;
  border: 1px solid #3a3a55;
  border-radius: 20px;
  background: var(--card);
  color: var(--muted);
  font-size: 0.78rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.cat-chip:hover { color: var(--text); }
.cat-chip.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  color: #1a1a1a;
  font-weight: bold;
}

.wake-stats { color: var(--accent-2); font-weight: bold; }

.hero-img-wrap { margin-top: 12px; border-radius: var(--radius); overflow: hidden; }
.hero-img-wrap img { width: 100%; display: block; }

.alarm-form { display: flex; flex-direction: column; gap: 12px; }
input[type="time"] {
  font-size: 2rem;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid #3a3a55;
  background: var(--card-2);
  color: var(--text);
  width: 100%;
}
select, input[type="file"] {
  padding: 10px;
  border-radius: 10px;
  border: 1px solid #3a3a55;
  background: var(--card-2);
  color: var(--text);
  width: 100%;
  font-size: 0.95rem;
}
.row { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; color: var(--muted); }

button { font-family: inherit; }
.btn-primary {
  padding: 14px;
  font-size: 1.05rem;
  font-weight: bold;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #1a1a1a;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(255, 128, 8, 0.3);
  transition: transform 0.12s, box-shadow 0.2s, filter 0.2s;
}
.btn-primary:hover { filter: brightness(1.08); box-shadow: 0 6px 20px rgba(255, 128, 8, 0.45); }
.btn-primary:active { transform: scale(0.97); }
.btn-secondary {
  padding: 10px 16px;
  border: 1px solid #3a3a55;
  border-radius: 10px;
  background: var(--card-2);
  color: var(--text);
  cursor: pointer;
  transition: background 0.2s, transform 0.12s;
}
.btn-secondary:hover { background: #32324e; }
.btn-secondary:active { transform: scale(0.97); }
.btn-danger {
  padding: 14px 22px;
  font-size: 1.1rem;
  font-weight: bold;
  border: none;
  border-radius: 12px;
  background: var(--danger);
  color: #fff;
  cursor: pointer;
}

.alarm-list { list-style: none; }
.alarm-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid #2e2e4a;
}
.alarm-list .time { font-size: 1.5rem; font-weight: bold; }
.alarm-list .meta { font-size: 0.75rem; color: var(--muted); }
.alarm-list .del {
  background: none;
  border: none;
  color: var(--danger);
  font-size: 1.1rem;
  cursor: pointer;
}
.alarm-list .toggle { cursor: pointer; }

.note { font-size: 0.78rem; color: var(--muted); line-height: 1.6; margin-top: 10px; }

.ad-placeholder {
  border: 2px dashed #3a3a55;
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
  padding: 26px;
}

.quote-featured {
  background: linear-gradient(135deg, #2b1055, #4a1a6b);
  text-align: center;
  position: relative;
  overflow: hidden;
}
.quote-featured::before {
  content: "\201C";
  position: absolute;
  top: -18px;
  left: 8px;
  font-size: 6rem;
  font-family: Georgia, serif;
  color: rgba(255, 200, 55, 0.18);
  pointer-events: none;
}
.quote-featured p:first-child { font-size: 1.1rem; line-height: 1.9; position: relative; }
.quote-author { color: var(--accent-2); font-size: 0.85rem; margin: 10px 0 14px; }

.quote-item {
  background: var(--card);
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  padding: 14px 16px;
  margin: 10px 0;
  transition: transform 0.15s, box-shadow 0.2s;
}
.quote-item:hover {
  transform: translateX(3px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}
.quote-item p { line-height: 1.8; font-size: 0.95rem; }
.quote-item .quote-author { margin: 6px 0 0; }

.tip-item {
  display: flex;
  gap: 12px;
  background: var(--card);
  border-radius: 10px;
  padding: 14px 16px;
  margin: 10px 0;
}
.tip-item .icon { font-size: 1.6rem; }
.tip-item h3 { font-size: 0.95rem; margin-bottom: 4px; color: var(--accent-2); }
.tip-item p { font-size: 0.85rem; color: var(--muted); line-height: 1.7; }

.sound-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid #2e2e4a;
  font-size: 0.9rem;
}
.sound-item:last-child { border-bottom: none; }

.ring-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(180deg, #2b1055 0%, #b83b5e 55%, #e96443 100%);
  background-size: 100% 220%;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 24px;
  text-align: center;
  animation: sunrise-bg 6s ease-in-out infinite alternate, pulse-bg 1s infinite alternate;
}
@keyframes pulse-bg { from { filter: brightness(1); } to { filter: brightness(1.18); } }
@keyframes sunrise-bg { from { background-position: 0% 100%; } to { background-position: 0% 0%; } }
.ring-overlay.hidden { display: none; }
.ring-overlay img {
  width: min(80vw, 380px);
  border-radius: var(--radius);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
  animation: ring-float 3s ease-in-out infinite alternate;
}
@keyframes ring-float { from { transform: translateY(0); } to { transform: translateY(-10px); } }
.ring-overlay h2 { font-size: 2rem; text-shadow: 0 2px 12px rgba(0,0,0,0.5); animation: ring-shake 0.8s ease-in-out infinite; }
@keyframes ring-shake {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-2deg); }
  75% { transform: rotate(2deg); }
}
.ring-overlay p { max-width: 480px; line-height: 1.8; }
.ring-buttons { display: flex; gap: 14px; margin-top: 8px; }
.ring-buttons .btn-danger { animation: stop-pulse 1.2s ease-in-out infinite; }
@keyframes stop-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.55); }
  50% { transform: scale(1.06); box-shadow: 0 0 0 14px rgba(231, 76, 60, 0); }
}

.locked-hint { text-align: center; color: var(--muted); }

.shop-balance-card { text-align: center; }
.big-coins { font-size: 2.2rem; font-weight: bold; color: var(--accent-2); margin: 6px 0; }

.gacha-result { margin-top: 10px; font-size: 0.95rem; min-height: 1.4em; }

.badges-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 12px;
}
.badge-item {
  background: var(--card-2);
  border-radius: 10px;
  padding: 12px 8px;
  text-align: center;
  transition: opacity 0.2s;
}
.badge-item.locked { opacity: 0.4; }
.badge-icon { font-size: 1.6rem; }
.badge-name { font-size: 0.72rem; font-weight: bold; margin-top: 4px; }
.badge-desc { font-size: 0.62rem; color: var(--muted); margin-top: 2px; line-height: 1.4; }

.ring-timer { font-size: 1.1rem; font-weight: bold; color: var(--accent-2); }

.coin-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(20px);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #1a1a1a;
  font-weight: bold;
  padding: 12px 20px;
  border-radius: 30px;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 200;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}
.coin-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== テーマ着せ替え ===== */
:root[data-theme="sunrise"] {
  --bg: #2b1420; --card: #3d1f2e; --card-2: #4a2637;
  --accent: #ff6b35; --accent-2: #ffd23f;
}
:root[data-theme="sakura"] {
  --bg: #1f1420; --card: #2e1f33; --card-2: #3a2740;
  --accent: #ff8fab; --accent-2: #ffc2d1;
}
:root[data-theme="forest"] {
  --bg: #0f1f16; --card: #16291d; --card-2: #1d3324;
  --accent: #4caf50; --accent-2: #8bc34a;
}
:root[data-theme="ocean"] {
  --bg: #0b1a2b; --card: #123049; --card-2: #173c5c;
  --accent: #00b4d8; --accent-2: #90e0ef;
}
:root[data-theme="gold"] {
  --bg: #1a1508; --card: #2b2410; --card-2: #3a3016;
  --accent: #ffd700; --accent-2: #ffec8b;
}

.app-footer { text-align: center; color: var(--muted); font-size: 0.72rem; padding: 24px 12px 8px; }
.footer-link { color: var(--muted); text-decoration: underline; }
