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

:root {
  --bg-gradient-start: #c6e2fb;
  --bg-gradient-end: #ffffff;
  --card-bg: rgba(255, 255, 255, 0.95);
  --text-primary: #1a1d23;
  --text-secondary: #6b7280;
  --border: rgba(0, 0, 0, 0.1);
  --accent: #a7cff1;
  --accent-hover: #3d8dd6;
  --success: #10b981;
  --danger: #ef4444;
  --sidebar-bg: rgba(255, 255, 255, 0.9);
  --topbar-bg: rgba(255, 255, 255, 0.9);
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
  --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

[data-theme="dark"] {
  --bg-gradient-start: #1a1d23;
  --bg-gradient-end: #2c3e50;
  --card-bg: rgba(37, 40, 46, 0.95);
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --border: rgba(255, 255, 255, 0.1);
  --sidebar-bg: rgba(22, 25, 29, 0.9);
  --topbar-bg: rgba(22, 25, 29, 0.9);
}

[data-font="serif"] {
  --font-family: 'Georgia', 'Times New Roman', serif;
}

[data-font="mono"] {
  --font-family: 'Courier New', 'Consolas', monospace;
}

body {
  font-family: var(--font-family);
  background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

body.bg-image {
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
}

.top-bar {
  position: fixed;
  top: 0;
  left: 80px;
  right: 0;
  height: 70px;
  background: var(--topbar-bg);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  z-index: 100;
}

.top-bar-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.app-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.subtitle {
  font-size: 12px;
  color: var(--text-secondary);
}

.top-bar-center {
  flex: 1;
  display: flex;
  justify-content: center;
}

.timer-status {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  background: var(--card-bg);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.icon {
  font-size: 20px;
}

.timer-small {
  font-size: 20px;
  font-weight: 700;
  font-family: monospace;
  color: var(--accent);
}

.status-label {
  font-size: 13px;
  color: var(--text-secondary);
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.datetime {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.time {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.date {
  font-size: 12px;
  color: var(--text-secondary);
}

.icon-btn {
  width: 40px;
  height: 40px;
  border: none;
  background: var(--card-bg);
  border-radius: 12px;
  cursor: pointer;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  box-shadow: var(--shadow);
}

.icon-btn:hover {
  transform: scale(1.05);
}

.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: 80px;
  height: 100vh;
  background: var(--sidebar-bg);
  backdrop-filter: blur(20px);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 0;
  gap: 8px;
  z-index: 101;
}

.tab-btn {
  width: 56px;
  height: 56px;
  border: none;
  background: transparent;
  border-radius: 16px;
  cursor: pointer;
  font-size: 24px;
  transition: all 0.2s;
  color: var(--text-secondary);
}

.tab-btn:hover {
  background: var(--card-bg);
  color: var(--text-primary);
}

.tab-btn.active {
  background: var(--accent);
  color: white;
  box-shadow: var(--shadow);
}

.main-content {
  margin-left: 80px;
  margin-top: 70px;
  padding: 32px;
  min-height: calc(100vh - 70px);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.3s;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
  max-width: 1400px;
  margin: 0 auto;
}

.card {
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  border-radius: 20px;
  padding: 28px;
  box-shadow: var(--shadow);
  transition: all 0.3s;
}

.card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

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

.card-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.btn-icon {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--accent);
  color: white;
  border-radius: 8px;
  cursor: pointer;
  font-size: 18px;
  font-weight: 700;
}

.card-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.timer-display-large {
  text-align: center;
  font-size: 56px;
  font-weight: 700;
  font-family: monospace;
  color: var(--accent);
  margin: 24px 0;
}

.quick-actions {
  display: flex;
  gap: 12px;
}

.stat-item {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.stat-item:last-child {
  border-bottom: none;
}

.stat-label {
  font-size: 14px;
  color: var(--text-secondary);
}

.stat-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.content-center {
  max-width: 900px;
  margin: 0 auto;
}

.card h2 {
  font-size: 24px;
  margin-bottom: 24px;
  color: var(--text-primary);
}

.timer-circle {
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(79, 172, 254, 0.1) 0%, rgba(79, 172, 254, 0.2) 100%);
  border: 8px solid var(--accent);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 32px auto;
  box-shadow: var(--shadow);
}

.timer-display {
  font-size: 64px;
  font-weight: 700;
  font-family: monospace;
  color: var(--text-primary);
}

.timer-mode {
  font-size: 14px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 8px;
}

.timer-controls {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 32px;
}

.btn {
  padding: 12px 28px;
  border: none;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font-family);
}

.btn-primary {
  background: var(--accent);
  color: white;
  box-shadow: var(--shadow);
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

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

.btn-secondary:hover {
  background: var(--text-secondary);
  color: white;
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--border);
  color: var(--text-primary);
}

.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.full-width {
  width: 100%;
}

.timer-settings {
  display: flex;
  gap: 24px;
  justify-content: center;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.setting-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.setting-group label {
  font-size: 13px;
  color: var(--text-secondary);
  min-width: 80px;
}

.setting-group input {
  width: 70px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card-bg);
  color: var(--text-primary);
  font-size: 14px;
  text-align: center;
}

.setting-group span {
  font-size: 13px;
  color: var(--text-secondary);
}

.task-input,
.quick-add-card input {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.task-input input,
.quick-add-card input,
#dashTaskInput {
  flex: 1;
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.5);
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--font-family);
}

.task-input input:focus,
#dashTaskInput:focus {
  outline: none;
  border-color: var(--accent);
  background: white;
}

.task-stats {
  text-align: center;
  margin-bottom: 20px;
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 600;
}

.task-list {
  list-style: none;
}

.task-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 12px;
  margin-bottom: 10px;
  transition: all 0.2s;
  border: 1px solid transparent;
}

.task-item:hover {
  background: rgba(255, 255, 255, 0.8);
  border-color: var(--accent);
}

.task-item input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: var(--accent);
}

.task-text {
  flex: 1;
  font-size: 14px;
}

.task-item.completed .task-text {
  text-decoration: line-through;
  color: var(--text-secondary);
}

.task-delete {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 20px;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.2s;
}

.task-delete:hover {
  background: var(--danger);
  color: white;
}

.flashcard-layout {
  display: flex;
  gap: 32px;
}

.flashcard-sidebar {
  flex: 0 0 300px;
}

.flashcard-sidebar h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
}

.card-create {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.card-create input {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.5);
  color: var(--text-primary);
  font-size: 13px;
  font-family: var(--font-family);
}

.card-list {
  list-style: none;
  max-height: 500px;
  overflow-y: auto;
}

.card-item {
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 10px;
  margin-bottom: 8px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-item:hover {
  background: rgba(255, 255, 255, 0.8);
}

.card-item.active {
  background: var(--accent);
  color: white;
}

.card-actions button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
  opacity: 0.6;
}

.card-actions button:hover {
  opacity: 1;
}

.flashcard-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.flashcard {
  width: 100%;
  max-width: 500px;
  height: 350px;
  cursor: pointer;
  margin-bottom: 20px;
}

.flashcard-content {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(79, 172, 254, 0.1) 0%, rgba(79, 172, 254, 0.2) 100%);
  border: 2px solid var(--accent);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  font-size: 20px;
  font-weight: 600;
  text-align: center;
  transition: all 0.3s;
  box-shadow: var(--shadow);
}

.flashcard-content:hover {
  transform: scale(1.02);
  box-shadow: var(--shadow-lg);
}

.card-info {
  margin-bottom: 20px;
}

.card-counter {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 600;
}

.flashcard-controls {
  display: flex;
  gap: 12px;
}

.sound-master {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border);
}

.sound-master label {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 600;
  min-width: 120px;
}

.sound-master input[type="range"] {
  flex: 1;
}

.sound-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sound-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 14px;
}

.sound-icon {
  font-size: 24px;
  min-width: 40px;
  text-align: center;
}

.sound-name {
  min-width: 120px;
  font-size: 14px;
  font-weight: 600;
}

.sound-slider {
  flex: 1;
}

.sound-value {
  min-width: 50px;
  text-align: center;
  font-size: 13px;
  color: var(--text-secondary);
  font-family: monospace;
}

input[type="range"] {
  height: 6px;
  background: rgba(79, 172, 254, 0.2);
  border-radius: 3px;
  outline: none;
  appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: none;
}

.settings-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.settings-modal.active {
  display: flex;
}

.modal-content {
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  border-radius: 24px;
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 28px;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  font-size: 20px;
  font-weight: 700;
}

.btn-close {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  font-size: 28px;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s;
}

.btn-close:hover {
  background: var(--border);
  color: var(--text-primary);
}

.modal-body {
  padding: 24px 28px;
}

.setting-section {
  margin-bottom: 24px;
}

.setting-section label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.setting-section select,
.setting-section input[type="text"],
.setting-section input[type="color"] {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.5);
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--font-family);
}

.setting-section input[type="color"] {
  height: 50px;
  cursor: pointer;
}

.setting-section.hidden {
  display: none;
}

.sticky-note {
  position: fixed;
  width: 260px;
  min-height: 220px;
  background: #fef68a;
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  padding: 20px;
  cursor: move;
  z-index: 999;
  resize: both;
  overflow: auto;
}

.sticky-note-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  cursor: move;
}

.sticky-note-header span {
  font-size: 20px;
}

.sticky-note-controls button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 20px;
  padding: 4px;
  opacity: 0.6;
  border-radius: 4px;
  transition: all 0.2s;
}

.sticky-note-controls button:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.1);
}

.sticky-note textarea {
  width: 100%;
  min-height: 160px;
  background: transparent;
  border: none;
  resize: none;
  font-family: 'Comic Sans MS', cursive;
  font-size: 14px;
  color: #333;
  outline: none;
  line-height: 1.6;
}

.sticky-note.yellow { background: #fef68a; }
.sticky-note.pink { background: #ffb3d9; }
.sticky-note.blue { background: #a8d8ff; }
.sticky-note.green { background: #c1ffc1; }
.sticky-note.purple { background: #e6c3ff; }

@media (max-width: 1024px) {
  .flashcard-layout {
    flex-direction: column;
  }
  
  .flashcard-sidebar {
    flex: none;
    width: 100%;
  }
}

@media (max-width: 768px) {
  .sidebar {
    width: 60px;
  }
  
  .top-bar {
    left: 60px;
    padding: 0 16px;
  }
  
  .main-content {
    margin-left: 60px;
    padding: 16px;
  }
  
  .top-bar-center {
    display: none;
  }
  
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  
  .timer-circle {
    width: 240px;
    height: 240px;
  }
  
  .timer-display {
    font-size: 48px;
  }
  
  .timer-display-large {
    font-size: 40px;
  }
}