:root {
  --primary: #FFC107;
  --primary-hover: #ffb300;
  --yellow: #FFC107;
  --bg-dark: #1a1a2e;
  --bg-light: #ffffff;
  --text-light: #ffffff;
  --text-dark: #1a1a1a;
  --surface: #353550;
  --surface-hover: #3d3d5a;
  --border: #404050;
  --overlay: #000000;
  --accent: #6B0050;

  --surface-dim: #5A0044;
  --border-dim: #1C1C30;
  --text-dim: #ffffff;
  --text-muted: #ffffff;
}

body.light-theme {
  --bg-dark: #ffffff;
  --text-light: #1a1a1a;
  --surface: #f5f0f9;
  --surface-hover: #e5d9f0;
  --border: #dcd0e0;
  --surface-dim: #fcfbfd;
  --border-dim: #f5f1f6;
  --text-dim: #666666;
  --text-muted: #666666;
}

body {
  background: var(--accent);
  color: var(--text-light);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

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

html, body {
  height: 100%;
  width: 100%;
}

body {
  font-size: 16px;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

.main-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body.light-theme .main-container {
  background: var(--bg-light);
}

.tabs-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-top: 1px solid var(--border-dim);
  background: var(--surface-dim);
  gap: 8px;
  flex-shrink: 0;
  position: relative;
  z-index: 100;
}

.main-tabs {
  display: flex;
  gap: 8px;
}

.main-tab {
  padding: 8px 14px;
  border-radius: 8px;
  border: 1.5px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.main-tab:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.main-tab.active {
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 700;
}

.right-tabs {
  display: flex;
  gap: 8px;
  align-items: center;
}

.settings-btn {
  padding: 8px;
  background: transparent;
  border: 1.5px solid transparent;
  color: var(--text-light);
  font-size: 20px;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s;
  font-family: inherit;
}

.settings-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.subtabs-container {
  display: flex;
  flex-direction: column;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-dim);
  background: var(--surface-dim);
  gap: 8px;
  flex-shrink: 0;
}

.subtabs-row {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border-dim);
}

.subtab {
  flex: 1;
  padding: 12px 8px;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 11px;
  text-align: center;
  cursor: pointer;
  border: none;
  font-family: inherit;
  transition: all 0.2s;
}

.subtab:hover {
  color: var(--primary);
}

.subtab.active {
  border-bottom-color: var(--primary);
  color: var(--primary);
  font-weight: 700;
  font-size: 22px;
}

.content-area {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px 24px 16px;
  background: transparent;
}

.content-area::-webkit-scrollbar {
  width: 6px;
}

.content-area::-webkit-scrollbar-track {
  background: var(--surface-dim);
}

.content-area::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.content-area::-webkit-scrollbar-thumb:hover {
  background: var(--border);
}

body.light-theme .content-area {
  background: var(--bg-light);
}

.page {
  display: none;
  width: 100%;
}

.page.active {
  display: block;
  width: 100%;
}

.section {
  margin-bottom: 0;
}

.section-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text-light);
}

.card {
  background: var(--surface-dim);
  border: 1px solid var(--border-dim);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 10px;
  transition: all 0.2s;
}

.card:last-child {
  margin-bottom: 0;
}

.card:hover {
  background: var(--surface-dim);
  border-color: var(--border-dim);
}

.card-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text-light);
}

.card-text {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 4px;
}

.card-text:last-of-type {
  margin-bottom: 0;
}

.input-group {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.input-group:last-of-type {
  margin-bottom: 12px;
}

.input-field {
  flex: 1;
  padding: 11px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-dim);
  background: var(--surface-dim);
  color: var(--text-light);
  font-size: 14px;
  font-family: inherit;
  transition: all 0.2s;
}

.input-field:focus {
  outline: none;
  background: var(--surface-dim);
  border-color: var(--primary);
}

.input-field::placeholder {
  color: var(--text-dim);
}

body.light-theme .input-field {
  background: var(--surface-dim);
  border-color: var(--border-dim);
  color: var(--text-dark);
}

body.light-theme .input-field:focus {
  background: var(--surface-dim);
  border-color: var(--primary);
}

.btn {
  padding: 11px 16px;
  border-radius: 8px;
  border: none;
  background: var(--primary);
  color: var(--text-dark);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

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

.btn:active {
  opacity: 0.85;
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal.hidden {
  display: none;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--overlay);
  opacity: 0.6;
}

.modal-content {
  position: relative;
  background: var(--surface);
  border-radius: 16px;
  padding: 24px;
  width: 90%;
  max-width: 340px;
  border: 1px solid var(--border-dim);
}

body.light-theme .modal-content {
  background: var(--bg-light);
  border: 1px solid var(--border-dim);
}

.modal-panel {
  display: block;
}

.theme-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.theme-option {
  padding: 14px 16px;
  border-radius: 12px;
  border: 1.5px solid var(--border-dim);
  background: var(--surface-dim);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.theme-option:hover {
  background: var(--surface-dim);
  border-color: var(--border-dim);
}

.theme-option.active {
  border-color: var(--primary);
  background: var(--surface-dim);
}

.theme-name {
  color: var(--text-light);
  font-weight: 600;
  font-size: 14px;
}

.checkmark {
  color: var(--primary);
  font-size: 18px;
}

.accordion-item {
  margin-bottom: 8px;
}

.accordion-header {
  padding: 12px;
  background: var(--surface-dim);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-light);
  font-weight: 600;
  border: 1px solid var(--border-dim);
  width: 100%;
  font-family: inherit;
  transition: all 0.2s;
}

.accordion-header:hover {
  background: var(--surface-dim);
  border-color: var(--border-dim);
}

.accordion-content {
  display: none;
  padding: 12px;
  background: var(--surface-dim);
  border-radius: 0 0 8px 8px;
  border: 1px solid var(--border-dim);
  border-top: none;
}

.accordion-item.expanded .accordion-header {
  border-radius: 8px 8px 0 0;
  border-bottom: none;
}

.accordion-item.expanded .accordion-content {
  display: block;
}

.gratitude-chip {
  padding: 14px 8px;
  border-radius: 10px;
  border: 1px solid var(--border-dim);
  background: var(--surface-dim);
  color: var(--text-light);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  text-align: center;
}

.gratitude-chip:hover {
  background: var(--surface-dim);
  border-color: var(--primary);
  color: var(--primary);
}

.gratitude-chip:active {
  transform: scale(0.97);
}

body.light-theme .gratitude-chip {
  background: var(--surface-dim);
  border-color: var(--border-dim);
  color: var(--text-dark);
}

.mood-slider-wrapper {
  position: relative;
  width: 100%;
  padding-top: 44px;
  padding-bottom: 80px;
}

.mood-emojis {
  position: relative;
  width: 100%;
  height: 36px;
  margin-bottom: 8px;
}

.mood-emoji {
  position: absolute;
  top: 0;
  width: 0;
  display: flex;
  justify-content: center;
}

.mood-emoji span {
  font-size: 18px;
  position: absolute;
  top: 0;
  left: 50%;
  transform-origin: center;
  transition: all 0.2s;
  translate: -50% 0;
}

.mood-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 32px;
  border-radius: 16px;
  background: var(--accent);
  outline: none;
  cursor: pointer;
  border: 1px solid var(--border-dim);
  display: block;
  margin: 0;
}

.mood-labels {
  position: relative;
  width: 100%;
  height: 80px;
  margin-top: 12px;
}

.mood-label {
  position: absolute;
  top: 0;
  width: 0;
  height: 80px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.mood-label span {
  font-size: 11px;
  white-space: nowrap;
  transform: rotate(90deg);
  transform-origin: left top;
  position: absolute;
  top: 4px;
  left: 50%;
  transition: all 0.2s;
}

.mood-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-light);
  cursor: pointer;
  box-shadow: 0 2px 6px var(--overlay);
}

.mood-slider::-moz-range-thumb {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-light);
  border: none;
  cursor: pointer;
  box-shadow: 0 2px 6px var(--overlay);
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-dim);
}

.empty-text {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--text-muted);
}

.empty-subtext {
  font-size: 12px;
  color: var(--text-dim);
}

@media (min-width: 451px) {
  body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
  }

  .app {
    background: transparent;
    text-align: center;
    border-radius: 12px;
  }
}
