/* ============================================
   DoujinDesk ✿ Theme System & Core Styles
   ============================================ */

:root {
  /* Default: Sakura Dream (ピンク×水色) */
  --primary: #f472b6;
  --primary-light: #fbcfe8;
  --primary-dark: #db2777;
  --secondary: #67e8f9;
  --secondary-light: #cffafe;
  --secondary-dark: #06b6d4;
  --accent: #c084fc;
  --accent-light: #e9d5ff;
  --bg-main: #fdf2f8;
  --bg-card: #ffffff;
  --bg-sidebar: linear-gradient(180deg, #fce7f3 0%, #ecfeff 100%);
  --text-primary: #4a1942;
  --text-secondary: #7c6f84;
  --text-muted: #a89bb0;
  --border: #f9a8d4;
  --border-light: #fce7f3;
  --shadow: rgba(244, 114, 182, 0.15);
  --shadow-hover: rgba(244, 114, 182, 0.25);
  --success: #34d399;
  --warning: #fbbf24;
  --danger: #fb7185;
  --gradient-primary: linear-gradient(135deg, #f472b6, #67e8f9);
  --gradient-card: linear-gradient(135deg, #fff 0%, #fdf2f8 50%, #ecfeff 100%);
  --gradient-header: linear-gradient(135deg, #ec4899, #8b5cf6, #06b6d4);
  --font-main: 'Zen Maru Gothic', 'M PLUS Rounded 1c', sans-serif;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;
}

/* Theme: Lavender Night */
[data-theme="lavender"] {
  --primary: #a78bfa;
  --primary-light: #ddd6fe;
  --primary-dark: #7c3aed;
  --secondary: #f0abfc;
  --secondary-light: #fae8ff;
  --secondary-dark: #c026d3;
  --accent: #818cf8;
  --accent-light: #c7d2fe;
  --bg-main: #f5f3ff;
  --bg-card: #ffffff;
  --bg-sidebar: linear-gradient(180deg, #ede9fe 0%, #fae8ff 100%);
  --text-primary: #2e1065;
  --text-secondary: #6b5b95;
  --text-muted: #9b8eb8;
  --border: #c4b5fd;
  --border-light: #ede9fe;
  --shadow: rgba(139, 92, 246, 0.15);
  --shadow-hover: rgba(139, 92, 246, 0.25);
  --gradient-primary: linear-gradient(135deg, #a78bfa, #f0abfc);
  --gradient-card: linear-gradient(135deg, #fff 0%, #f5f3ff 50%, #fae8ff 100%);
  --gradient-header: linear-gradient(135deg, #7c3aed, #c026d3, #818cf8);
}

/* Theme: Mint Chocolate */
[data-theme="mint"] {
  --primary: #34d399;
  --primary-light: #d1fae5;
  --primary-dark: #059669;
  --secondary: #a3845b;
  --secondary-light: #f5e6d3;
  --secondary-dark: #78603f;
  --accent: #6ee7b7;
  --accent-light: #d1fae5;
  --bg-main: #f0fdf4;
  --bg-card: #ffffff;
  --bg-sidebar: linear-gradient(180deg, #d1fae5 0%, #fef3c7 100%);
  --text-primary: #064e3b;
  --text-secondary: #5b7a6f;
  --text-muted: #8fa89e;
  --border: #6ee7b7;
  --border-light: #d1fae5;
  --shadow: rgba(52, 211, 153, 0.15);
  --shadow-hover: rgba(52, 211, 153, 0.25);
  --gradient-primary: linear-gradient(135deg, #34d399, #a3845b);
  --gradient-card: linear-gradient(135deg, #fff 0%, #f0fdf4 50%, #fef3c7 100%);
  --gradient-header: linear-gradient(135deg, #059669, #34d399, #a3845b);
}

/* Theme: Sunset Orange */
[data-theme="sunset"] {
  --primary: #fb923c;
  --primary-light: #fed7aa;
  --primary-dark: #ea580c;
  --secondary: #f87171;
  --secondary-light: #fecaca;
  --secondary-dark: #dc2626;
  --accent: #fbbf24;
  --accent-light: #fef3c7;
  --bg-main: #fff7ed;
  --bg-card: #ffffff;
  --bg-sidebar: linear-gradient(180deg, #ffedd5 0%, #fef2f2 100%);
  --text-primary: #7c2d12;
  --text-secondary: #9a6b50;
  --text-muted: #b8977e;
  --border: #fdba74;
  --border-light: #ffedd5;
  --shadow: rgba(251, 146, 60, 0.15);
  --shadow-hover: rgba(251, 146, 60, 0.25);
  --gradient-primary: linear-gradient(135deg, #fb923c, #f87171);
  --gradient-card: linear-gradient(135deg, #fff 0%, #fff7ed 50%, #fef2f2 100%);
  --gradient-header: linear-gradient(135deg, #ea580c, #fb923c, #f87171);
}

/* Theme: Ocean Blue */
[data-theme="ocean"] {
  --primary: #38bdf8;
  --primary-light: #bae6fd;
  --primary-dark: #0284c7;
  --secondary: #818cf8;
  --secondary-light: #c7d2fe;
  --secondary-dark: #4f46e5;
  --accent: #22d3ee;
  --accent-light: #cffafe;
  --bg-main: #f0f9ff;
  --bg-card: #ffffff;
  --bg-sidebar: linear-gradient(180deg, #e0f2fe 0%, #e0e7ff 100%);
  --text-primary: #0c4a6e;
  --text-secondary: #4b6b8a;
  --text-muted: #7e97ad;
  --border: #7dd3fc;
  --border-light: #e0f2fe;
  --shadow: rgba(56, 189, 248, 0.15);
  --shadow-hover: rgba(56, 189, 248, 0.25);
  --gradient-primary: linear-gradient(135deg, #38bdf8, #818cf8);
  --gradient-card: linear-gradient(135deg, #fff 0%, #f0f9ff 50%, #e0e7ff 100%);
  --gradient-header: linear-gradient(135deg, #0284c7, #38bdf8, #818cf8);
}

/* Theme: Dark Mode */
[data-theme="dark"] {
  --primary: #f472b6;
  --primary-light: #4a1942;
  --primary-dark: #ec4899;
  --secondary: #67e8f9;
  --secondary-light: #164e63;
  --secondary-dark: #22d3ee;
  --accent: #c084fc;
  --accent-light: #3b1f6e;
  --bg-main: #0f0a1a;
  --bg-card: #1a1028;
  --bg-sidebar: linear-gradient(180deg, #1a1028 0%, #0f172a 100%);
  --text-primary: #f3e8ff;
  --text-secondary: #c4b5d4;
  --text-muted: #8b7a9e;
  --border: #4a1942;
  --border-light: #2d1a3e;
  --shadow: rgba(244, 114, 182, 0.1);
  --shadow-hover: rgba(244, 114, 182, 0.2);
  --gradient-primary: linear-gradient(135deg, #f472b6, #67e8f9);
  --gradient-card: linear-gradient(135deg, #1a1028 0%, #1e1035 50%, #0f172a 100%);
  --gradient-header: linear-gradient(135deg, #ec4899, #8b5cf6, #06b6d4);
}

/* ============================================
   Base & Reset
   ============================================ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-main);
  background: var(--bg-main);
  color: var(--text-primary);
  min-height: 100vh;
  transition: background 0.4s ease, color 0.4s ease;
}

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-main); }
::-webkit-scrollbar-thumb {
  background: var(--primary-light);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* ============================================
   Layout
   ============================================ */
.app-container {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 260px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-light);
  padding: 0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  transition: transform 0.3s ease, background 0.4s;
}

.sidebar-header {
  background: var(--gradient-header);
  padding: 20px;
  text-align: center;
  color: white;
}

.sidebar-header h1 {
  font-size: 1.3rem;
  font-weight: 900;
  letter-spacing: 1px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.sidebar-header .subtitle {
  font-size: 0.7rem;
  opacity: 0.85;
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.2s;
  margin-bottom: 2px;
  position: relative;
}

.nav-item:hover {
  background: var(--primary-light);
  color: var(--primary-dark);
  transform: translateX(3px);
}

.nav-item.active {
  background: var(--gradient-primary);
  color: white;
  box-shadow: 0 3px 12px var(--shadow);
  font-weight: 700;
}

.nav-item i {
  width: 22px;
  text-align: center;
  font-size: 1rem;
}

.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: white;
  font-size: 0.65rem;
  padding: 2px 7px;
  border-radius: 10px;
  font-weight: 700;
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border-light);
}

.main-content {
  margin-left: 260px;
  flex: 1;
  min-height: 100vh;
  padding: 24px 28px;
  transition: margin-left 0.3s;
}

/* Focus Mode */
body.focus-mode .sidebar { transform: translateX(-100%); }
body.focus-mode .main-content { margin-left: 0; }
body.focus-mode .quick-memo-fab { display: none; }

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

.top-bar h2 {
  font-size: 1.5rem;
  font-weight: 900;
  background: var(--gradient-header);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

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

/* ============================================
   Cards & Panels
   ============================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 2px 12px var(--shadow);
  transition: all 0.3s;
}

.card:hover {
  box-shadow: 0 6px 24px var(--shadow-hover);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border-light);
}

.card-header h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}

.card-grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

/* ============================================
   Buttons
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-main);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--gradient-primary);
  color: white;
  box-shadow: 0 2px 8px var(--shadow);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px var(--shadow-hover);
}

.btn-secondary {
  background: var(--primary-light);
  color: var(--primary-dark);
}
.btn-secondary:hover { background: var(--border); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
}
.btn-ghost:hover {
  background: var(--primary-light);
  color: var(--primary-dark);
}

.btn-danger {
  background: var(--danger);
  color: white;
}
.btn-danger:hover { filter: brightness(1.1); }

.btn-sm { padding: 5px 10px; font-size: 0.78rem; }
.btn-lg { padding: 12px 24px; font-size: 1rem; }

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--border-light);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}
.btn-icon:hover {
  background: var(--primary-light);
  color: var(--primary-dark);
  border-color: var(--primary);
}

/* ============================================
   Form Elements
   ============================================ */
.input, .textarea, .select {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-family: var(--font-main);
  font-size: 0.88rem;
  color: var(--text-primary);
  background: var(--bg-card);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--shadow);
}
.textarea { resize: vertical; min-height: 80px; }
.select { cursor: pointer; }

.input-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.input-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

/* ============================================
   Pomodoro Timer
   ============================================ */
.pomodoro-container {
  text-align: center;
  padding: 20px;
}

.pomodoro-display {
  position: relative;
  width: 240px;
  height: 240px;
  margin: 0 auto 24px;
}

.pomodoro-ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.pomodoro-ring-bg {
  fill: none;
  stroke: var(--border-light);
  stroke-width: 8;
}

.pomodoro-ring-progress {
  fill: none;
  stroke: url(#pomodoroGradient);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 691.15;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1s linear;
}

.pomodoro-time {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.pomodoro-time .time {
  font-size: 3rem;
  font-weight: 900;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}

.pomodoro-time .label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
}

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

.pomodoro-sessions {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 16px;
}

.pomodoro-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--border-light);
  transition: all 0.3s;
}
.pomodoro-dot.completed {
  background: var(--gradient-primary);
  box-shadow: 0 0 8px var(--shadow);
}
.pomodoro-dot.current {
  background: var(--primary);
  animation: pulse 2s infinite;
}

.pomodoro-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 16px;
}

.pomo-stat {
  background: var(--gradient-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 12px 8px;
  text-align: center;
}
.pomo-stat .value {
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--primary-dark);
}
.pomo-stat .label {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* ============================================
   Schedule / Calendar
   ============================================ */
.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.calendar-day-header {
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  padding: 6px 0;
}

.calendar-day {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-xs);
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  border: 1px solid transparent;
}
.calendar-day:hover { background: var(--primary-light); }
.calendar-day.today {
  background: var(--gradient-primary);
  color: white;
  font-weight: 700;
}
.calendar-day.has-event::after {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--danger);
  position: absolute;
  bottom: 3px;
}
.calendar-day.other-month { color: var(--text-muted); opacity: 0.4; }

.event-list { margin-top: 16px; }
.event-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--gradient-card);
  border: 1px solid var(--border-light);
  margin-bottom: 8px;
  transition: all 0.2s;
}
.event-item:hover { box-shadow: 0 2px 8px var(--shadow); }
.event-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.event-info { flex: 1; }
.event-info .title { font-weight: 600; font-size: 0.88rem; }
.event-info .meta { font-size: 0.72rem; color: var(--text-muted); }

.deadline-banner {
  background: var(--gradient-primary);
  color: white;
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  margin-bottom: 20px;
}
.deadline-banner .days {
  font-size: 3rem;
  font-weight: 900;
  line-height: 1;
}
.deadline-banner .label {
  font-size: 0.85rem;
  opacity: 0.9;
}

/* ============================================
   Todo List
   ============================================ */
.todo-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  margin-bottom: 6px;
  background: var(--bg-card);
  transition: all 0.2s;
}
.todo-item:hover { box-shadow: 0 2px 8px var(--shadow); }
.todo-item.completed {
  opacity: 0.6;
  text-decoration: line-through;
}

.todo-checkbox {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}
.todo-checkbox.checked {
  background: var(--gradient-primary);
  border-color: transparent;
  color: white;
}

.todo-content { flex: 1; }
.todo-content .title { font-weight: 600; font-size: 0.88rem; }
.todo-content .meta { font-size: 0.72rem; color: var(--text-muted); }

.todo-priority {
  font-size: 0.65rem;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 700;
}
.priority-high { background: #fee2e2; color: #dc2626; }
.priority-medium { background: #fef3c7; color: #d97706; }
.priority-low { background: #d1fae5; color: #059669; }

.time-calc-box {
  background: var(--gradient-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 16px;
}
.time-calc-box h4 {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--primary-dark);
}
.time-result {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.time-result-item {
  text-align: center;
  padding: 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border-light);
}
.time-result-item .value {
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--primary-dark);
}
.time-result-item .label {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* ============================================
   Resources & Filing
   ============================================ */
.resource-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.resource-tab {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border-light);
  background: var(--bg-card);
  color: var(--text-secondary);
  transition: all 0.2s;
}
.resource-tab.active {
  background: var(--gradient-primary);
  color: white;
  border-color: transparent;
}

.resource-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  margin-bottom: 8px;
  background: var(--bg-card);
  transition: all 0.2s;
}
.resource-item:hover { box-shadow: 0 2px 8px var(--shadow); }
.resource-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.resource-icon.link { background: #dbeafe; color: #2563eb; }
.resource-icon.image { background: #fce7f3; color: #db2777; }
.resource-icon.doc { background: #d1fae5; color: #059669; }
.resource-icon.note { background: #fef3c7; color: #d97706; }

/* ============================================
   Idea Notebook
   ============================================ */
.idea-card {
  background: var(--gradient-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  transition: all 0.2s;
  cursor: pointer;
}
.idea-card:hover { box-shadow: 0 4px 16px var(--shadow-hover); }
.idea-card .tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 600;
  margin-right: 4px;
  margin-bottom: 6px;
}
.tag-plot { background: #dbeafe; color: #2563eb; }
.tag-character { background: #fce7f3; color: #db2777; }
.tag-scene { background: #d1fae5; color: #059669; }
.tag-dialogue { background: #fef3c7; color: #d97706; }
.tag-world { background: #e0e7ff; color: #4338ca; }

/* ============================================
   Character Manager
   ============================================ */
.chara-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all 0.3s;
}
.chara-card:hover { box-shadow: 0 6px 24px var(--shadow-hover); transform: translateY(-2px); }

.chara-avatar {
  width: 100%;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.5rem;
  position: relative;
}
.chara-avatar .color-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4px;
}
.chara-info { padding: 14px; }
.chara-info .name {
  font-weight: 900;
  font-size: 1.05rem;
  margin-bottom: 2px;
}
.chara-info .role {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.chara-traits {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.chara-trait {
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.65rem;
  font-weight: 600;
  background: var(--primary-light);
  color: var(--primary-dark);
}

/* ============================================
   Reward System
   ============================================ */
.badge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 12px;
}
.badge-item {
  text-align: center;
  padding: 12px 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  transition: all 0.3s;
}
.badge-item.earned {
  background: var(--gradient-card);
  border-color: var(--primary);
}
.badge-item.locked {
  opacity: 0.4;
  filter: grayscale(1);
}
.badge-item .emoji { font-size: 2rem; }
.badge-item .name { font-size: 0.65rem; font-weight: 600; margin-top: 4px; }

.points-display {
  background: var(--gradient-primary);
  color: white;
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  margin-bottom: 16px;
}
.points-display .points {
  font-size: 2.5rem;
  font-weight: 900;
  line-height: 1;
}
.points-display .label {
  font-size: 0.8rem;
  opacity: 0.9;
}

/* ============================================
   Progress Visualizer
   ============================================ */
.progress-bar-container {
  margin-bottom: 12px;
}
.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  margin-bottom: 4px;
}
.progress-bar {
  height: 12px;
  background: var(--border-light);
  border-radius: 6px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 6px;
  background: var(--gradient-primary);
  transition: width 0.5s ease;
}

/* ============================================
   Mood Log
   ============================================ */
.mood-selector {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin: 16px 0;
}
.mood-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid var(--border-light);
  font-size: 1.5rem;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
}
.mood-btn:hover { transform: scale(1.2); }
.mood-btn.selected {
  border-color: var(--primary);
  box-shadow: 0 0 12px var(--shadow);
  transform: scale(1.2);
}

/* ============================================
   Quick Memo FAB
   ============================================ */
.quick-memo-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--gradient-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  cursor: pointer;
  box-shadow: 0 4px 20px var(--shadow-hover);
  z-index: 200;
  transition: all 0.3s;
}
.quick-memo-fab:hover { transform: scale(1.1); }

.quick-memo-panel {
  position: fixed;
  bottom: 90px;
  right: 24px;
  width: 320px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px var(--shadow-hover);
  z-index: 200;
  overflow: hidden;
}
.quick-memo-panel.hidden { display: none; }
.quick-memo-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--gradient-primary);
  color: white;
  font-weight: 700;
  font-size: 0.9rem;
}
.quick-memo-header button {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  font-size: 1rem;
}
#quick-memo-input {
  width: 100%;
  border: none;
  padding: 12px 16px;
  font-family: var(--font-main);
  font-size: 0.85rem;
  resize: none;
  height: 80px;
  color: var(--text-primary);
  background: var(--bg-card);
}
#quick-memo-input:focus { outline: none; }
.quick-memo-save {
  display: block;
  width: calc(100% - 24px);
  margin: 0 12px 8px;
  padding: 8px;
  background: var(--gradient-primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-main);
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}
.quick-memo-save:hover { opacity: 0.9; }
#quick-memo-list {
  max-height: 200px;
  overflow-y: auto;
  padding: 8px 12px;
}
.quick-memo-item {
  padding: 8px;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.8rem;
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 8px;
}
.quick-memo-item .memo-text { flex: 1; word-break: break-all; }
.quick-memo-item .memo-time { font-size: 0.65rem; color: var(--text-muted); white-space: nowrap; }

/* ============================================
   Modal
   ============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal {
  background: var(--bg-card);
  border-radius: var(--radius);
  width: 100%;
  max-width: 520px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
}
.modal-header h3 { font-weight: 700; font-size: 1.05rem; }
.modal-body { padding: 20px; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--border-light);
}

/* ============================================
   Theme Picker
   ============================================ */
.theme-picker {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.theme-swatch {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid transparent;
  transition: all 0.2s;
  position: relative;
}
.theme-swatch:hover { transform: scale(1.15); }
.theme-swatch.active {
  border-color: var(--text-primary);
  box-shadow: 0 0 0 2px var(--bg-card), 0 0 0 4px var(--text-primary);
}

/* ============================================
   Google Login
   ============================================ */
.google-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  cursor: pointer;
  font-family: var(--font-main);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  transition: all 0.2s;
  width: 100%;
  justify-content: center;
}
.google-btn:hover { box-shadow: 0 2px 8px var(--shadow); }
.google-btn img { width: 20px; height: 20px; }

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--primary);
  cursor: pointer;
}

/* ============================================
   Animations
   ============================================ */
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--shadow-hover); }
  50% { box-shadow: 0 0 0 8px transparent; }
}

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

@keyframes confetti {
  0% { transform: translateY(0) rotate(0); opacity: 1; }
  100% { transform: translateY(-100px) rotate(720deg); opacity: 0; }
}

.fade-in { animation: fadeIn 0.3s ease; }

.confetti-particle {
  position: fixed;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 999;
  animation: confettiFall 1.5s ease forwards;
}
@keyframes confettiFall {
  0% { opacity: 1; transform: translateY(0) rotate(0) scale(1); }
  100% { opacity: 0; transform: translateY(200px) rotate(720deg) scale(0); }
}

/* ============================================
   Workspace
   ============================================ */
.ws-summary-window {
  background: var(--gradient-card);
  border: 2px solid var(--primary);
  border-radius: var(--radius);
  margin-bottom: 20px;
  overflow: hidden;
  transition: all 0.3s;
  box-shadow: 0 4px 20px var(--shadow);
}
.ws-summary-window:hover {
  box-shadow: 0 8px 32px var(--shadow-hover);
  transform: translateY(-2px);
}
.ws-summary-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: var(--gradient-header);
  color: white;
}
.ws-summary-body {
  padding: 16px 20px;
}
.ws-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}
.ws-sum-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border-light);
}
.ws-sum-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.ws-top-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.ws-session-card {
  min-height: 180px;
}

.ws-session-active {
  padding: 4px 0;
}
.ws-session-status {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ws-pulse {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse 2s infinite;
  flex-shrink: 0;
}

.ws-pinned-card {
  min-height: 180px;
}
.ws-pinned-task {
  padding: 8px 0;
}
.ws-pin-candidate {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
  cursor: pointer;
  font-size: 0.82rem;
  transition: all 0.2s;
}
.ws-pin-candidate:hover {
  background: var(--primary-light);
  border-color: var(--primary);
}

.ws-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.ws-tracker-item {
  text-align: center;
  padding: 8px;
  background: var(--gradient-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
}

.ws-todo-mini {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background 0.15s;
}
.ws-todo-mini:hover { background: var(--primary-light); }
.ws-todo-mini:last-child { border-bottom: none; }

.ws-bgm-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--radius-xs);
  text-decoration: none;
  color: var(--text-primary);
  transition: all 0.15s;
  border: 1px solid transparent;
}
.ws-bgm-item:hover {
  background: var(--primary-light);
  border-color: var(--border);
}

.ws-bgm-btn.btn-primary {
  animation: pulse 2s infinite;
}

/* YouTube player container */
#ws-bgm-player-wrap {
  position: relative;
  min-height: 0;
  transition: min-height 0.3s ease;
}
#ws-bgm-player-wrap:has(iframe) {
  min-height: 160px;
}
#ws-bgm-player-wrap iframe {
  border-radius: var(--radius-sm);
}

@media (max-width: 768px) {
  .ws-top-row {
    grid-template-columns: 1fr;
  }
  .ws-grid {
    grid-template-columns: 1fr;
  }
  .ws-summary-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   Responsive
   ============================================ */
.mobile-menu-btn {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 150;
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-content {
    margin-left: 0;
    padding: 16px;
    padding-top: 56px;
  }
  .mobile-menu-btn { display: flex; }
  .card-grid { grid-template-columns: 1fr; }
  .card-grid-3 { grid-template-columns: 1fr; }
  .pomodoro-display { width: 200px; height: 200px; }
}

/* ============================================
   Utility
   ============================================ */
.hidden { display: none !important; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }
.text-center { text-align: center; }
.text-sm { font-size: 0.8rem; }
.text-xs { font-size: 0.7rem; }
.font-bold { font-weight: 700; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============================================
   Oshi Notification Toast (Speech Bubble Style)
   ============================================ */
.oshi-toast {
  position: fixed;
  top: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 400;
  max-width: 380px;
  min-width: 280px;
  animation: oshiAppear 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.oshi-toast--exit {
  opacity: 0;
  transform: translateY(-20px) scale(0.9);
  transition: all 0.5s ease;
}

/* Speech bubble */
.oshi-toast-bubble {
  position: relative;
  background: var(--bg-card);
  border: 2px solid var(--primary);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: 0 8px 32px var(--shadow-hover), 0 0 0 4px var(--primary-light);
  width: 100%;
}
.oshi-toast--pomo .oshi-toast-bubble { border-color: var(--success); box-shadow: 0 8px 32px rgba(52,211,153,0.2), 0 0 0 4px rgba(52,211,153,0.1); }
.oshi-toast--encourage .oshi-toast-bubble { border-color: var(--accent); box-shadow: 0 8px 32px rgba(192,132,252,0.2), 0 0 0 4px rgba(192,132,252,0.1); }

/* Speech bubble tail */
.oshi-toast-tail {
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 10px solid var(--primary);
  filter: drop-shadow(0 2px 2px var(--shadow));
}
.oshi-toast--pomo .oshi-toast-tail { border-top-color: var(--success); }
.oshi-toast--encourage .oshi-toast-tail { border-top-color: var(--accent); }
.oshi-toast-tail::after {
  content: '';
  position: absolute;
  top: -12px;
  left: -8px;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 8px solid var(--bg-card);
}

.oshi-toast-speech {
  text-align: center;
}

.oshi-toast-line {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.6;
  animation: oshiTypeIn 0.6s ease 0.2s both;
}

/* Avatar circle below bubble */
.oshi-toast-avatar {
  margin-top: 14px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px var(--shadow-hover);
  animation: oshiBounce 0.6s ease 0.3s both;
}
.oshi-toast--pomo .oshi-toast-avatar { background: linear-gradient(135deg, var(--success), #6ee7b7); }
.oshi-toast--encourage .oshi-toast-avatar { background: linear-gradient(135deg, var(--accent), #e9d5ff); }

.oshi-toast-icon {
  font-size: 1.8rem;
  line-height: 1;
}

/* Meta info below avatar */
.oshi-toast-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin-top: 6px;
}

.oshi-toast-name {
  font-weight: 900;
  font-size: 0.88rem;
  color: var(--primary-dark);
}
.oshi-toast-cat {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 600;
}

.oshi-toast-close {
  position: absolute;
  top: 8px;
  right: 8px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.75rem;
  padding: 4px;
  opacity: 0.5;
  transition: all 0.2s;
  z-index: 1;
}
.oshi-toast-close:hover { opacity: 1; color: var(--text-primary); }

@keyframes oshiAppear {
  0% { opacity: 0; transform: translateY(-30px) scale(0.7); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes oshiBounce {
  0% { transform: scale(0); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

@keyframes oshiTypeIn {
  0% { opacity: 0; transform: translateY(6px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* ============================================
   Discord / OBS Overlay
   ============================================ */
.overlay-root {
  transition: background 0.4s ease;
}

#overlay-preview-wrap {
  position: relative;
  background-image:
    linear-gradient(45deg, #333 25%, transparent 25%),
    linear-gradient(-45deg, #333 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #333 75%),
    linear-gradient(-45deg, transparent 75%, #333 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
  background-color: #2d2d2d;
}

.discord-setup-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
}
.discord-setup-step:last-child { border-bottom: none; }
.discord-step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--gradient-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 900;
  flex-shrink: 0;
}
