:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #14141f;
  --bg-tertiary: #1e1e2e;
  --text-primary: #ffffff;
  --text-secondary: #a0a0b0;
  --text-muted: #606070;
  --accent: #00d4ff;
  --accent-secondary: #00ff88;
  --danger: #ff4466;
  --focus-ring: #00d4ff;
  --focus-glow: rgba(0, 212, 255, 0.4);
  --radius-md: 12px;
  --mood-1: #b8334d;
  --mood-2: #c97a3a;
  --mood-3: #6a6a85;
  --mood-4: #3aa37a;
  --mood-5: #00d488;
}

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

html, body {
  width: 600px;
  height: 600px;
  overflow: hidden;
  background: #000;
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
}

#app { width: 100%; height: 100%; position: relative; }

.screen {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  padding: 20px;
}

.screen.hidden { display: none; }

.focusable {
  transition: all 0.15s ease;
  border: 2px solid transparent;
  cursor: pointer;
  outline: none;
}

.focusable:focus {
  border-color: var(--focus-ring);
  box-shadow: 0 0 20px var(--focus-glow);
}

.hidden { display: none !important; }

/* Header */
.header {
  text-align: center;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--bg-tertiary);
  margin-bottom: 14px;
  flex-shrink: 0;
}

.header h1, .header h2 {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.date {
  color: var(--text-secondary);
  font-size: 13px;
  margin-top: 4px;
  letter-spacing: 0.5px;
}

/* Home today card */
.today-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 0;
}

.today-label {
  color: var(--text-secondary);
  font-size: 12px;
  letter-spacing: 3px;
  font-weight: 600;
}

.today-mood {
  font-size: 96px;
  line-height: 1;
}

.today-text {
  font-size: 22px;
  font-weight: 500;
  color: var(--text-primary);
}

/* Home menu */
.menu {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
}

.menu-btn {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  font-size: 18px;
  font-weight: 500;
  width: 100%;
  min-height: 56px;
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
}

.menu-icon {
  width: 32px;
  height: 32px;
  background: var(--bg-tertiary);
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-size: 18px;
  flex-shrink: 0;
}

.menu-btn:focus .menu-icon {
  background: var(--accent);
  color: var(--bg-primary);
}

/* Log Mood list */
.mood-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 6px 0;
  justify-content: center;
}

.mood-btn {
  display: grid;
  grid-template-columns: 56px 1fr 100px;
  align-items: center;
  gap: 16px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 10px 18px;
  width: 100%;
  min-height: 60px;
  color: var(--text-primary);
}

.mood-emoji {
  font-size: 36px;
  line-height: 1;
  text-align: center;
}

.mood-label {
  font-size: 19px;
  font-weight: 500;
  text-align: left;
}

.mood-bar {
  height: 8px;
  border-radius: 4px;
  display: block;
  width: 100%;
}

.mood-bar-1 { background: var(--mood-1); }
.mood-bar-2 { background: var(--mood-2); }
.mood-bar-3 { background: var(--mood-3); }
.mood-bar-4 { background: var(--mood-4); }
.mood-bar-5 { background: var(--mood-5); }

.mood-btn.selected {
  background: var(--bg-tertiary);
  border-color: var(--accent-secondary);
}

/* Calendar */
.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.cal-header h2 {
  flex: 1;
  text-align: center;
}

.nav-btn {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  width: 48px;
  height: 48px;
  font-size: 28px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
}

.weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  padding: 6px 0 10px;
  flex-shrink: 0;
}

.weekdays span {
  text-align: center;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-template-rows: repeat(6, 1fr);
  gap: 4px;
  flex: 1;
  min-height: 0;
}

.cal-cell {
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 500;
  background: var(--bg-secondary);
  color: var(--text-secondary);
}

.cal-cell.mood-1 { background: var(--mood-1); color: #fff; }
.cal-cell.mood-2 { background: var(--mood-2); color: #fff; }
.cal-cell.mood-3 { background: var(--mood-3); color: #fff; }
.cal-cell.mood-4 { background: var(--mood-4); color: #fff; }
.cal-cell.mood-5 { background: var(--mood-5); color: #0a0a0f; }

.cal-cell.empty {
  background: transparent;
}

.cal-cell.today {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  font-weight: 700;
}

.cal-legend {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 0 6px;
  flex-shrink: 0;
}

.leg-dot {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  display: inline-block;
}

.leg-1 { background: var(--mood-1); }
.leg-2 { background: var(--mood-2); }
.leg-3 { background: var(--mood-3); }
.leg-4 { background: var(--mood-4); }
.leg-5 { background: var(--mood-5); }

.leg-text {
  color: var(--text-secondary);
  font-size: 11px;
  margin-left: 8px;
  letter-spacing: 0.5px;
}

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  flex-shrink: 0;
}

.stat-card {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  min-height: 90px;
}

.stat-value {
  font-size: 36px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

.stat-label {
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-top: 8px;
  font-weight: 600;
}

.mood-distribution {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  padding: 12px 0;
  min-height: 0;
}

.dist-row {
  display: grid;
  grid-template-columns: 32px 1fr 36px;
  align-items: center;
  gap: 10px;
}

.dist-emoji {
  font-size: 18px;
  text-align: center;
}

.dist-bar-wrap {
  background: var(--bg-secondary);
  border-radius: 4px;
  height: 14px;
  overflow: hidden;
}

.dist-bar {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
  min-width: 2px;
}

.dist-bar-1 { background: var(--mood-1); }
.dist-bar-2 { background: var(--mood-2); }
.dist-bar-3 { background: var(--mood-3); }
.dist-bar-4 { background: var(--mood-4); }
.dist-bar-5 { background: var(--mood-5); }

.dist-count {
  font-size: 13px;
  color: var(--text-secondary);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Footer / Back button */
.footer {
  padding-top: 14px;
  flex-shrink: 0;
}

.back-btn {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  padding: 12px;
  width: 100%;
  font-size: 15px;
  font-weight: 500;
  min-height: 44px;
}
