/* Mindfulness Bell — Zen Warm Minimalist Stylesheet */

:root {
  --bg: #f6f2ea;
  --bg-accent: radial-gradient(circle at 50% 0%, rgba(184, 138, 68, 0.11), transparent 58%);
  --surface: rgba(255, 253, 249, 0.84);
  --surface-solid: #fffdf9;
  --surface-muted: #eee8dc;
  --border: rgba(74, 58, 38, 0.12);
  --border-strong: rgba(156, 116, 59, 0.36);

  --text: #24201b;
  --text-secondary: #685f54;
  --text-muted: #8f8578;

  --accent: #9c743b;
  --accent-bright: #b88a44;
  --accent-soft: rgba(156, 116, 59, 0.12);
  --accent-contrast: #fffcf7;

  --sage: #5c7668;
  --sage-soft: rgba(92, 118, 104, 0.14);

  --shadow-sm: 0 2px 10px rgba(45, 34, 18, 0.05);
  --shadow-md: 0 12px 32px rgba(45, 34, 18, 0.08);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-pill: 999px;

  --font-sans: "Sarabun", "Noto Sans Thai", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-serif: "Noto Serif Thai", "Georgia", "Times New Roman", serif;
}

[data-theme="dark"] {
  --bg: #151412;
  --bg-accent: radial-gradient(circle at 50% 0%, rgba(207, 161, 91, 0.13), transparent 55%);
  --surface: rgba(31, 29, 25, 0.88);
  --surface-solid: #1f1d19;
  --surface-muted: #292620;
  --border: rgba(235, 223, 203, 0.10);
  --border-strong: rgba(207, 161, 91, 0.42);

  --text: #efeae0;
  --text-secondary: #aba294;
  --text-muted: #7d7569;

  --accent: #cfa15b;
  --accent-bright: #dfb675;
  --accent-soft: rgba(207, 161, 91, 0.15);
  --accent-contrast: #191611;

  --sage: #82a392;
  --sage-soft: rgba(130, 163, 146, 0.16);

  --shadow-sm: 0 2px 12px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 14px 36px rgba(0, 0, 0, 0.36);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  color-scheme: light dark;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  background-color: var(--bg);
  background-image: var(--bg-accent);
  color: var(--text);
  line-height: 1.55;
  transition: background-color 0.35s ease, color 0.35s ease;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Layout */
.app-shell {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 18px 44px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Header */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
}

.brand-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
}

.brand-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.brand-subtitle {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stat-pill {
  font-size: 0.8rem;
  color: var(--text-secondary);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 6px 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  backdrop-filter: blur(8px);
}

.stat-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--sage);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 500;
  transition: border-color 0.2s, background-color 0.2s, color 0.2s, transform 0.15s;
}

.icon-btn:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.icon-btn:active {
  transform: scale(0.96);
}

.icon-btn[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: var(--border-strong);
  color: var(--accent);
}

/* Main Bell Stage */
.bell-stage {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 24px 28px;
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  overflow: hidden;
}

.mode-badge {
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  font-weight: 500;
  margin-bottom: 18px;
}

/* Interactive Bowl & Ripples */
.bowl-wrapper {
  position: relative;
  width: 244px;
  height: 244px;
  display: grid;
  place-items: center;
  margin-bottom: 14px;
}

.progress-ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
  pointer-events: none;
}

.progress-ring-track {
  fill: none;
  stroke: var(--border);
  stroke-width: 3.5;
}

.progress-ring-fill {
  fill: none;
  stroke: var(--accent);
  stroke-width: 3.5;
  stroke-linecap: round;
}

.ripple-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: grid;
  place-items: center;
}

.ripple-ring {
  position: absolute;
  width: 148px;
  height: 148px;
  border-radius: 50%;
  border: 2px solid var(--accent-bright);
  opacity: 0;
  animation: bellRipple 3.6s cubic-bezier(0.16, 0.84, 0.44, 1) forwards;
}

.ripple-ring.soft {
  border-width: 1.5px;
  animation-duration: 2.5s;
}

@keyframes bellRipple {
  0% {
    transform: scale(0.85);
    opacity: 0.65;
  }
  100% {
    transform: scale(2.1);
    opacity: 0;
  }
}

.bowl-button {
  position: relative;
  z-index: 2;
  width: 176px;
  height: 176px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: radial-gradient(circle at 50% 35%, var(--surface-solid), var(--surface-muted));
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0;
  transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.25s, box-shadow 0.25s;
}

.bowl-button:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.bowl-button:active,
.bowl-button.is-striking {
  transform: scale(0.96);
}

.bowl-svg {
  width: 108px;
  height: 78px;
  transition: transform 0.3s ease;
}

.bowl-button.is-striking .bowl-svg {
  animation: bowlVibrate 0.55s ease;
}

@keyframes bowlVibrate {
  0% { transform: scale(1); }
  20% { transform: scale(1.045) rotate(-0.8deg); }
  45% { transform: scale(0.99) rotate(0.8deg); }
  70% { transform: scale(1.015) rotate(-0.4deg); }
  100% { transform: scale(1) rotate(0); }
}

.bowl-hint {
  font-size: 0.74rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

/* Timer Readout */
.timer-display {
  font-family: var(--font-serif);
  font-size: clamp(2.5rem, 8vw, 3.4rem);
  font-weight: 500;
  letter-spacing: 0.04em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  margin: 2px 0 4px;
}

.timer-meta {
  min-height: 22px;
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin: 0 0 20px;
}

/* Primary Controls */
.primary-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 22px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  font-size: 0.94rem;
  font-weight: 500;
  transition: background-color 0.2s, border-color 0.2s, transform 0.15s, opacity 0.2s;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-contrast);
  min-width: 148px;
  box-shadow: 0 6px 18px rgba(156, 116, 59, 0.24);
}

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

.btn-secondary {
  background: var(--surface-muted);
  border-color: var(--border);
  color: var(--text);
}

.btn-secondary:hover {
  border-color: var(--border-strong);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-secondary);
}

.btn-ghost:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

/* Mindful Breathing Banner */
.mindful-moment {
  width: 100%;
  margin-top: 22px;
  padding: 16px 18px;
  border-radius: var(--radius-md);
  background: var(--sage-soft);
  border: 1px solid rgba(92, 118, 104, 0.24);
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.mindful-moment[hidden] {
  display: none;
}

.breath-orb {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, var(--sage), rgba(92, 118, 104, 0.45));
  opacity: 0.82;
  transition: transform 4s ease-in-out;
}

.breath-orb.inhale {
  transform: scale(1.22);
}

.breath-orb.exhale {
  transform: scale(0.76);
}

.mindful-copy {
  flex: 1;
  min-width: 0;
}

.breath-phase {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--sage);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.mindful-quote {
  margin: 2px 0 0;
  font-size: 0.96rem;
  color: var(--text);
}

.dismiss-moment {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.15rem;
  padding: 4px 8px;
  border-radius: 8px;
}

.dismiss-moment:hover {
  color: var(--text);
  background: rgba(0, 0, 0, 0.05);
}

/* Settings Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(10px);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.card-title {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 600;
}

/* Mode Segmented Control */
.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  background: var(--surface-muted);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  margin-bottom: 18px;
}

.seg-btn {
  border: none;
  background: transparent;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: background-color 0.2s, color 0.2s, box-shadow 0.2s;
}

.seg-btn.is-active {
  background: var(--surface-solid);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

/* Field Rows & Chips */
.field-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.field-group:last-child {
  margin-bottom: 0;
}

.field-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  height: 36px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface-solid);
  color: var(--text-secondary);
  font-size: 0.86rem;
  font-weight: 500;
  transition: border-color 0.2s, background-color 0.2s, color 0.2s;
}

.chip:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.chip.is-selected {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.inline-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.num-input,
.text-input,
.select-input {
  height: 38px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-solid);
  color: var(--text);
  font-size: 0.9rem;
}

.num-input {
  width: 88px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.text-input {
  width: 100%;
}

.select-input {
  min-width: 150px;
}

/* Sound Cards */
.sound-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.sound-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  padding: 12px 13px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface-solid);
  text-align: left;
  transition: border-color 0.2s, background-color 0.2s, transform 0.15s;
}

.sound-card:hover {
  border-color: var(--border-strong);
}

.sound-card:active {
  transform: scale(0.98);
}

.sound-card.is-selected {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.sound-card-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.sound-card-desc {
  font-size: 0.76rem;
  color: var(--text-muted);
  line-height: 1.35;
}

/* Volume Slider */
.volume-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.range-input {
  flex: 1;
  accent-color: var(--accent);
  height: 6px;
  cursor: pointer;
}

.volume-value {
  min-width: 40px;
  text-align: right;
  font-size: 0.84rem;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

/* Toggle Switch Rows */
.toggle-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.toggle-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.toggle-title {
  font-size: 0.89rem;
  font-weight: 500;
}

.toggle-desc {
  font-size: 0.77rem;
  color: var(--text-muted);
}

.switch {
  position: relative;
  width: 44px;
  height: 26px;
  flex-shrink: 0;
}

.switch input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 1;
}

.switch-track {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-pill);
  background: var(--surface-muted);
  border: 1px solid var(--border);
  transition: background-color 0.2s, border-color 0.2s;
  cursor: pointer;
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--surface-solid);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.switch input:checked + .switch-track {
  background: var(--accent);
  border-color: var(--accent);
}

.switch input:checked + .switch-track::after {
  transform: translateX(18px);
}

.switch input:focus-visible + .switch-track {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Footer */
.app-footer {
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
  padding-top: 4px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.shortcuts {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 14px;
}

kbd {
  display: inline-block;
  padding: 1px 6px;
  font-size: 0.72rem;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--surface-solid);
  color: var(--text-secondary);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: var(--text);
  color: var(--bg);
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 40;
  box-shadow: var(--shadow-md);
}

.toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Responsive */
@media (max-width: 560px) {
  .app-shell {
    padding: 14px 14px 36px;
  }

  .bell-stage {
    padding: 24px 16px 22px;
  }

  .bowl-wrapper {
    width: 214px;
    height: 214px;
  }

  .bowl-button {
    width: 154px;
    height: 154px;
  }

  .bowl-svg {
    width: 92px;
    height: 68px;
  }

  .sound-grid {
    grid-template-columns: 1fr;
  }

  .top-actions {
    width: 100%;
    justify-content: flex-end;
    flex-wrap: wrap;
  }

  .stat-pill {
    margin-right: auto;
    font-size: 0.76rem;
    padding: 5px 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ripple-ring,
  .bowl-button.is-striking .bowl-svg {
    animation: none;
  }

  .breath-orb {
    transition: none;
  }
}
