/* ── Reset & base ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:           #eceae6;
  --surface:      #f3f1ed;
  --border:       #d1cec8;
  --border-light: #e0ddd8;
  --text:         #1c1917;
  --muted:        #7c7874;
  --premium:      #92400e;
  --danger:       #991b1b;
  --success:      #14532d;
  --radius:       3px;
}

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Layout ────────────────────────────────────────────────────────────────── */
.container {
  max-width: 620px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ── Nav ───────────────────────────────────────────────────────────────────── */
nav {
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
}

nav .inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  font-size: 13px;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.brand::before {
  content: '• ';
  color: var(--muted);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: block;
}

.nav-user {
  font-size: 13px;
  color: var(--muted);
}

/* ── Main content ──────────────────────────────────────────────────────────── */
main {
  padding: 40px 0 80px;
}

/* ── Section cards ─────────────────────────────────────────────────────────── */
.section {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 10px;
  background: var(--surface);
}

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 14px;
}

.section-label {
  font-size: 11px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
}

/* ── Greeting section ──────────────────────────────────────────────────────── */
.greeting-section {
  padding: 20px 20px 16px;
}

.greeting {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.premium-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--premium);
  border: 1px solid currentColor;
  padding: 2px 7px;
  border-radius: 3px;
  vertical-align: middle;
}

.afk-notice {
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--muted);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.afk-text em {
  font-style: normal;
  color: var(--text);
}

.afk-since {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

/* ── Stats ─────────────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 20px;
}

.stat-value {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.stat-label {
  font-size: 11px;
  color: var(--muted);
  margin-top: 1px;
}

/* ── Row with inline action ────────────────────────────────────────────────── */
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.row-value {
  font-size: 14px;
  font-weight: 500;
}

.row-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 1px;
}

/* ── Buttons ───────────────────────────────────────────────────────────────── */
button, .btn {
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  border-radius: var(--radius);
  transition: background 0.1s, color 0.1s, border-color 0.1s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  padding: 4px 10px;
}

.btn:hover { background: var(--border-light); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-danger {
  color: var(--danger);
  border-color: transparent;
}
.btn-danger:hover { background: #fee2e2; border-color: #fca5a5; }

.btn-link {
  border: none;
  background: none;
  color: var(--muted);
  padding: 0;
  font-size: 12px;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: var(--border);
}
.btn-link:hover { color: var(--text); text-decoration-color: var(--muted); }

/* ── Todo list ─────────────────────────────────────────────────────────────── */
.todo-list {
  list-style: none;
  margin-top: 4px;
}

.todo-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-light);
}

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

.todo-check {
  flex-shrink: 0;
  width: 13px;
  height: 13px;
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.1s, border-color 0.1s;
}

.todo-check:hover { border-color: var(--muted); }

.todo-check.done {
  background: var(--muted);
  border-color: var(--muted);
}

.todo-content {
  flex: 1;
  font-size: 13px;
  word-break: break-word;
}

.todo-content.done {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-color: var(--border);
}

.todo-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

/* ── Add-todo inline form ──────────────────────────────────────────────────── */
.add-todo-form {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
  align-items: center;
}

/* ── Inputs ────────────────────────────────────────────────────────────────── */
.input {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  padding: 7px 10px;
  border-radius: var(--radius);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.1s;
}

.input:focus { border-color: var(--muted); }
.input::placeholder { color: var(--muted); }

/* ── Empty state ───────────────────────────────────────────────────────────── */
.empty-state {
  font-size: 13px;
  color: var(--muted);
  padding: 8px 0 2px;
  font-style: italic;
}

/* ── Modal ─────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(28, 25, 23, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 22px 22px 18px;
  width: 100%;
  max-width: 340px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.12);
}

.modal-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 14px;
}

.modal-hint {
  font-size: 11px;
  color: var(--muted);
  margin-top: 6px;
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 14px;
}

/* ── Toast ─────────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--text);
  color: var(--bg);
  padding: 9px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  z-index: 200;
  max-width: 280px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.18s, transform 0.18s;
  pointer-events: none;
}

.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: var(--danger); }

/* ── Skeleton loading ──────────────────────────────────────────────────────── */
.skel {
  background: var(--border);
  border-radius: var(--radius);
  animation: pulse 1.4s ease-in-out infinite;
  display: inline-block;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

/* ── Login page ────────────────────────────────────────────────────────────── */
.login-wrap {
  min-height: calc(100vh - 53px);
  display: flex;
  align-items: flex-start;
  padding-top: 80px;
}

.login-box {
  max-width: 360px;
}

.login-title {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.login-sub {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 28px;
  line-height: 1.6;
}

.btn-discord {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #5865f2;
  color: #fff;
  border: none;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.1s;
  cursor: pointer;
}

.btn-discord:hover { background: #4752c4; }

.login-error {
  margin-top: 16px;
  font-size: 12px;
  color: var(--danger);
  display: flex;
  align-items: center;
  gap: 5px;
}

/* ── Error page ────────────────────────────────────────────────────────────── */
.error-wrap {
  padding-top: 80px;
}

.error-code {
  font-size: 48px;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--border);
  line-height: 1;
  margin-bottom: 10px;
}

.error-msg {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 20px;
}

/* ── Utility ───────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.muted  { color: var(--muted); }
.mono   { font-family: 'SF Mono', 'Fira Code', monospace; font-size: 13px; }

/* ── Timezone datalist hint ────────────────────────────────────────────────── */
.tz-examples {
  font-size: 11px;
  color: var(--muted);
  margin-top: 6px;
  line-height: 1.6;
}

/* ── Last.fm card ──────────────────────────────────────────────────────────── */
.lfm-card {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.lfm-avatar-wrap {
  position: relative;
  flex-shrink: 0;
  width: 38px;
  height: 38px;
}

.lfm-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--border);
  object-fit: cover;
  display: block;
}

.lfm-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #d51007;
  border: 2px solid var(--surface);
}

.lfm-info {
  flex: 1;
  min-width: 0;
}

.lfm-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
}

.lfm-name:hover { text-decoration: underline; text-underline-offset: 2px; }

.lfm-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 1px;
}

.lfm-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

/* ── Last.fm unlinked state ────────────────────────────────────────────────── */
.lfm-unlinked-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.lfm-unlinked-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--border-light);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--muted);
  flex-shrink: 0;
}

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 12px 16px; }
  .toast { right: 12px; bottom: 12px; left: 12px; max-width: unset; }
  .lfm-card { flex-wrap: wrap; }
  .lfm-actions { width: 100%; }
  .lfm-unlinked-wrap { flex-wrap: wrap; }
  .lfm-unlinked-wrap > a { width: 100%; justify-content: center; }
}
