/* -----------------------------------
   THEME VARIABLES
----------------------------------- */
:root {
  --bg: #f3f4f6;
  --card-bg: #ffffff;
  --text: #1f2937;
  --subtle-text: #374151;
  --input-bg: #f9fafb;
  --input-border: #d1d5db;
  --primary: #7bbfa3;
  --primary-hover: #6ab596;
  --shadow: rgba(0, 0, 0, 0.06);
}

/* DARK MODE THEME */
.dark {
  --bg: #0f1115;
  --card-bg: #1a1d21;
  --text: #e5e7eb;
  --subtle-text: #9ca3af;
  --input-bg: #111317;
  --input-border: #2d3238;
  --primary: #7bbfa3;
  --primary-hover: #8fd0b5;
  --shadow: rgba(0, 0, 0, 0.4);
}

/* -----------------------------------
   BASE LAYOUT
----------------------------------- */
body {
  font-family: system-ui, sans-serif;
  background: var(--bg);
  padding: 20px;
  display: flex;
  justify-content: center;
}

.app {
  max-width: 420px;
  width: 100%;
}

.card {
  background: var(--card-bg);
  padding: 24px;
  border-radius: 14px;
  box-shadow: 0 4px 18px var(--shadow);
  text-align: center;
}

/* -----------------------------------
   STREAK DISPLAY
----------------------------------- */
.streak-display {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--subtle-text);
  margin-bottom: 10px;
  opacity: 0.85;
}

/* -----------------------------------
   CODE DISPLAY
----------------------------------- */
.code-display {
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 18px;
  min-height: 32px;
  transition: opacity 0.25s ease;
  color: var(--text);
}

.fade-in {
  opacity: 1;
}

.fade-out {
  opacity: 0;
}

/* -----------------------------------
   INPUT FIELD
----------------------------------- */
.input {
  display: block;
  margin: 0 auto;
  width: 80%;
  padding: 12px;
  font-size: 1.1rem;
  border: 2px solid var(--input-border);
  border-radius: 10px;
  outline: none;
  background: var(--input-bg);
  color: var(--text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  text-align: center;
  letter-spacing: 2px;
  margin-bottom: 10px;
}

.input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 6px rgba(123, 191, 163, 0.5);
}

/* -----------------------------------
   DIFFICULTY SELECTOR
----------------------------------- */
.difficulty {
  margin-top: 10px;
  margin-bottom: 6px;
}

.difficulty label {
  display: block;
  text-align: center;
  margin-bottom: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--subtle-text);
}

.difficulty select {
  display: block;
  margin: 0 auto;
  width: 80%;
  padding: 12px;
  font-size: 1.1rem;
  border: 2px solid var(--input-border);
  border-radius: 10px;
  outline: none;
  background: var(--input-bg);
  color: var(--text);
  appearance: none;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.difficulty select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 6px rgba(123, 191, 163, 0.5);
}

/* -----------------------------------
   BUTTONS
----------------------------------- */
.buttons {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 14px;
}

.btn {
  flex: none;
  width: 38%;
  padding: 12px;
  font-size: 1rem;
  border: none;
  border-radius: 10px;
  background: var(--primary);
  color: white;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.btn:disabled {
  background: #cbd5e1;
  cursor: not-allowed;
}

.btn:hover:not(:disabled) {
  background: var(--primary-hover);
}

/* -----------------------------------
   START BUTTON PREMIUM ANIMATION
----------------------------------- */
.start-ready {
  animation:
    breatheGlow 2.4s ease-in-out infinite,
    breatheScale 2.4s ease-in-out infinite,
    breatheColor 3s ease-in-out infinite;
}

/* Stronger celadon glow */
@keyframes breatheGlow {
  0%   { box-shadow: 0 0 0px rgba(123, 191, 163, 0.45); }
  50%  { box-shadow: 0 0 18px rgba(123, 191, 163, 0.9); }
  100% { box-shadow: 0 0 0px rgba(123, 191, 163, 0.45); }
}

/* Gentle scale pulse */
@keyframes breatheScale {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.03); }
  100% { transform: scale(1); }
}

/* Soft warm→celadon→warm color shift */
@keyframes breatheColor {
  0%   { background-color: var(--primary); }
  50%  { background-color: var(--primary-hover); }
  100% { background-color: var(--primary); }
}

/* -----------------------------------
   FEEDBACK MESSAGES
----------------------------------- */
.message {
  margin-top: 16px;
  min-height: 24px;
  font-size: 1rem;
  color: var(--text);
}

.success {
  color: #059669;
}

.error {
  color: #dc2626;
}

.success-anim {
  animation: successPulse 0.4s ease;
}

@keyframes successPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.06); }
  100% { transform: scale(1); }
}

.error-anim {
  animation: shake 0.35s ease;
}

@keyframes shake {
  0% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  50% { transform: translateX(4px); }
  75% { transform: translateX(-4px); }
  100% { transform: translateX(0); }
}

/* -----------------------------------
   THEME TOGGLE
----------------------------------- */
.theme-toggle {
  text-align: right;
  margin-bottom: 10px;
}

.toggle-label {
  font-size: 0.85rem;
  color: var(--subtle-text);
  cursor: pointer;
}

#theme-switch {
  margin-right: 6px;
  cursor: pointer;
}

/* -----------------------------------
   UPGRADE BUTTON
----------------------------------- */
.upgrade-container {
  text-align: right;
  margin-bottom: 10px;
}

.upgrade-btn {
  background: transparent;
  border: 2px solid var(--primary);
  color: var(--primary);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.upgrade-btn:hover {
  background: var(--primary);
  color: white;
}

/* -----------------------------------
   MODAL OVERLAY
----------------------------------- */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.55);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 999;
}

.hidden {
  display: none;
}

/* -----------------------------------
   MODAL CONTENT
----------------------------------- */
.modal-content {
  background: var(--card-bg);
  padding: 24px;
  border-radius: 14px;
  width: 90%;
  max-width: 360px;
  text-align: center;
  box-shadow: 0 4px 18px var(--shadow);
}

.modal-title {
  font-size: 1.4rem;
  margin-bottom: 16px;
  color: var(--text);
}

.premium-features {
  list-style: none;
  padding: 0;
  margin-bottom: 20px;
  color: var(--subtle-text);
}

.premium-features li {
  margin: 8px 0;
  font-size: 1rem;
}

/* -----------------------------------
   PURCHASE BUTTON
----------------------------------- */
.purchase-btn {
  background: var(--primary);
  color: white;
  padding: 12px;
  width: 100%;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  cursor: pointer;
  margin-bottom: 10px;
}

.purchase-btn:hover {
  background: var(--primary-hover);
}

/* -----------------------------------
   CLOSE BUTTON
----------------------------------- */
.close-btn {
  background: transparent;
  border: none;
  color: var(--subtle-text);
  font-size: 0.9rem;
  cursor: pointer;
  margin-top: 6px;
}

/* Locked difficulty options */
.locked-option {
  color: var(--subtle-text);
  opacity: 0.7;
}

.trials-left {
  margin-top: 4px;
  font-size: 0.85rem;
  color: var(--subtle-text);
  opacity: 0.85;
  min-height: 18px; /* keeps layout stable */
}

.watch-ad-btn {
  background: var(--primary);
  color: white;
  padding: 10px;
  width: 100%;
  border: none;
  border-radius: 10px;
  font-size: 0.95rem;
  cursor: pointer;
  margin-top: 10px;
  transition: background 0.2s ease;
}

.watch-ad-btn:hover {
  background: var(--primary-hover);
}

input[type="checkbox"].ghost-bump {
  transform: scale(1.06);
  transition: transform 0.18s ease;
}

/* Container */
.switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 24px;
}

/* Hide the default checkbox */
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

/* Slider track */
.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.3s;
  border-radius: 24px;
}

/* Slider knob */
.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
}

/* When checked */
input:checked + .slider {
  background-color: #4a90e2;
}

input:checked + .slider:before {
  transform: translateX(22px);
}

/* Ghost bump animation */
.ghost-bump + .slider:before {
  transform: scale(1.1);
}

/* Premium Modal Aesthetic */
.premium-box {
  background: #f8faf9;
  border-radius: 18px;
  padding: 28px;
  width: 90%;
  max-width: 380px;
  text-align: center;
  animation: fadeIn 0.25s ease-out;
}

.premium-title {
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: #2a3d34;
}

.premium-subtitle {
  font-size: 0.95rem;
  color: #5f726a;
  margin-bottom: 20px;
}

.premium-options {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.premium-option {
  background: #ffffff;
  border: 1px solid #dfe7e3;
  border-radius: 14px;
  padding: 14px 18px;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
}

.premium-option:hover {
  background: #eef5f2;
  transform: translateY(-2px);
}

.best-value {
  border: 1px solid #9cc7b5;
  background: #e8f4ef;
}

.option-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.option-title {
  font-size: 1rem;
  font-weight: 600;
  color: #2a3d34;
}

.option-price {
  font-size: 1rem;
  font-weight: 500;
  color: #3f5a50;
}

.option-note {
  font-size: 0.8rem;
  color: #6f837a;
  margin-top: 4px;
}

.close-btn {
  margin-top: 20px;
  background: none;
  border: none;
  color: #6f837a;
  font-size: 0.9rem;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.close-btn:hover {
  opacity: 0.6;
}

/* Fade animation */
@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

/* Streak + Daily Containers */
.streak-container {
  margin-top: 6px;
  font-size: 0.95rem;
  color: #c8d8d0;
  opacity: 0.85;
  text-align: center;
  transition: opacity 0.3s ease;
}

.streak-container.active {
  opacity: 1;
}

#streakValue {
  font-weight: 600;
  margin-left: 4px;
  color: #d9f2e3;
}

.streak-pulse {
  animation: streakPulse 1.2s ease-out;
}

@keyframes streakPulse {
  0%   { opacity: 0.4; transform: scale(0.96); }
  50%  { opacity: 1;   transform: scale(1.02); }
  100% { opacity: 0.85; transform: scale(1); }
}

