html {
  background: #191919;
}

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

:root {
  --bg: #191919;
  --bg-secondary: #232323;
  --sidebar-bg: #1e1e1e;
  --sidebar-hover: #2a2a2a;
  --sidebar-active: #333333;
  --border: #333333;
  --text: #e8e8e8;
  --text-secondary: #888888;
  --text-placeholder: #555555;
  --accent: #4ade80;
  --accent-blue: #60a5fa;
  --accent-bg: rgba(96, 165, 250, 0.12);
  --green: #34d399;
  --green-bg: rgba(52, 211, 153, 0.12);
  --orange: #fb923c;
  --orange-bg: rgba(251, 146, 60, 0.12);
  --red: #f87171;
  --red-bg: rgba(248, 113, 113, 0.1);
  --purple: #a78bfa;
  --purple-bg: rgba(167, 139, 250, 0.12);
  --priority-high: #f87171;
  --priority-medium: #fb923c;
  --priority-low: #60a5fa;
  --priority-none: #555555;
  --radius: 4px;
  --content-max: 680px;
  --xp-color: #a78bfa;
  --xp-bg: rgba(167, 139, 250, 0.15);
  --font-body: 'Source Serif 4', 'Charter', 'Georgia', 'Cambria', serif;
  --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --text-2xs: 10px;
  --text-xs: 11px;
  --text-sm: 12px;
  --text-base: 14px;
  --text-md: 15px;
  --text-lg: 16px;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 18px;
  line-height: 1.65;
  letter-spacing: -0.003em;
  -webkit-font-smoothing: antialiased;
  color-scheme: dark;
}

#sidebar { display: none; }

#bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  align-items: center;
  height: 56px;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
}

#bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-decoration: none;
  color: var(--text-secondary);
  font-family: var(--font-ui);
  font-size: var(--text-2xs);
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 8px;
  transition: color 0.12s;
  -webkit-tap-highlight-color: transparent;
}

#bottom-nav a:active { opacity: 0.7; }
#bottom-nav a svg { display: block; margin: 0 auto 2px; }
#bottom-nav a.active { color: #fff; font-weight: 600; background: #7247FF; }

/* CLOCK HEADER */
#clock-header {
  position: sticky;
  top: 0;
  z-index: 90;
  background: var(--bg);
  padding: 32px 20px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

.clock-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.clock-time-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.clock-time {
  font-family: var(--font-ui);
  font-size: 64px;
  font-weight: 200;
  letter-spacing: -4px;
  line-height: 1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* SYNC INDICATOR */
.sync-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: background 0.3s;
}
.sync-indicator.synced { background: var(--green); }
.sync-indicator.syncing { background: var(--orange); animation: syncPulse 1s ease-in-out infinite; }
.sync-indicator.offline { background: var(--red); }

@keyframes syncPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.clock-date {
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 400;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
}

.clock-stats {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: 2px;
}

.clock-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.clock-stat-value {
  font-family: var(--font-ui);
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.clock-stat-label {
  font-family: var(--font-ui);
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: lowercase;
  letter-spacing: 0.3px;
}

.clock-stat-divider {
  width: 1px;
  height: 28px;
  background: var(--border);
}

/* SNAIL TIMER */
#snail-section {
  width: auto;
}

.snail-timer__label {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
}

.snail-controls-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.snail-presets {
  display: flex;
  align-items: center;
  gap: 2px;
  margin: 0 6px;
}

.snail-preset-opt {
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--text-placeholder);
  cursor: pointer;
  padding: 2px 5px;
  transition: color 0.12s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.snail-preset-opt:hover { color: var(--text-secondary); }
.snail-preset-opt.active { color: #7247FF; font-weight: 500; }

.snail-icon-btn {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: #7247FF;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.12s;
  -webkit-tap-highlight-color: transparent;
  padding: 0;
  flex-shrink: 0;
}
.snail-icon-btn:hover { opacity: 0.8; }

.snail-timer {
  width: 100%;
  overflow: hidden;
}

.snail-timer__track {
  position: relative;
  width: fit-content;
  margin-left: auto;
}

.snail-timer__body {
  display: flex;
  align-items: flex-end;
  position: relative;
}

.snail {
  position: relative;
  z-index: 2;
  animation: snailMove var(--snail-duration, 45s) linear forwards;
  animation-play-state: paused;
  transform: translateX(calc(100% - 138px));
}

.snail-timer__dust {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, #7247FF33, #7247FF11);
  border-radius: 2px;
  opacity: 0.6;
}

#snail-stats .clock-stat-value { font-size: 18px; }
#snail-stats .clock-stat-label { font-size: 10px; }

@keyframes snailMove {
  from { transform: translateX(calc(100% - 138px)); }
  to { transform: translateX(-100%); }
}

#content {
  padding: 0;
  max-width: var(--content-max);
  margin: 0 auto;
}

.section {
  display: none;
  padding: 20px 20px 80px;
}
.section.active { display: block; }

.section-header {
  position: sticky;
  top: var(--section-top, 180px);
  z-index: 10;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 -20px;
  padding: 8px 20px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.section-header h1 {
  font-family: var(--font-ui);
  font-size: 24px;
  font-weight: 200;
  line-height: 1.2;
  color: var(--text);
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: none;
  padding-bottom: 0;
}

.heading-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  opacity: 0.4;
}
.section-header .subtitle {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* STATS BAR */
.stats-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  overflow-x: auto;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  flex-shrink: 0;
}

.stat-value {
  font-family: var(--font-ui);
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  white-space: nowrap;
}

.stat-label {
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
}

.stat-divider {
  width: 1px;
  height: 28px;
  background: var(--border);
  flex-shrink: 0;
}

.stat-xp { flex: 1; min-width: 80px; }

.xp-bar-container {
  width: 100%;
  height: 8px;
  background: var(--xp-bg);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 4px;
}

.xp-bar-fill {
  height: 100%;
  background: var(--xp-color);
  border-radius: 4px;
  transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  width: 0%;
}

/* ADD TASK FORM */
.add-task-form { margin-bottom: 20px; }

.add-main-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.add-main-row input {
  flex: 1;
  padding: 12px 0;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  color: var(--text);
  font-size: 16px;
  font-family: var(--font-ui);
  outline: none;
  transition: border-color 0.12s;
}
.add-main-row input:focus { border-color: #7247FF; }
.add-main-row input::placeholder { color: var(--text-placeholder); }

.add-btn {
  padding: 10px 20px;
  background: #7247FF;
  color: #fff;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 15px;
  font-weight: 500;
  font-family: var(--font-ui);
  white-space: nowrap;
  transition: opacity 0.15s;
}
.add-btn:hover { opacity: 0.8; }
.add-btn:active { opacity: 0.6; }

.add-options {
  display: none;
  gap: 12px;
  padding: 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  flex-wrap: wrap;
}
.add-options.open { display: flex; }

.option-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.option-group label {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* PRIORITY SELECTOR */
.priority-selector { display: flex; gap: 4px; }

.priority-dot {
  background: none;
  border: 2px solid transparent;
  border-radius: 50%;
  padding: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s;
  -webkit-tap-highlight-color: transparent;
}

.priority-dot .dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: block;
}

.priority-dot .dot.high { background: var(--priority-high); }
.priority-dot .dot.medium { background: var(--priority-medium); }
.priority-dot .dot.low { background: var(--priority-low); }
.priority-dot .dot.none { background: var(--priority-none); border: 1.5px dashed var(--text-placeholder); }
.priority-dot.active { border-color: var(--text); }

.date-input, .tags-input {
  padding: 6px 0;
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 13px;
  outline: none;
}
.date-input:focus, .tags-input:focus { border-color: #7247FF; }
.tags-input { min-width: 120px; }
.tags-input::placeholder { color: var(--text-placeholder); }

/* SEARCH */
.search-row { margin-bottom: 16px; }

.search-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 15px;
  font-family: var(--font-ui);
  outline: none;
  margin-bottom: 12px;
  transition: border-color 0.12s;
}
.search-input:focus { border-color: #7247FF; }
.search-input::placeholder { color: var(--text-placeholder); }

/* FILTER BAR */
.filter-bar {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.filter-bar::-webkit-scrollbar { display: none; }
#links .filter-bar { margin-top: 12px; }

.filter-btn {
  padding: 6px 14px;
  background: transparent;
  color: var(--text-secondary);
  border: none;
  border-radius: 20px;
  cursor: pointer;
  font-size: 14px;
  font-family: var(--font-ui);
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.12s;
}
.filter-btn:hover { background: transparent; color: var(--text); border-color: #7247FF55; }
.filter-btn.active { background: #7247FF; color: #fff; font-weight: 500; }

/* INLINE ADD */
.inline-add {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}
.inline-add.hidden { display: none; }
.inline-add input {
  padding: 10px 0;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  color: var(--text);
  font-size: 15px;
  font-family: var(--font-ui);
  outline: none;
  transition: border-color 0.12s;
}
.inline-add input:focus { border-color: #7247FF; }
.inline-add input::placeholder { color: var(--text-placeholder); }

/* ADD ICON BUTTON */
.add-icon-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-size: 16px;
  font-weight: 300;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
  padding: 0;
}
.add-icon-btn:hover { border-color: #7247FF; color: #7247FF; }

#todo-list {
  max-height: 420px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

/* CARD LIST */
.card-list { list-style: none; }

.card-list li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 8px;
  margin: 0 -8px;
  border-radius: 4px;
  transition: background 0.08s;
}
.card-list li:hover { background: rgba(255,255,255,0.02); }
.card-list li:last-child { border-bottom: none; }

.card-list li .text {
  flex: 1;
  font-size: 16px;
  color: var(--text);
  line-height: 1.5;
  min-width: 0;
}

.card-list li .text a { color: var(--text); text-decoration: none; }
.card-list li .text a:hover { color: #7247FF; }
.card-list li.done .text { text-decoration: line-through; color: var(--text-placeholder); }

/* TODO META */
.todo-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.todo-priority-badge {
  font-family: var(--font-ui);
  font-size: 9px;
  font-weight: 600;
  padding: 1px 6px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--text-secondary);
  border-radius: 0;
}
.todo-priority-badge.high { color: var(--red); }
.todo-priority-badge.medium { color: var(--orange); }
.todo-priority-badge.low { color: var(--green); }

.todo-due {
  font-family: var(--font-ui);
  font-size: 12px;
  color: var(--text-secondary);
}
.todo-due.overdue { color: var(--red); font-weight: 600; }

.todo-tags { display: flex; gap: 4px; flex-wrap: wrap; }

.todo-tag {
  font-family: var(--font-ui);
  font-size: 9px;
  padding: 1px 5px;
  color: var(--text-placeholder);
  background: none;
  border: none;
  color: var(--text-secondary);
}

/* SUBTASKS */
.todo-subtasks { margin-top: 6px; padding-left: 28px; }

.subtask-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
}

.subtask-check {
  width: 14px;
  height: 14px;
  border: 1.5px solid var(--text-placeholder);
  border-radius: 3px;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.08s;
  -webkit-tap-highlight-color: transparent;
}
.subtask-check:active { opacity: 0.6; }
.subtask-check.done { background: #7247FF; border-color: #7247FF; }
.subtask-check.done::after { content: '\2713'; color: #fff; font-size: 9px; font-weight: 700; }

.subtask-text { font-size: 14px; color: var(--text-secondary); line-height: 1.4; }
.subtask-text.done { text-decoration: line-through; color: var(--text-placeholder); }

.subtask-add-row { display: flex; gap: 6px; margin-top: 4px; }

.subtask-add-input {
  flex: 1;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  font-family: var(--font-ui);
  outline: none;
}
.subtask-add-input:focus { border-color: #7247FF; }
.subtask-add-input::placeholder { color: var(--text-placeholder); }

.subtask-add-btn {
  padding: 4px 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  font-family: var(--font-ui);
}
.subtask-add-btn:hover { background: var(--sidebar-hover); }

/* ACTION BUTTONS */
.card-list li .btn-done,
.card-list li .btn-delete,
.card-list li .btn-expand {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  padding: 4px;
  color: var(--text-placeholder);
  opacity: 0;
  transition: all 0.08s;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

.card-list li .btn-done,
.card-list li .btn-delete,
.card-list li .btn-expand { opacity: 0.5; }

.card-list li .btn-done:active,
.card-list li .btn-delete:active,
.card-list li .btn-expand:active { opacity: 0.6; }

.card-list li .btn-done:hover { opacity: 1; color: var(--accent); }
.card-list li .btn-delete:hover { opacity: 1; color: var(--red); }
.card-list li .btn-expand:hover { opacity: 1; color: #7247FF; }

/* CHECKBOX */
.todo-check {
  width: 14px;
  height: 14px;
  border: 1.5px solid var(--text-placeholder);
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.08s;
  margin-top: 3px;
  -webkit-tap-highlight-color: transparent;
}
.todo-check.done { background: var(--green); border-color: var(--green); }
.todo-check.done::after { content: ''; width: 4px; height: 4px; background: #fff; border-radius: 50%; }

/* OVERDUE */
.card-list li.overdue {
  background: var(--red-bg);
  border-radius: var(--radius);
  padding: 12px 8px;
  margin: 0 -8px;
}

/* XP POPUP */
.xp-popup {
  position: fixed;
  pointer-events: none;
  z-index: 200;
  font-family: var(--font-ui);
  font-size: 18px;
  font-weight: 700;
  color: var(--xp-color);
  opacity: 0;
}

.xp-popup.show {
  animation: xpFloat 1.2s ease-out forwards;
}

@keyframes xpFloat {
  0% { opacity: 1; transform: translateY(0) scale(1); }
  50% { opacity: 1; transform: translateY(-30px) scale(1.1); }
  100% { opacity: 0; transform: translateY(-60px) scale(0.8); }
}

/* ACHIEVEMENT TOAST */
.achievement-toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text);
  color: var(--bg);
  padding: 12px 20px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  font-family: var(--font-ui);
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  max-width: 90vw;
}

.achievement-toast.show {
  animation: toastIn 0.4s ease forwards, toastOut 0.4s ease 2.6s forwards;
}

.achievement-icon { font-size: 24px; }
.achievement-text { display: flex; flex-direction: column; }
.achievement-title { font-size: 14px; font-weight: 700; }
.achievement-desc { font-size: 12px; opacity: 0.8; }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(-50%) translateY(0); }
  to { opacity: 0; transform: translateX(-50%) translateY(-20px); }
}

.hidden { display: none !important; }

.active-track .text { color: #7247FF !important; }

/* TOAST */
.toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text);
  color: var(--bg);
  padding: 10px 18px;
  border-radius: var(--radius);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  z-index: 400;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}
.toast.show {
  animation: toastIn 0.3s ease forwards, toastOut 0.3s ease 2.7s forwards;
}
.toast-success { background: var(--green); color: var(--bg); }
.toast-warning { background: var(--orange); color: var(--bg); }
.toast-error { background: var(--red); color: #fff; }

/* UPLOAD FEEDBACK */
.audio-upload-area.uploading {
  opacity: 0.6;
  cursor: default;
}

/* CHATBOT */
.chatbot-placeholder {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 280px);
  min-height: 300px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-msg {
  width: 100%;
  padding: 8px 12px;
  border-radius: 0;
  font-size: 15px;
  line-height: 1.5;
  white-space: pre-wrap;
}
.chat-msg.bot {
  align-self: flex-start;
  border-left: 2px solid #7247FF44;
  color: var(--text);
}
.chat-msg.user {
  align-self: flex-end;
  border-left: 2px solid var(--green);
  color: var(--text);
}

.chat-msg-images {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.chat-msg-thumb {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 6px;
}

.chat-input-row {
  display: flex;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  align-items: center;
}

.chat-img-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s;
  flex-shrink: 0;
}
.chat-img-btn:hover { border-color: #7247FF; color: #7247FF; }

.chat-input {
  flex: 1;
  padding: 10px 0;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  color: var(--text);
  font-size: 15px;
  font-family: var(--font-ui);
  outline: none;
}
.chat-input:focus { border-color: #7247FF; }

/* CHAT IMAGE PREVIEW */
.chat-image-preview {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 0;
}
.chat-image-preview:empty { display: none; }

.chat-thumb-wrap {
  position: relative;
  display: inline-block;
}

.chat-thumb-img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.chat-thumb-remove {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* CHAT ACTION CHIPS */
.chat-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.chat-action-chip {
  font-family: var(--font-ui);
  font-size: 11px;
  padding: 2px 8px;
  background: rgba(52, 211, 153, 0.15);
  color: var(--green);
  border-radius: 3px;
  font-weight: 500;
}

/* BUTTONS */
.btn-toggle {
  padding: 6px 14px;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
  font-family: var(--font-ui);
  transition: all 0.12s;
  margin-bottom: 16px;
}
.btn-toggle:hover { background: var(--bg-secondary); color: var(--text); }

/* OTHER SECTIONS */
.add-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
  align-items: stretch;
}
.add-row input, .add-row select {
  flex: 1;
  padding: 10px 0;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  color: var(--text);
  font-size: 15px;
  font-family: var(--font-ui);
  outline: none;
}
.add-row input:focus, .add-row select:focus { border-color: #7247FF; }
.add-row input::placeholder { color: var(--text-placeholder); }
.add-row select { color: var(--text-secondary); cursor: pointer; }

.status-badge {
  font-family: var(--font-ui);
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 0;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.status-unread, .status-to-read, .status-queued { color: var(--orange); background: none; }
.status-reading, .status-listening { color: #7247FF; background: none; }
.status-done { color: var(--green); background: none; }


.empty-state { padding: 24px 0; color: var(--text-placeholder); font-size: 16px; font-style: italic; }

/* AUDIO UPLOAD */
.audio-upload-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 32px 20px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  color: var(--text-placeholder);
  font-family: var(--font-ui);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s;
  margin-bottom: 16px;
}
.audio-upload-area:hover, .audio-upload-area.dragover {
  border-color: var(--accent);
  color: var(--text-secondary);
  background: rgba(114, 71, 255, 0.04);
}
.upload-icon {
  font-size: 28px;
  font-weight: 300;
  line-height: 1;
}

/* PLAYER CARD */
.player-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 20px;
}

.player-card-top {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.player-pfp {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  background: rgba(114, 71, 255, 0.1);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  padding-bottom: 12px;
  flex-shrink: 0;
}

.player-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 28px;
}

.pbar {
  width: 4px;
  background: var(--accent);
  border-radius: 2px;
  height: 6px;
  transition: height 0.15s;
}

.player-bars.playing .pbar { animation: barBounce 0.8s ease-in-out infinite alternate; }
.player-bars.playing .pbar-1 { animation-delay: 0s; }
.player-bars.playing .pbar-2 { animation-delay: 0.15s; }
.player-bars.playing .pbar-3 { animation-delay: 0.3s; }
.player-bars.playing .pbar-4 { animation-delay: 0.1s; }
.player-bars.playing .pbar-5 { animation-delay: 0.25s; }

@keyframes barBounce {
  0% { height: 6px; }
  100% { height: 24px; }
}

.player-texts {
  min-width: 0;
  flex: 1;
}

.player-track-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-track-artist {
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.player-controls-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  margin-bottom: 20px;
}

.player-ctrl-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}
.player-ctrl-btn svg { width: 22px; height: 22px; }
.player-ctrl-btn:hover { color: #7247FF; }
.player-ctrl-btn:active { opacity: 0.6; }

.player-ctrl-main {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #7247FF;
  color: #fff;
}
.player-ctrl-main svg { width: 22px; height: 22px; }
.player-ctrl-main:hover { opacity: 0.85; color: #fff; }

.player-skip-btn {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.5px;
  min-width: 36px;
}

.player-time-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.player-time-text {
  font-family: var(--font-ui);
  font-size: 12px;
  color: var(--text-placeholder);
  min-width: 32px;
  font-variant-numeric: tabular-nums;
}
.player-time-text:last-child { text-align: right; }

.player-time-bar {
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  cursor: pointer;
}

.player-time-elapsed {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  width: 0%;
  transition: width 0.3s linear;
}

/* LINK CAROUSEL */
.link-carousel-wrap {
  margin-bottom: 8px;
}

.link-carousel {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  gap: 12px;
  padding: 4px 0 16px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.link-carousel::-webkit-scrollbar { display: none; }

.link-card-item {
  flex: 0 0 100%;
  scroll-snap-align: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  cursor: pointer;
  transition: border-color 0.15s;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  min-height: 120px;
  justify-content: center;
}
.link-card-item:hover { border-color: #7247FF55; }

.link-card-icon {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #7247FF11;
  flex-shrink: 0;
  overflow: hidden;
}
.link-card-icon img {
  width: 24px;
  height: 24px;
  border-radius: 4px;
}
.link-card-icon-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.link-card-title {
  font-size: 16px;
  font-weight: 400;
  color: var(--text);
  line-height: 1.3;
}

.link-card-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
  max-width: 280px;
}

.link-card-url {
  font-family: var(--font-ui);
  font-size: 12px;
  color: var(--text-placeholder);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.link-card-check {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  cursor: pointer;
  background: transparent;
  padding: 0;
}
.link-card-check:hover { border-color: var(--green); }
.link-card-check.checked {
  background: var(--green);
  border-color: var(--green);
}
.link-card-check.checked::after {
  content: '';
  width: 4px;
  height: 4px;
  background: #fff;
  border-radius: 50%;
}

.link-card-delete {
  position: absolute;
  top: 14px;
  left: 14px;
  background: none;
  border: none;
  color: var(--text-placeholder);
  cursor: pointer;
  font-size: 14px;
  padding: 4px;
  border-radius: var(--radius);
  opacity: 0.5;
  transition: all 0.12s;
}
.link-card-delete:hover { opacity: 1; color: var(--red); }

.link-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.link-nav-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.link-nav-btn:hover { background: var(--border); }
.link-nav-btn:active { opacity: 0.6; }
.link-nav-btn:disabled { opacity: 0.3; cursor: default; }

.link-counter {
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--text-secondary);
  min-width: 60px;
  text-align: center;
}

/* SCROLLBAR */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* TABLET */
@media (min-width: 768px) {
  body { font-size: 20px; }
  #clock-header { padding: 36px 40px 24px; }
  .clock-time { font-size: 80px; letter-spacing: -5px; }
  .clock-date { font-size: 16px; }
  .clock-stat-value { font-size: 22px; }
  .section { padding: 32px 48px 80px; }
  .section-header h1 { font-size: 30px; }
  .card-list li { padding: 14px 0; }
  .add-main-row { flex-direction: row; }
  .add-row { flex-direction: row; }
  .add-row input, .add-row select { flex: 1; }
  .link-card-item { flex: 0 0 calc(50% - 6px); min-height: 200px; }
  #snail-section { padding-bottom: 16px; }
}

/* DESKTOP */
@media (min-width: 1024px) {
  body { display: block; }

  #bottom-nav {
    border-top: 1px solid var(--border);
  }

  #clock-header {
    padding: 40px 40px 28px;
  }

  .clock-time { font-size: 100px; letter-spacing: -6px; }
  .clock-date { font-size: 18px; }
  .clock-stats { gap: 28px; }
  .clock-stat-value { font-size: 24px; }
  .clock-stat-label { font-size: 13px; }

  #content {
    max-width: 760px;
    margin: 0 auto;
  }
  .section { padding: 0 48px 80px; }
  .section-header h1 { font-size: 34px; }
  #snail-section { padding-bottom: 16px; }
  .chatbot-placeholder { height: calc(100vh - 400px); }
  .links-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }

  .card-list li .btn-done,
  .card-list li .btn-delete,
  .card-list li .btn-expand { opacity: 0; }

  .card-list li:hover .btn-done,
  .card-list li:hover .btn-delete,
  .card-list li:hover .btn-expand { opacity: 1; }
}

@media (min-width: 1280px) {
}

/* ═══════════════ WAVEFORM ═══════════════ */
.waveform-canvas {
  width: 100%;
  height: 64px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  margin: 8px 0;
  display: block;
}

/* ═══════════════ SPEED BUTTONS ═══════════════ */
.player-speed {
  display: flex;
  gap: 4px;
}
.speed-btn {
  font-family: var(--font-ui);
  font-size: 11px;
  padding: 3px 8px;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}
.speed-btn.active {
  background: #7247FF;
  color: var(--bg);
  border-color: #7247FF;
}
.speed-btn:hover {
  border-color: #7247FF;
  color: #7247FF;
}

/* ═══════════════ NOTE CATEGORY ═══════════════ */
.note-category {
  font-family: var(--font-ui);
  font-size: 10px;
  padding: 1px 6px;
  background: rgba(114, 71, 255, 0.1);
  color: #7247FF;
  border-radius: 3px;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ═══════════════ NOTE LIST ═══════════════ */
.note-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  flex-wrap: wrap;
}
.note-item .text {
  flex: 1;
  min-width: 0;
  word-break: break-word;
}

/* ═══════════════ UPLOAD PROGRESS ═══════════════ */
.upload-progress {
  width: 100%;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 8px;
}
.upload-progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.3s ease;
  width: 0%;
}
.book-category-input {
  width: 90px;
}
