/* themes */
:root,
:root[data-theme="meadow"] {
  --bg: #F6F5EC;
  --surface: #FFFEF9;
  --border: #E3E5D6;
  --text: #28332E;
  --muted: #727B72;
  --heading-font: "Lexend", "Segoe UI", system-ui, sans-serif;
  --side-bg: repeating-linear-gradient(90deg, rgba(255, 255, 255, .09) 0 7px, transparent 7px 14px), #A3BF90;
  --side-text: #FFFFFF;
  --side-active-bg: #FFFEF9;
  --side-active-text: #5B7B4B;
  --accent: #5B7B4B;
  --accent-hover: #4C6A3E;
  --accent-soft: #E8F0DE;
  --accent-text: #5B7B4B;
  --number: #34507A;
  --second: #6F8EBF;
  --second-soft: #E8EFF6;
  --ring: #A3BF90;
  --ring-track: #E8EFF6;
  --banner: radial-gradient(circle at 85% 20%, rgba(199, 217, 234, .28), transparent 40%), linear-gradient(135deg, #34507A, #4A6A8C 50%, #6E8F68);
  --running-btn: #34507A;
  --running-btn-text: #FFFFFF;
  --glow: #F3D77A;
  --status-run-bg: #FBF3D6;
  --status-run-text: #7A6420;
  --note-bg: #E8EFF6;
  --note-border: #D9E3EE;
  --note-link: #34507A;
  --dot-online: #8FC49D;
}

:root[data-theme="ember"] {
  --bg: #3A0E10;
  --surface: #4A1518;
  --border: #62262A;
  --text: #F6E3D6;
  --muted: #C99E90;
  --heading-font: "Roboto Mono", ui-monospace, Consolas, monospace;
  --side-bg: #2B090B;
  --side-text: #EFA46B;
  --side-active-bg: #4A1518;
  --side-active-text: #FF9A4D;
  --accent: #E9782F;
  --accent-hover: #F28A45;
  --accent-soft: #5E2420;
  --accent-text: #F6AE78;
  --number: #F9A65E;
  --second: #F2C27A;
  --second-soft: #5E2420;
  --ring: #E9782F;
  --ring-track: #5E2420;
  --banner: radial-gradient(circle at 80% 30%, rgba(255, 170, 80, .35), transparent 45%), linear-gradient(135deg, #521517, #7A2A1E 55%, #B8561F);
  --running-btn: #F2C27A;
  --running-btn-text: #3A0E10;
  --glow: #FFC46B;
  --status-run-bg: #5E3A1A;
  --status-run-text: #FFD49A;
  --note-bg: #5E2420;
  --note-border: #733230;
  --note-link: #F6AE78;
  --dot-online: #7FD49A;
}

:root[data-theme="pumpkin"] {
  --bg: #F4EEE3;
  --surface: #FFFCF6;
  --border: #E8DCC8;
  --text: #3B2A1E;
  --muted: #86705D;
  --heading-font: "Lexend", "Segoe UI", system-ui, sans-serif;
  --side-bg: repeating-linear-gradient(0deg, rgba(255, 255, 255, .08) 0 3px, transparent 3px 18px), repeating-linear-gradient(90deg, rgba(255, 255, 255, .08) 0 3px, transparent 3px 18px), #8A5A35;
  --side-text: #FBEBD6;
  --side-active-bg: #FFFCF6;
  --side-active-text: #B4561F;
  --accent: #C8662A;
  --accent-hover: #B3571F;
  --accent-soft: #F8E6D3;
  --accent-text: #A4501C;
  --number: #6B3F22;
  --second: #8DAA4E;
  --second-soft: #EEF2DF;
  --ring: #E08A3C;
  --ring-track: #F8E6D3;
  --banner: radial-gradient(circle at 85% 25%, rgba(255, 210, 140, .35), transparent 42%), linear-gradient(135deg, #6B3F22, #A5582A 55%, #D98C3F);
  --running-btn: #6B3F22;
  --running-btn-text: #FFFFFF;
  --glow: #FFC76B;
  --status-run-bg: #FBEBD2;
  --status-run-text: #8A4B16;
  --note-bg: #F8E6D3;
  --note-border: #EFD5BA;
  --note-link: #A4501C;
  --dot-online: #8DC07A;
}

:root[data-theme="pink"] {
  --bg: #FBF4F7;
  --surface: #FFFFFF;
  --border: #F1DCE6;
  --text: #2C2A3A;
  --muted: #86798A;
  --heading-font: "Lexend", "Segoe UI", system-ui, sans-serif;
  --side-bg: #2F3C57;
  --side-text: #F7C9DD;
  --side-active-bg: #FFFFFF;
  --side-active-text: #D63F84;
  --accent: #D63F84;
  --accent-hover: #C0306F;
  --accent-soft: #FBE1EC;
  --accent-text: #C0306F;
  --number: #2F3C57;
  --second: #9B59B6;
  --second-soft: #F1E4F6;
  --ring: #E0559A;
  --ring-track: #FBE1EC;
  --banner: radial-gradient(circle at 85% 25%, rgba(255, 255, 255, .25), transparent 40%), linear-gradient(135deg, #8E4BA6, #D63F84 55%, #F08BB4);
  --running-btn: #2F3C57;
  --running-btn-text: #FFFFFF;
  --glow: #FFE27A;
  --status-run-bg: #FFF4D1;
  --status-run-text: #8A6A10;
  --note-bg: #FBE1EC;
  --note-border: #F5CFE0;
  --note-link: #C0306F;
  --dot-online: #7FD4A0;
}

:root[data-theme="cherry"] {
  --bg: #0E0E10;
  --surface: #18181B;
  --border: #2A2A2F;
  --text: #F2EDED;
  --muted: #A39A9C;
  --heading-font: "Lexend", "Segoe UI", system-ui, sans-serif;
  --side-bg: #09090A;
  --side-text: #D9D2D3;
  --side-active-bg: #D7263D;
  --side-active-text: #FFFFFF;
  --accent: #D7263D;
  --accent-hover: #EF3B52;
  --accent-soft: #2A1216;
  --accent-text: #FF6B7D;
  --number: #FFFFFF;
  --second: #B9B9C0;
  --second-soft: #26262B;
  --ring: #D7263D;
  --ring-track: #2A1216;
  --banner: radial-gradient(circle at 85% 25%, rgba(255, 60, 80, .35), transparent 45%), linear-gradient(135deg, #0B0B0C, #3A0A12 55%, #B0162E);
  --running-btn: #F2EDED;
  --running-btn-text: #0E0E10;
  --glow: #FF4D5E;
  --status-run-bg: #3A0F16;
  --status-run-text: #FF8A96;
  --note-bg: #1F1013;
  --note-border: #3A1A1F;
  --note-link: #FF6B7D;
  --dot-online: #5FD08A;
}

:root[data-theme="cherry"] .sidebar {
  border-right: 1px solid #2A1216;
}

:root[data-theme="retro"] {
  --bg: #F3EEE8;
  --surface: #FBF8F4;
  --border: #E5DCD2;
  --text: #3A2A26;
  --muted: #8A7A72;
  --heading-font: "Cormorant SC", Georgia, "Times New Roman", serif;
  --side-bg: linear-gradient(90deg, rgba(232, 154, 176, .22) 50%, transparent 50%), linear-gradient(rgba(141, 179, 90, .22) 50%, transparent 50%), #6E4B3A;
  --side-text: #F8E9E0;
  --side-active-bg: #FBF8F4;
  --side-active-text: #C2527A;
  --accent: #C2527A;
  --accent-hover: #A9446A;
  --accent-soft: #F7E1E8;
  --accent-text: #A9446A;
  --number: #5A3A2E;
  --second: #8DB35A;
  --second-soft: #EAF2DC;
  --ring: #E07A9A;
  --ring-track: #EAF2DC;
  --banner: radial-gradient(circle at 20% 120%, rgba(232, 154, 176, .45), transparent 45%), radial-gradient(circle at 90% 10%, rgba(141, 179, 90, .45), transparent 40%), linear-gradient(135deg, #5A3A2E, #8A5060 60%, #C2527A);
  --running-btn: #5A3A2E;
  --running-btn-text: #FFFFFF;
  --glow: #F6D97A;
  --status-run-bg: #FBF1D6;
  --status-run-text: #7A5E1A;
  --note-bg: #F7E1E8;
  --note-border: #EFCFDA;
  --note-link: #A9446A;
  --dot-online: #8FC47A;
}

:root[data-theme="retro"] .sidebar {
  background-size: 20px 20px, 20px 20px, auto;
}

:root[data-theme="retro"] .dash-title,
:root[data-theme="retro"] .stat-value,
:root[data-theme="retro"] .timer,
:root[data-theme="retro"] .banner-stat strong {
  letter-spacing: .01em;
  font-variant-numeric: lining-nums tabular-nums;
}

/* ocean */
:root[data-theme="ocean"] {
  --bg: #EEF5F7;
  --surface: #FBFEFF;
  --border: #D5E4EA;
  --text: #16303F;
  --muted: #6A8290;
  --heading-font: "Lexend", "Segoe UI", system-ui, sans-serif;
  --side-bg: radial-gradient(circle at 50% 100%, transparent 8px, rgba(255, 255, 255, .16) 9px 11px, transparent 12px) 0 0 / 24px 14px, linear-gradient(#1E7A96, #0E4A63);
  --side-text: #E3F4F8;
  --side-active-bg: #FBFEFF;
  --side-active-text: #0E6E8C;
  --accent: #0E7C9A;
  --accent-hover: #0A6A85;
  --accent-soft: #DDF0F5;
  --accent-text: #0B6A84;
  --number: #0E3F57;
  --second: #3FB8AF;
  --second-soft: #DDF3F1;
  --ring: #3FB8AF;
  --ring-track: #DDF0F5;
  --banner: radial-gradient(ellipse at 85% 0%, rgba(210, 245, 250, .35), transparent 50%), radial-gradient(circle at 15% 120%, rgba(127, 232, 218, .35), transparent 45%), linear-gradient(135deg, #0B3C5A, #0E6E8C 55%, #3FB8AF);
  --running-btn: #0E3F57;
  --running-btn-text: #FFFFFF;
  --glow: #7FE8DA;
  --status-run-bg: #D8F4F0;
  --status-run-text: #0F5E57;
  --note-bg: #DDF0F5;
  --note-border: #C8E3EC;
  --note-link: #0B6A84;
  --dot-online: #4FC39A;
}

/* aurora */
:root[data-theme="aurora"] {
  --bg: #0D1026;
  --surface: #161A36;
  --border: #282D55;
  --text: #ECEBFA;
  --muted: #A3A5CC;
  --heading-font: "Lexend", "Segoe UI", system-ui, sans-serif;
  --side-bg: radial-gradient(1px 1px at 20% 20%, #FFFFFF, transparent) 0 0 / 46px 60px, radial-gradient(1.5px 1.5px at 70% 65%, rgba(255, 255, 255, .8), transparent) 0 0 / 46px 60px, radial-gradient(ellipse at 50% 0%, rgba(110, 231, 183, .25), transparent 55%), linear-gradient(#17153F, #0A0B1E);
  --side-text: #CFC8F7;
  --side-active-bg: #2A2560;
  --side-active-text: #9CFFD9;
  --accent: #7C5CE8;
  --accent-hover: #9175F0;
  --accent-soft: #272253;
  --accent-text: #B7A4FF;
  --number: #7EF2C4;
  --second: #4FD1C5;
  --second-soft: #1B2B47;
  --ring: #6EE7B7;
  --ring-track: #272253;
  --banner: radial-gradient(1px 1px at 12% 70%, #FFFFFF, transparent), radial-gradient(1.5px 1.5px at 38% 22%, #FFFFFF, transparent), radial-gradient(1px 1px at 62% 80%, #FFFFFF, transparent), radial-gradient(1px 1px at 90% 55%, #FFFFFF, transparent), radial-gradient(ellipse at 20% 0%, rgba(110, 231, 183, .5), transparent 55%), radial-gradient(ellipse at 75% 10%, rgba(139, 108, 240, .6), transparent 55%), radial-gradient(ellipse at 55% 110%, rgba(236, 72, 153, .3), transparent 60%), linear-gradient(160deg, #0B0E2A, #1B1650 60%, #2A1A5E);
  --running-btn: #6EE7B7;
  --running-btn-text: #0D1026;
  --glow: #9CFFD9;
  --status-run-bg: #173B3A;
  --status-run-text: #9CFFD9;
  --note-bg: #1D1B45;
  --note-border: #2E2A63;
  --note-link: #B7A4FF;
  --dot-online: #6EE7B7;
}

:root[data-theme="aurora"] .sidebar {
  border-right: 1px solid #1F2348;
}

/* sunflower */
:root[data-theme="sunflower"] {
  --bg: #FFF9E8;
  --surface: #FFFFFF;
  --border: #F2E3B3;
  --text: #2F2A1C;
  --muted: #857A5C;
  --heading-font: "Lexend", "Segoe UI", system-ui, sans-serif;
  --side-bg: radial-gradient(circle, rgba(91, 58, 18, .22) 0 3px, transparent 4px) 0 0 / 22px 22px, #F5B800;
  --side-text: #3B2A07;
  --side-active-bg: #FFFFFF;
  --side-active-text: #9A5B00;
  --accent: #B86E00;
  --accent-hover: #9E5E00;
  --accent-soft: #FFF0C2;
  --accent-text: #9A5B00;
  --number: #5B3A12;
  --second: #6FA83A;
  --second-soft: #EAF4DC;
  --ring: #F5B800;
  --ring-track: #FFF0C2;
  --banner: radial-gradient(circle at 97% -30%, rgba(255, 247, 209, .5) 0 14%, rgba(255, 224, 102, .22) 15% 28%, transparent 46%), linear-gradient(135deg, #6E3C06, #A86400 55%, #C98600);
  --running-btn: #5B3A12;
  --running-btn-text: #FFFFFF;
  --glow: #FFD84D;
  --status-run-bg: #FFF3C4;
  --status-run-text: #7A5200;
  --note-bg: #FFF0C2;
  --note-border: #F7E1A0;
  --note-link: #9A5B00;
  --dot-online: #6FA83A;
}

/* base */
body.app {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

:is(.app, .auth-page) .avatar {
  color: #34304A;
  box-shadow: 0 0 0 3px var(--surface), 0 2px 8px rgba(0, 0, 0, .15);
}

/* sidebar */
.sidebar {
  grid-column: 1;
  grid-row: 1;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 18px 0;
  background: var(--side-bg);
}

.side-logo img {
  display: block;
  margin-bottom: 14px;
  padding: 4px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .45);
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.side-link {
  width: 76px;
  padding: 10px 0;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--side-text);
  text-decoration: none;
  font: 500 12px var(--font-heading);
}

.side-link svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.side-link:hover {
  background: rgba(255, 255, 255, .14);
}

.side-link.on {
  background: var(--side-active-bg);
  color: var(--side-active-text);
}

.side-me {
  margin-top: auto;
}

/* page */
.dash {
  grid-column: 2;
  grid-row: 1;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 28px 36px 48px;
}

.dash-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.dash-title {
  margin: 0;
  font: 600 clamp(24px, 3vw, 30px)/1.2 var(--heading-font);
  letter-spacing: -.01em;
}

.dash-date {
  margin: 2px 0 0;
  color: var(--muted);
}

.btn-outline {
  padding: 7px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font: 500 14px var(--font-heading);
  white-space: nowrap;
  cursor: pointer;
}

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

/* banner */
.banner {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 30px;
  border-radius: 20px;
  color: #fff;
  background: var(--banner);
}

.banner-left {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 16px;
}

.banner .avatar {
  box-shadow: 0 0 0 3px rgba(255, 255, 255, .85);
}

.banner h2 {
  margin: 0;
  font: 500 20px var(--heading-font);
}

.banner p {
  margin: 2px 0 0;
  color: rgba(255, 255, 255, .82);
}

.fly {
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #FFF1B8;
  box-shadow: 0 0 10px 4px rgba(255, 215, 122, .55);
}

.banner-stat {
  position: relative;
  z-index: 1;
  text-align: right;
  white-space: nowrap;
}

.banner-stat strong {
  display: block;
  font: 600 32px/1 var(--heading-font);
}

.banner-stat span {
  font-size: 14px;
  color: rgba(255, 255, 255, .82);
}

/* layout */
.dash-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 20px;
  margin-top: 20px;
}

.dash-col {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.panel {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 10px 24px -18px rgba(0, 0, 0, .35);
}

.panel-label {
  margin: 0;
  font: 500 14px var(--font-heading);
  color: var(--muted);
}

.panel-hint {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.panel-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* timer */
.timer-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 20px 28px;
  padding: 24px 28px;
}

.ring {
  position: relative;
  flex: none;
  width: 132px;
  height: 132px;
  display: grid;
  place-items: center;
}

.ring svg {
  position: absolute;
  inset: 0;
  transform: rotate(-90deg);
}

.ring circle {
  fill: none;
  stroke-width: 10;
}

.ring-track {
  stroke: var(--ring-track);
}

.ring-fill {
  stroke: var(--ring);
  stroke-linecap: round;
  stroke-dasharray: 364.42;
  stroke-dashoffset: 364.42;
  transition: stroke-dashoffset .6s;
}

.ring img {
  width: 42px;
  height: 42px;
  opacity: .55;
  transition: opacity .3s, filter .3s;
}

.timer-panel.running .ring img {
  opacity: 1;
  filter: drop-shadow(0 0 10px var(--glow));
}

.timer-body {
  flex: 1 1 200px;
  min-width: 0;
}

.timer {
  margin: 6px 0 8px;
  font: 600 clamp(34px, 4vw, 46px)/1 var(--heading-font);
  color: var(--number);
  font-variant-numeric: tabular-nums;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--second-soft);
  color: var(--muted);
  font: 500 13px var(--font-heading);
}

.status i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  opacity: .6;
}

.timer-panel.running .status {
  background: var(--status-run-bg);
  color: var(--status-run-text);
}

.timer-panel.running .status i {
  opacity: 1;
  background: var(--glow);
  box-shadow: 0 0 6px 1px var(--glow);
  animation: pulse 2s ease-in-out infinite;
}

.btn-leaf {
  flex: none;
  display: inline-block;
  padding: 12px 24px;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font: 600 15px var(--font-heading);
  text-decoration: none;
  cursor: pointer;
}

.btn-leaf:hover {
  background: var(--accent-hover);
}

.btn-leaf:disabled {
  opacity: .6;
  cursor: default;
}

.timer-panel.running .btn-leaf {
  background: var(--running-btn);
  color: var(--running-btn-text);
}

.btn-small {
  margin-top: 12px;
  padding: 8px 16px;
  font-size: 14px;
}

/* week stats */
.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.stat-wide {
  grid-column: 1 / -1;
}

.stat-value {
  margin-top: 8px;
  font: 600 26px/1.1 var(--heading-font);
  color: var(--number);
}

.stat-value small {
  font: 500 14px var(--font-body);
  color: var(--muted);
}

.stat-empty {
  margin: 6px 0 0;
}

.bar {
  height: 8px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 999px;
}

.bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  transition: width .6s;
}

.bar-green { background: var(--accent-soft); }
.bar-green span { background: var(--ring); }
.bar-blue { background: var(--second-soft); }
.bar-blue span { background: var(--second); }

:is(.app, .auth-page) .tags {
  margin-top: 12px;
}

:is(.app, .auth-page) .tag {
  background: var(--accent-soft);
  color: var(--accent-text);
}

/* online */
.pill-count {
  padding: 1px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-text);
  font: 600 12px var(--font-heading);
}

.people {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.people li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}

.people li:first-child {
  border-top: 0;
}

.people-empty {
  color: var(--muted);
}

.person-avatar {
  position: relative;
}

.dot {
  position: absolute;
  right: -2px;
  bottom: -1px;
  width: 12px;
  height: 12px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--dot-online);
  box-shadow: 0 0 6px 1px var(--dot-online);
}

.dot.studying {
  background: var(--glow);
  box-shadow: 0 0 8px 2px var(--glow);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  50% { box-shadow: 0 0 2px 0 var(--glow); }
}

.person-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 500 14px var(--font-heading);
}

.person-name small {
  display: block;
  font: 400 12px var(--font-body);
  color: var(--muted);
}

.goals-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--note-bg);
  border-color: var(--note-border);
}

.goals-note a {
  color: var(--note-link);
  font: 500 13px var(--font-heading);
  white-space: nowrap;
}

/* streak */
.streak-panel {
  display: flex;
  align-items: center;
  gap: 16px;
}

.flame {
  flex: none;
  width: 48px;
  height: 48px;
  padding: 10px;
  border-radius: 14px;
  background: var(--second-soft);
  fill: var(--muted);
  opacity: .7;
}

.streak-panel.lit .flame {
  opacity: 1;
  background: var(--status-run-bg);
  fill: #F29B38;
  filter: drop-shadow(0 0 6px rgba(242, 155, 56, .55));
}

.streak-value {
  margin-top: 2px;
  font: 600 26px/1.1 var(--heading-font);
  color: var(--number);
}

.streak-hint {
  margin-top: 4px;
}

/* leaderboard */
.segmented {
  display: flex;
  padding: 3px;
  border-radius: 999px;
  background: var(--second-soft);
}

.seg {
  padding: 4px 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: 500 12px var(--font-heading);
  cursor: pointer;
}

.seg.on {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .12);
}

.board {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.board li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 6px;
  border-radius: 10px;
}

.board li.me {
  background: var(--accent-soft);
}

.rank {
  flex: none;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font: 600 12px var(--font-heading);
  color: var(--muted);
}

.rank.medal-1 { background: #F4D35E; color: #5A4300; }
.rank.medal-2 { background: #D7DCE2; color: #3E4650; }
.rank.medal-3 { background: #E4B38A; color: #5A3217; }

.board-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 500 14px var(--font-heading);
}

.board-name small {
  color: var(--muted);
  font: 400 12px var(--font-body);
}

.board-value {
  font: 600 13px var(--font-heading);
  color: var(--number);
  white-space: nowrap;
}

/* goals page */
.panel-title {
  margin: 0;
  font: 600 18px var(--heading-font);
  color: var(--text);
}

.panel-hint-top {
  margin: 2px 0 18px;
}

.progress-row {
  margin: 14px 0 16px;
}

/* profile page */
.profile-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
  gap: 20px;
  align-items: start;
}

.profile-avatar {
  margin: 20px 0 24px;
}

.theme-grid-wide {
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
}

.save-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 20px;
}

.save-bar .form-message {
  flex: 1;
  min-height: 0;
}

.save-bar .btn-outline {
  text-decoration: none;
  padding: 11px 18px;
}

:is(.app, .auth-page) .theme-option {
  border-color: var(--border);
  background: var(--surface);
}

:is(.app, .auth-page) .theme-option:hover {
  border-color: var(--muted);
}

:is(.app, .auth-page) .theme-option.on {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

:is(.app, .auth-page) .theme-name {
  color: var(--text);
}

:is(.app, .auth-page) .link-btn {
  color: var(--muted);
}

@media (max-width: 900px) {
  .profile-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* chat button badge */
.side-link {
  position: relative;
}

.nav-badge {
  position: absolute;
  top: 4px;
  right: 12px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #E5484D;
  color: #fff;
  font: 600 11px/18px var(--font-heading);
  text-align: center;
}

/* chat page */
.chat-dash {
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding-bottom: 24px;
}

.chat-layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 20px;
}

.chat-list {
  overflow-y: auto;
  padding: 14px 10px;
}

.convos-label {
  padding: 0 8px 8px;
}

.convo {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.convo:hover {
  background: var(--second-soft);
}

.convo.on {
  background: var(--accent-soft);
}

.convo-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.convo-name {
  font: 500 14px var(--font-heading);
}

.convo-preview {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  color: var(--muted);
}

.convo.unread .convo-name,
.convo.unread .convo-preview {
  color: var(--text);
  font-weight: 700;
}

.convo-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.convo-time {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.convo-unread {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font: 600 11px/18px var(--font-heading);
  text-align: center;
}

.group-avatar {
  background: var(--accent-soft);
}

.group-avatar img {
  width: 70%;
  height: 70%;
}

.chat-thread {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 0;
  overflow: hidden;
}

.thread-empty {
  display: none;
}

.chat-thread.no-chat .thread-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 24px;
  text-align: center;
}

.thread-empty img {
  opacity: .8;
}

.thread-empty .panel-hint {
  max-width: 280px;
  margin: 0;
}

.chat-thread.no-chat :is(.thread-head, .messages, .composer, .composer-error) {
  display: none;
}

.thread-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}

.thread-back {
  display: none;
  border: 0;
  background: none;
  color: var(--text);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  padding: 0 6px 4px 0;
}

.thread-name {
  margin: 0;
  font: 600 16px var(--heading-font);
}

.thread-sub {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.messages-empty {
  margin: auto;
  color: var(--muted);
  text-align: center;
}

.day-divider {
  display: flex;
  justify-content: center;
  margin: 14px 0 8px;
}

.day-divider span {
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--second-soft);
  color: var(--muted);
  font: 500 12px var(--font-heading);
}

.msg {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-top: 10px;
}

.msg.grouped {
  margin-top: 2px;
}

.msg.mine {
  flex-direction: row-reverse;
}

.msg-avatar {
  flex: none;
  width: 32px;
  align-self: flex-start;
  padding-top: 18px;
}

.msg.mine .msg-avatar {
  display: none;
}

.msg-body {
  max-width: min(72%, 520px);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.msg.mine .msg-body {
  align-items: flex-end;
}

.msg-name {
  margin: 0 0 2px 4px;
  font: 500 12px var(--font-heading);
  color: var(--muted);
}

.bubble {
  padding: 8px 12px;
  border-radius: 16px 16px 16px 4px;
  background: var(--second-soft);
  color: var(--text);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.msg.mine .bubble {
  border-radius: 16px 16px 4px 16px;
  background: var(--accent);
  color: #fff;
}

.bubble.deleted,
.msg.mine .bubble.deleted {
  background: transparent;
  border: 1px dashed var(--border);
  color: var(--muted);
  font-style: italic;
}

.msg-meta {
  margin: 2px 4px 0;
  font-size: 11px;
  color: var(--muted);
}

.msg-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity .15s;
}

.msg:hover .msg-actions,
.msg:focus-within .msg-actions,
.msg-shoutout:hover .msg-actions,
.msg-shoutout:focus-within .msg-actions {
  opacity: 1;
}

@media (hover: none) {
  .msg-actions {
    opacity: 1;
  }
}

.msg-action {
  padding: 2px 8px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: 500 12px var(--font-heading);
  cursor: pointer;
}

.msg-action:hover {
  background: var(--second-soft);
  color: var(--text);
}

.msg-action.danger {
  background: #E5484D;
  color: #fff;
}

.react-picker {
  display: flex;
  gap: 2px;
  margin-top: 4px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: 0 4px 14px -6px rgba(0, 0, 0, .3);
}

.react-picker button {
  border: 0;
  border-radius: 50%;
  background: transparent;
  font-size: 18px;
  width: 32px;
  height: 32px;
  cursor: pointer;
}

.react-picker .react-more {
  color: var(--muted);
  font: 600 18px var(--font-heading);
}

.react-picker button:hover {
  background: var(--second-soft);
}

.reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.reaction {
  padding: 1px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: 500 12px var(--font-heading);
  cursor: pointer;
}

.reaction.on {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-text);
}

.msg-shoutout {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 12px 0 4px;
}

.shoutout-pill {
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--status-run-bg);
  color: var(--status-run-text);
  font: 500 13px var(--font-heading);
  text-align: center;
}

.composer {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

.composer textarea {
  flex: 1;
  min-height: 44px;
  max-height: 140px;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.4 var(--font-body);
  resize: none;
}

.composer textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.composer-error {
  min-height: 0;
  padding: 0 16px;
}

.composer-error:not(:empty) {
  padding-bottom: 10px;
}

/* custom groups */
.new-group-btn {
  width: calc(100% - 16px);
  margin: 2px 8px 12px;
  padding: 9px 12px;
  font-size: 14px;
}

.emoji-avatar {
  font-size: 1.1em;
  line-height: 1;
}

.avatar-xl.emoji-avatar {
  font-size: 52px;
}

.thread-title {
  flex: 1;
  min-width: 0;
}

.thread-title .thread-sub {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thread-settings {
  padding: 6px 12px;
  font-size: 13px;
}

.group-dialog {
  width: min(520px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .45);
}

.group-dialog::backdrop {
  background: rgba(20, 20, 25, .45);
}

.group-dialog form {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 50px);
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 12px;
}

.dialog-close {
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}

.dialog-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 4px 22px 12px;
  overflow-y: auto;
}

.dialog-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px 18px;
  border-top: 1px solid var(--border);
}

.dialog-foot .spacer {
  flex: 1;
}

.dialog-foot .btn-outline {
  padding: 11px 18px;
}

.danger-link,
:is(.app, .auth-page) .danger-link {
  color: #D64545;
}

.group-icon-row {
  display: flex;
  align-items: center;
  gap: 18px;
}

.group-icon-options {
  flex: 1;
  min-width: 0;
}

.icon-emojis {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0 10px;
}

.icon-emoji {
  width: 36px;
  height: 36px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  font-size: 18px;
  cursor: pointer;
}

.icon-emoji.on {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.member-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.member-list.pick {
  max-height: 200px;
  overflow-y: auto;
  margin-top: 6px;
}

.member-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 10px;
  font-weight: 500;
}

label.member-row {
  cursor: pointer;
}

label.member-row:hover {
  background: var(--second-soft);
}

.member-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.member-row > span:not(.avatar):not(.role-pill) {
  flex: 1;
}

.member-row small {
  color: var(--muted);
  font-weight: 400;
}

.role-pill {
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-text);
  font: 600 11px var(--font-heading);
}

:is(.app, .auth-page) .field input[type="search"] {
  padding: 9px 12px;
}

/* emoji picker */
.emoji-wrap {
  position: relative;
  flex: none;
}

.emoji-toggle {
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg);
  font-size: 20px;
  cursor: pointer;
}

.emoji-toggle:hover {
  border-color: var(--accent);
}

@media (max-width: 760px) {
  .settings-label {
    display: none;
  }
}

@media (max-width: 760px) {
  .chat-dash {
    height: calc(100vh - 76px);
  }

  .chat-dash .dash-top {
    display: none;
  }

  .chat-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .chat-layout .chat-thread,
  .chat-layout.thread-open .chat-list {
    display: none;
  }

  .chat-layout.thread-open .chat-thread {
    display: flex;
  }

  .thread-back {
    display: block;
  }

  .msg-body {
    max-width: 82%;
  }
}

/* courses */
.course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}

.course-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 10px 24px -18px rgba(0, 0, 0, .35);
  transition: transform .15s, box-shadow .15s;
}

.course-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .05), 0 16px 30px -18px rgba(0, 0, 0, .45);
}

.course-cover {
  display: block;
  height: 120px;
}

.course-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 16px 16px;
}

.course-code {
  margin: 0;
  font: 600 12px var(--font-heading);
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--accent-text);
}

.course-name {
  font: 600 17px/1.3 var(--heading-font);
}

.course-tools {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  color: var(--muted);
}

.course-tool svg,
.tool-tab svg,
.tool-empty-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.course-new {
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 230px;
  border-style: dashed;
  border-width: 2px;
  background: transparent;
  box-shadow: none;
  font: inherit;
  cursor: pointer;
}

.course-new-plus {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-text);
  font: 400 30px/1 var(--font-heading);
}

.course-preview {
  display: flex;
  align-items: flex-end;
  height: 110px;
  padding: 12px;
  border-radius: 14px;
}

.course-preview-label {
  padding: 4px 10px;
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: 600 14px var(--heading-font);
}

.cover-picker {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.cover-option {
  aspect-ratio: 1.3;
  border: 2px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08);
}

.cover-option.on {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* course page */
.back-link {
  display: inline-block;
  margin-bottom: 12px;
  color: var(--muted);
  font: 500 14px var(--font-heading);
  text-decoration: none;
}

.back-link:hover {
  color: var(--text);
}

.course-banner {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  min-height: 170px;
  padding: 20px;
  border-radius: 20px;
}

.course-banner-card {
  padding: 12px 18px;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 8px 24px -14px rgba(0, 0, 0, .4);
}

.course-banner-card .dash-title {
  margin-top: 2px;
}

.course-edit {
  align-self: flex-start;
}

.tool-tabs {
  display: flex;
  gap: 6px;
  margin: 20px 0 16px;
  overflow-x: auto;
  scrollbar-width: none;
}

.tool-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font: 500 14px var(--font-heading);
  white-space: nowrap;
  cursor: pointer;
}

.tool-tab:hover {
  color: var(--text);
}

.tool-tab.on {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.tool-panel {
  min-height: 280px;
  display: grid;
  place-items: center;
}

.tool-empty {
  max-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}

.tool-empty p {
  margin: 0;
  color: var(--muted);
}

.tool-empty-icon {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: var(--accent-soft);
  color: var(--accent-text);
}

.tool-empty-icon svg {
  width: 26px;
  height: 26px;
}

.soon-pill {
  margin-top: 6px;
  padding: 3px 12px;
  border-radius: 999px;
  background: var(--second-soft);
  color: var(--muted);
  font: 600 12px var(--font-heading);
}

@media (max-width: 640px) {
  .cover-picker {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
  }

  .course-banner {
    flex-direction: column;
    align-items: stretch;
  }

  .course-edit {
    align-self: flex-end;
    order: -1;
  }
}

/* pause and focus courses */
.timer-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.timer-actions .btn-outline {
  padding: 10px 18px;
}

.timer-panel.paused .status {
  background: var(--second-soft);
  color: var(--text);
}

.timer-panel.paused .status i {
  background: var(--glow);
  opacity: .5;
}

.timer-panel.paused .timer {
  opacity: .6;
}

.mini-folder {
  position: relative;
  flex: none;
  width: 34px;
  height: 25px;
  margin-top: 6px;
  border-radius: 2px 6px 6px 6px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08);
}

.mini-folder::before {
  content: "";
  position: absolute;
  top: -5px;
  left: 0;
  width: 45%;
  height: 6px;
  border-radius: 4px 5px 0 0;
  background: inherit;
}

.course-mini-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  text-align: left;
}

.course-mini-text strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 600 13px/1.3 var(--heading-font);
}

.course-mini-text small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  color: var(--muted);
}

.course-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 8px;
}

.course-pick {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 8px 30px 8px 10px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.course-pick:hover {
  border-color: var(--accent);
}

.course-pick.on {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.pick-check {
  position: absolute;
  top: 50%;
  right: 8px;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  color: transparent;
  font-size: 11px;
  transform: translateY(-50%);
}

.course-pick.on .pick-check {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.focus-courses {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.focus-course {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 18px;
  min-width: 0;
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--bg);
}

.focus-course-link {
  flex: 1 1 180px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--text);
  text-decoration: none;
}

.focus-course-link:hover strong {
  text-decoration: underline;
}

.focus-hours {
  flex: 1 1 140px;
  min-width: 0;
  font: 600 14px var(--heading-font);
  color: var(--number);
}

.focus-hours small {
  font: 500 12px var(--font-body);
  color: var(--muted);
}

.focus-hours .bar {
  height: 6px;
  margin-top: 6px;
}

.focus-note {
  flex: 2 1 200px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
}

.focus-note input {
  flex: none;
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  accent-color: var(--accent);
}

.focus-note span {
  overflow-wrap: anywhere;
}

.focus-note.done span {
  color: var(--muted);
  text-decoration: line-through;
}

.course-goals {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.course-goals .panel-hint {
  margin: 0;
}

.course-goal {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 84px minmax(0, 1.6fr);
  align-items: center;
  gap: 8px;
}

.course-goal-name {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

:is(.app, .auth-page) .course-goal input {
  width: 100%;
  min-width: 0;
}

.timer-course {
  order: 1;
  flex: 1 1 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--muted);
}

.timer-course[hidden] {
  display: none;
}

.timer-course select {
  flex: 1;
  min-width: 0;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font: 14px var(--font-body);
}

@media (max-width: 640px) {
  .timer-actions {
    width: 100%;
  }

  .course-goal {
    grid-template-columns: minmax(0, 1fr) 84px;
  }

  .course-goal input[data-goal-note] {
    grid-column: 1 / -1;
  }

  .timer-body {
    flex: none;
    width: 100%;
  }

  .timer-course {
    flex: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    text-align: left;
  }
}

/* folders */
.folder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 18px 16px;
  margin: 18px 0 6px;
}

.folder-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.folder-shape {
  position: relative;
  display: block;
  height: 92px;
  margin-top: 12px;
  border-radius: 4px 14px 14px 14px;
  box-shadow: 0 10px 18px -12px rgba(0, 0, 0, .45), inset 0 0 0 1px rgba(0, 0, 0, .06);
  transition: transform .15s;
}

.folder-shape::before {
  content: "";
  position: absolute;
  top: -11px;
  left: 0;
  width: 45%;
  height: 14px;
  border-radius: 10px 12px 0 0;
  background: inherit;
  background-position: 0 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25);
}

.folder-shape::after {
  content: "";
  position: absolute;
  inset: 16px 0 0;
  border-radius: 10px 10px 14px 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .28), rgba(255, 255, 255, 0) 60%);
  box-shadow: 0 -2px 6px -3px rgba(0, 0, 0, .25);
}

.folder-card:hover .folder-shape {
  transform: translateY(-3px);
}

.folder-label {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.folder-label strong {
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  font: 500 14px/1.3 var(--font-heading);
}

.folder-label small {
  color: var(--muted);
  font-size: 12px;
}

.folder-unsorted {
  background: var(--second-soft);
}

.folder-add {
  display: grid;
  place-items: center;
  border: 2px dashed var(--border);
  background: transparent;
  box-shadow: none;
}

.folder-add::before {
  top: -12px;
  left: -2px;
  border: 2px dashed var(--border);
  border-bottom: 0;
  background: transparent;
  box-shadow: none;
}

.folder-add::after {
  display: none;
}

.folder-add span {
  color: var(--accent-text);
  font: 400 32px/1 var(--font-heading);
}

.folder-new:hover .folder-add {
  border-color: var(--accent);
}

.folder-preview-row {
  display: flex;
  align-items: flex-end;
  gap: 16px;
}

.folder-preview-row .field {
  flex: 1;
}

.folder-shape-lg {
  flex: none;
  width: 96px;
  height: 70px;
  margin-top: 12px;
}

.design-picker {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.design-option {
  height: 40px;
  border: 2px solid transparent;
  border-radius: 10px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08);
  cursor: pointer;
}

.design-option.on {
  border-color: var(--text);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.topic-swatch {
  flex: none;
  width: 14px;
  height: 11px;
  border-radius: 2px 4px 4px 4px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1);
}

@media (max-width: 640px) {
  .folder-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* topics */
.course-layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.topic-rail {
  position: sticky;
  top: 20px;
  padding: 14px 10px;
}

.topic-heading {
  padding: 0 8px 8px;
}

.topic-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.topic-row {
  position: relative;
  display: flex;
  align-items: center;
  border-radius: 10px;
}

.topic-row:hover {
  background: var(--second-soft);
}

.topic-row.on {
  background: var(--accent-soft);
}

.topic-item {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.topic-row.on .topic-item {
  color: var(--accent-text);
  font-weight: 700;
}

.topic-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: inherit;
  font-family: var(--font-heading);
  font-size: 14px;
}

.topic-count {
  flex: none;
  min-width: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font: 600 12px/20px var(--font-heading);
  text-align: center;
}

.topic-tools {
  display: none;
  gap: 2px;
  padding-right: 6px;
}

.topic-row:hover .topic-tools,
.topic-row:focus-within .topic-tools {
  display: flex;
}

.topic-row:hover .topic-count,
.topic-row:focus-within .topic-count {
  display: none;
}

.topic-tools button {
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
}

.topic-tools button:hover:not(:disabled) {
  background: var(--surface);
  color: var(--text);
}

.topic-tools button:disabled {
  opacity: .3;
  cursor: default;
}

.topic-add {
  width: 100%;
  margin-top: 8px;
  padding: 9px 10px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: transparent;
  color: var(--accent-text);
  font: 500 14px var(--font-heading);
  text-align: left;
  cursor: pointer;
}

.topic-add:hover {
  border-color: var(--accent);
}

.topic-tip {
  margin: 10px 8px 0;
}

.topic-rename {
  margin-left: 6px;
  font-size: 13px;
  vertical-align: middle;
}

.note-topic {
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--second-soft);
  color: var(--muted);
  font: 500 11px var(--font-heading);
  vertical-align: middle;
}

.note-fields {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 12px;
}

:is(.app, .auth-page) .field select {
  width: 100%;
  padding: 11px 12px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font: 15px var(--font-body);
}

@media (max-width: 900px) {
  .course-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .topic-rail {
    position: static;
    padding: 10px;
  }

  .topic-list {
    flex-direction: row;
    overflow-x: auto;
    gap: 6px;
    scrollbar-width: none;
  }

  .topic-row {
    flex: none;
    border: 1px solid var(--border);
  }

  .topic-name {
    max-width: 180px;
  }

  .topic-tools {
    display: none !important;
  }

  .topic-row .topic-count {
    display: inline-block !important;
  }

  .topic-heading,
  .topic-tip {
    display: none;
  }

  .topic-add {
    width: auto;
  }
}

@media (max-width: 640px) {
  .note-fields {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* practice test */
.spinner {
  width: 44px;
  height: 44px;
  border: 4px solid var(--accent-soft);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .9s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.score-pill {
  flex: none;
  padding: 2px 10px;
  border-radius: 999px;
  font: 600 12px var(--font-heading);
  white-space: nowrap;
}

.score-pill.pass { background: #DDF1E3; color: #235C36; }
.score-pill.fail { background: #FBE3E3; color: #8A2626; }

.test-take,
.test-results {
  max-width: 820px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.test-results > .back-link,
.test-take .back-link {
  align-self: flex-start;
  margin: 0;
}

.test-questions {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.test-question {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--bg);
}

.test-q-head {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}

.test-num {
  flex: none;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-text);
  font: 600 14px var(--font-heading);
}

.test-q-text {
  margin: 6px 0 0;
  font: 500 16px/1.45 var(--heading-font);
  overflow-wrap: anywhere;
}

.test-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding-left: 42px;
}

.tf-row {
  grid-template-columns: repeat(2, minmax(0, 160px));
}

.test-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  overflow-wrap: anywhere;
  cursor: pointer;
}

.test-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.test-option:hover {
  border-color: var(--accent);
}

.test-option.on {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.test-option.on .option-key {
  background: var(--accent);
  color: #fff;
}

.test-option:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.test-short {
  width: calc(100% - 42px);
  margin-left: 42px;
}

.test-submit {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.test-submit .form-message {
  min-height: 0;
  margin: 0;
}

.result-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 24px;
  padding: 20px;
  border-radius: 18px;
  background: var(--bg);
}

.result-hero .generate-actions {
  margin-top: 12px;
}

.result-score {
  flex: none;
  width: 120px;
  height: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 8px solid;
}

.result-score strong {
  font: 700 30px/1 var(--heading-font);
}

.result-score span {
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted);
}

.result-score.pass { border-color: #7CC495; color: #235C36; }
.result-score.fail { border-color: #EBA3A3; color: #8A2626; }

.test-question.review.good {
  border-color: #A9D9B7;
}

.test-question.review.good .test-num {
  background: #2F8A4F;
  color: #fff;
}

.test-question.review.bad {
  border-color: #EDB5B5;
}

.test-question.review.bad .test-num {
  background: #D64545;
  color: #fff;
}

.review-lines {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-left: 42px;
  overflow-wrap: anywhere;
}

.review-lines p {
  margin: 0;
}

.review-lines .panel-label {
  display: inline;
  margin-right: 6px;
  font-size: 13px;
}

.explanation {
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--accent-soft);
}

.review-lines .link-btn {
  align-self: flex-start;
}

/* study guide */
.guide-meta {
  margin: 4px 0 0;
}

.guide-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 14px 0 4px;
}

.guide-toc a {
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  font: 500 13px var(--font-heading);
  text-decoration: none;
}

.guide-toc a:hover {
  border-color: var(--accent);
  color: var(--accent-text);
}

.guide-prose {
  max-width: 76ch;
}

.guide-prose h2 {
  scroll-margin-top: 16px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.guide-stale {
  margin-top: 8px;
  opacity: .45;
  pointer-events: none;
}

@media (max-width: 640px) {
  .test-options,
  .tf-row {
    grid-template-columns: minmax(0, 1fr);
    padding-left: 0;
  }

  .test-short {
    width: 100%;
    margin-left: 0;
  }

  .review-lines {
    padding-left: 0;
  }

  .result-hero {
    justify-content: center;
    text-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation-duration: 3s;
  }
}

/* smart study */
.smart {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.smart-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.smart-top .back-link {
  margin: 0;
}

.smart-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip-stat {
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--second-soft);
  color: var(--muted);
  font: 600 12px var(--font-heading);
}

.type-pill {
  align-self: flex-start;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-text);
  font: 600 12px var(--font-heading);
  letter-spacing: .02em;
}

.smart-q {
  margin: 0;
  font: 600 clamp(18px, 2.2vw, 22px)/1.35 var(--heading-font);
  overflow-wrap: anywhere;
}

.mcq-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.mcq-option {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 12px 16px;
  border: 1.5px solid transparent;
  border-radius: 12px;
  background: var(--second-soft);
  color: var(--text);
  font: 500 15px/1.4 var(--font-body);
  text-align: left;
  overflow-wrap: anywhere;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}

.mcq-option:hover:not(:disabled) {
  border-color: var(--accent);
}

.option-key {
  flex: none;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  font: 600 13px var(--font-heading);
}

.mcq-option.right {
  border-color: #3E9B5F;
  background: #CDEFD7;
  color: #1E4D2E;
}

.mcq-option.right .option-key {
  background: #2F8A4F;
  color: #fff;
}

.mcq-option.wrong {
  border-color: #D64545;
  background: #F9DCDC;
  color: #6B1F1F;
}

.mcq-option.wrong .option-key {
  background: #D64545;
  color: #fff;
}

.mcq-option.faded {
  opacity: .55;
}

.mcq-option:disabled {
  cursor: default;
}

.tf-statement {
  padding: 14px 16px;
  border-left: 3px solid var(--accent);
  border-radius: 0 12px 12px 0;
  background: var(--bg);
}

.tf-statement .panel-label {
  margin-bottom: 4px;
}

.tf-answer {
  margin: 0;
  font: 500 16px/1.5 var(--font-body);
  overflow-wrap: anywhere;
}

.match-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.match-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.match-item {
  min-height: 52px;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font: 500 14px/1.4 var(--font-body);
  text-align: left;
  overflow-wrap: anywhere;
  cursor: pointer;
}

.match-item:hover:not(:disabled) {
  border-color: var(--accent);
}

.match-item.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.match-item.matched {
  border-color: #3E9B5F;
  background: #CDEFD7;
  color: #1E4D2E;
  cursor: default;
}

.match-item.wrong {
  border-color: #D64545;
  background: #F9DCDC;
  color: #6B1F1F;
  animation: shake .3s;
}

@keyframes shake {
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.match-hint {
  margin: 0;
}

.type-form {
  display: flex;
  gap: 10px;
}

.type-input {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font: 16px var(--font-body);
}

.type-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.smart-feedback {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 14px;
}

.smart-feedback strong {
  font: 600 16px var(--font-heading);
}

.smart-feedback p {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
}

.smart-feedback.good {
  background: #E3F4E8;
  color: #1E4D2E;
}

.smart-feedback.bad {
  background: #FBE7E7;
  color: #6B1F1F;
}

.smart-feedback .panel-label {
  display: inline;
  color: inherit;
  opacity: .8;
}

.smart-feedback .link-btn {
  margin-top: 4px;
  color: inherit;
}

.smart-feedback kbd {
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, .22);
  font: 600 11px var(--font-heading);
}

.smart-foot {
  display: flex;
  justify-content: flex-start;
}

.smart-foot .btn-outline {
  padding: 8px 14px;
}

.smart-history {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.smart-history li {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bg);
  overflow-wrap: anywhere;
}

.history-mark {
  flex: none;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  font-size: 12px;
}

.smart-history li.good .history-mark { background: #2F8A4F; }
.smart-history li.bad .history-mark { background: #D64545; }

.smart-empty {
  margin: 20px auto;
}

.struggled {
  width: min(520px, 100%);
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--bg);
  text-align: left;
}

.struggled ul {
  margin: 8px 0 0;
  padding-left: 1.2em;
}

.struggled li + li {
  margin-top: 6px;
}

.struggled strong {
  display: block;
}

@media (max-width: 640px) {
  .mcq-grid,
  .match-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .match-grid {
    gap: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .match-item.wrong {
    animation: none;
  }
}

/* flashcards */
.deck-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 32px;
  margin-bottom: 16px;
}

.deck-stats div {
  display: flex;
  flex-direction: column;
}

.deck-stats strong {
  font: 600 28px/1.1 var(--heading-font);
  color: var(--number);
}

.deck-stats span {
  font-size: 13px;
  color: var(--muted);
}

.card-list {
  display: flex;
  flex-direction: column;
  margin-top: 12px;
}

.card-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.card-row + .card-row {
  border-top-color: var(--border);
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

.card-row:hover {
  border-color: var(--border);
  background: var(--second-soft);
}

.card-row-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.card-front-text {
  font: 500 15px var(--font-heading);
  overflow-wrap: anywhere;
}

.card-back-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  color: var(--muted);
}

.due-pill {
  flex: none;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--second-soft);
  color: var(--muted);
  font: 600 12px var(--font-heading);
  white-space: nowrap;
}

.due-pill.due {
  background: var(--status-run-bg);
  color: var(--status-run-text);
}

.due-pill.new {
  background: var(--accent-soft);
  color: var(--accent-text);
}

.card-dialog .dialog-body {
  gap: 14px;
}

.card-mode {
  align-self: flex-start;
}

#mode-one {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

#mode-one[hidden] {
  display: none;
}

.card-textarea {
  min-height: 90px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font-body);
  resize: vertical;
}

.card-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.card-bulk {
  min-height: 220px;
}

/* study mode */
.study {
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.study-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.study-top .back-link {
  margin: 0;
}

.study-bar {
  margin-top: 0;
}

.flashcard {
  width: 100%;
  min-height: 280px;
  padding: 0;
  border: 0;
  background: none;
  perspective: 1400px;
  cursor: pointer;
}

.flashcard-inner {
  position: relative;
  display: grid;
  min-height: 280px;
  transform-style: preserve-3d;
  transition: transform .45s ease;
}

.flashcard.flipped .flashcard-inner {
  transform: rotateY(180deg);
}

.flashcard-face {
  grid-area: 1 / 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 32px 28px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 18px 40px -26px rgba(0, 0, 0, .45);
  backface-visibility: hidden;
  text-align: center;
}

.flashcard-back {
  transform: rotateY(180deg);
  background:
    linear-gradient(var(--accent-soft), var(--accent-soft)) top / 100% 6px no-repeat,
    var(--surface);
}

.face-label {
  font: 600 12px var(--font-heading);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}

.face-text {
  font: 500 clamp(18px, 2.4vw, 24px)/1.4 var(--heading-font);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.flip-btn {
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.flip-btn kbd {
  padding: 1px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, .22);
  font: 600 11px var(--font-heading);
}

.grade-buttons {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.grade-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 6px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.grade-btn strong {
  font: 600 15px var(--font-heading);
}

.grade-btn span {
  font-size: 12px;
  color: var(--muted);
}

.grade-again strong { color: #D64545; }
.grade-hard strong { color: #C0842A; }
.grade-good strong { color: var(--accent-text); }
.grade-easy strong { color: var(--second); }

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

.study-done {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 24px 0;
  text-align: center;
}

@media (max-width: 640px) {
  .grade-buttons {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .flashcard,
  .flashcard-inner {
    min-height: 220px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .flashcard-inner {
    transition: none;
  }
}

/* summary */
.generate-card {
  margin: 18px 0 8px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--bg);
}

.generate-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.generate-top .soon-pill {
  margin-top: 0;
  flex: none;
}

.generate-title {
  margin: 0;
  font: 600 17px/1.3 var(--heading-font);
}

.generate-top .panel-hint {
  margin-top: 4px;
}

.generate-options {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 28px;
  margin: 16px 0;
}

.generate-options .panel-label {
  margin-bottom: 6px;
  font-size: 13px;
}

.generate-options .chips {
  margin-bottom: 0;
}

.generate-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.generate-actions .btn-outline {
  padding: 11px 18px;
}

.generate-card .form-message {
  min-height: 0;
  margin-top: 10px;
  color: var(--muted);
}

.link-reset {
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

.summary-view-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.summary-view-head .notes-actions .btn-outline {
  padding: 8px 14px;
}

.danger-outline {
  color: #D64545;
}

.summary-view .form-message {
  min-height: 0;
  margin: 8px 0 0;
}

.prose {
  max-width: 72ch;
  padding-top: 8px;
  color: var(--text);
  font-size: 16px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.prose h1,
.prose h2,
.prose h3 {
  margin: 1.4em 0 .4em;
  font-family: var(--heading-font);
  line-height: 1.3;
}

.prose h1 { font-size: 24px; }
.prose h2 { font-size: 20px; }
.prose h3 { font-size: 17px; }

.prose p,
.prose ul,
.prose ol {
  margin: .6em 0;
}

.prose ul,
.prose ol {
  padding-left: 1.4em;
}

.prose li + li {
  margin-top: .25em;
}

.prose strong {
  color: var(--number);
}

.prose blockquote {
  margin: 1em 0;
  padding: 8px 14px;
  border-left: 3px solid var(--accent);
  border-radius: 0 10px 10px 0;
  background: var(--accent-soft);
}

.prose code {
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--second-soft);
  font-size: .9em;
}

.prose table {
  display: block;
  overflow-x: auto;
  border-collapse: collapse;
}

.prose th,
.prose td {
  padding: 6px 10px;
  border: 1px solid var(--border);
}

/* notes & files */
.tool-panel-filled {
  display: block;
  place-items: normal;
  min-height: 0;
}

.notes-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.notes-head .panel-hint {
  max-width: 52ch;
  margin-top: 4px;
}

.notes-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.notes-actions .btn-outline {
  padding: 11px 18px;
}

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin: 18px 0 8px;
  padding: 22px;
  border: 2px dashed var(--border);
  border-radius: 14px;
  color: var(--muted);
  text-align: center;
  transition: border-color .15s, background .15s;
}

.dropzone strong {
  color: var(--text);
  font: 500 15px var(--font-heading);
}

.dropzone.over {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.upload-status {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0 0 8px;
  padding: 0;
  list-style: none;
}

.upload-status li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 12px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--second-soft);
  font-size: 14px;
}

.upload-name {
  font-weight: 700;
  overflow-wrap: anywhere;
}

.upload-status li.done .upload-state {
  color: var(--accent-text);
}

.upload-status li.failed .upload-state {
  color: #D64545;
}

.notes-total {
  margin: 16px 0 8px;
}

.notes-empty {
  margin-top: 18px;
  padding: 28px;
  border-radius: 14px;
  background: var(--second-soft);
  text-align: center;
}

.notes-empty p {
  margin: 0;
}

.note-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.note-item + .note-item {
  border-top-color: var(--border);
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

.note-item:hover {
  border-color: var(--border);
  background: var(--second-soft);
}

.note-badge {
  flex: none;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent-text);
  font: 700 12px var(--font-heading);
}

.badge-pdf { background: #F9DEDC; color: #B3261E; }
.badge-pptx { background: #FCE3CF; color: #B4531A; }
.badge-docx { background: #DCE6F7; color: #2B579A; }

.note-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.note-title {
  font: 500 15px var(--font-heading);
}

.note-preview {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  color: var(--muted);
}

.note-meta {
  flex: none;
  font-size: 12px;
  color: var(--muted);
  text-align: right;
}

.note-dialog {
  width: min(760px, calc(100vw - 32px));
}

.note-textarea {
  min-height: 320px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--font-body);
  resize: vertical;
}

.note-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

@media (max-width: 640px) {
  .note-meta {
    display: none;
  }

  .dropzone {
    display: none;
  }
}

/* login, sign up, reset and welcome */
body.auth-page {
  min-height: 100vh;
  margin: 0;
  display: grid;
  place-items: center;
  padding: 32px 16px;
  background: var(--bg);
  color: var(--text);
}

.auth-shell {
  width: min(960px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, .35);
}

.auth-shell-wide {
  width: min(1040px, 100%);
  grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr);
}

.auth-hero {
  position: relative;
  overflow: hidden;
  min-height: 540px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 32px;
  padding: 40px;
  background: var(--banner);
  color: #fff;
}

.auth-brand,
.auth-hero-text,
.auth-points,
.step-dots {
  position: relative;
  z-index: 1;
}

.auth-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font: 600 22px var(--heading-font);
  text-decoration: none;
}

.auth-brand img {
  width: 40px;
  height: 40px;
  padding: 4px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .85);
}

.auth-hero h1 {
  margin: 0;
  font: 600 clamp(28px, 3.4vw, 40px)/1.15 var(--heading-font);
  letter-spacing: -.01em;
}

.auth-hero p {
  max-width: 36ch;
  margin: 12px 0 0;
  color: rgba(255, 255, 255, .85);
}

.auth-points {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.auth-points li {
  display: flex;
  align-items: center;
  gap: 10px;
}

.auth-points li::before {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #FFF1B8;
  box-shadow: 0 0 8px 3px rgba(255, 215, 122, .6);
}

.step-dots {
  display: flex;
  gap: 6px;
}

.step-dots span {
  width: 28px;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .35);
}

.step-dots span.on {
  background: #fff;
}

.auth-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 40px;
  overflow-y: auto;
}

.auth-shell-wide .auth-card {
  justify-content: flex-start;
  max-height: calc(100vh - 64px);
}

.auth-title {
  margin: 0;
  font: 600 26px/1.2 var(--heading-font);
}

.auth-sub {
  margin: 6px 0 20px;
  color: var(--muted);
}

.auth-page .switch {
  background: var(--second-soft);
}

.auth-page .switch-btn {
  color: var(--muted);
}

.auth-page .switch-btn.on {
  background: var(--surface);
  color: var(--text);
}

.auth-page .show-btn {
  color: var(--accent-text);
}

.auth-page .form-message {
  color: #D64545;
}

.auth-page .step-label {
  margin: 0 0 6px;
  color: var(--accent-text);
}

.auth-page .hint {
  color: var(--muted);
}

.auth-link {
  align-self: flex-end;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent-text);
  font: 600 14px var(--font-body);
  cursor: pointer;
}

.auth-link:hover {
  text-decoration: underline;
}

.auth-back {
  align-self: flex-start;
  margin-top: 16px;
}

.btn-link-block {
  display: block;
  text-align: center;
  text-decoration: none;
}

@media (max-width: 760px) {
  body.auth-page {
    place-items: start center;
    padding: 16px;
  }

  .auth-shell,
  .auth-shell-wide {
    grid-template-columns: minmax(0, 1fr);
  }

  .auth-hero {
    min-height: 0;
    gap: 16px;
    padding: 24px;
  }

  .auth-points {
    display: none;
  }

  .auth-card {
    padding: 28px 22px;
  }

  .auth-shell-wide .auth-card {
    max-height: none;
  }
}

/* forms inside the app follow the theme */
:is(.app, .auth-page) .field {
  color: var(--text);
}

:is(.app, .auth-page) .field input,
:is(.app, .auth-page) .tag-add input {
  border-color: var(--border);
  background: var(--bg);
  color: var(--text);
}

:is(.app, .auth-page) .field input:focus,
:is(.app, .auth-page) .tag-add input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

:is(.app, .auth-page) .chip {
  border-color: var(--border);
  background: var(--surface);
  color: var(--text);
}

:is(.app, .auth-page) .chip.on {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

:is(.app, .auth-page) .tag button {
  color: var(--accent-text);
}

:is(.app, .auth-page) .btn-soft {
  background: var(--accent-soft);
  color: var(--accent-text);
}

:is(.app, .auth-page) .toggle {
  color: var(--text);
}

:is(.app, .auth-page) .toggle input {
  accent-color: var(--accent);
}

:is(.app, .auth-page) .btn-primary {
  background: var(--accent);
}

:is(.app, .auth-page) .btn-primary:hover {
  background: var(--accent-hover);
}

:is(.app, .auth-page) .form-message.ok {
  color: var(--accent-text);
}

@media (max-width: 900px) {
  .dash-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 640px) {
  body.app {
    grid-template-columns: minmax(0, 1fr);
    padding-bottom: 76px;
  }

  .sidebar {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10;
    height: auto;
    flex-direction: row;
    justify-content: space-around;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
  }

  .side-logo {
    display: none;
  }

  .side-nav {
    flex: 1;
    flex-direction: row;
    justify-content: space-around;
    gap: 2px;
  }

  .side-link {
    width: auto;
    min-width: 52px;
    padding: 7px 4px;
    font-size: 11px;
  }

  .side-me {
    margin-top: 0;
  }

  .dash {
    grid-column: 1;
    padding: 20px 16px 32px;
  }

  .banner {
    flex-direction: column;
    align-items: flex-start;
  }

  .banner-stat {
    text-align: left;
  }

  .timer-panel {
    flex-direction: column;
    text-align: center;
  }

  .stats {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  .dot.studying,
  .timer-panel.running .status i {
    animation: none;
  }
}

/* firefly cursor, glow colour follows the theme */
:root,
:root[data-theme="meadow"] {
  --firefly-cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cdefs%3E%3CradialGradient id='g'%3E%3Cstop offset='0' stop-color='%23F3D77A' stop-opacity='.95'/%3E%3Cstop offset='.45' stop-color='%23F3D77A' stop-opacity='.5'/%3E%3Cstop offset='1' stop-color='%23F3D77A' stop-opacity='0'/%3E%3C/radialGradient%3E%3C/defs%3E%3Ccircle cx='17' cy='17' r='12' fill='url(%23g)'/%3E%3Cg transform='rotate(-45 12 12)'%3E%3Cellipse cx='8.2' cy='10.5' rx='3.6' ry='2.2' fill='%23DCE4F5' stroke='white' stroke-width='.6' opacity='.95'/%3E%3Cellipse cx='15.8' cy='10.5' rx='3.6' ry='2.2' fill='%23DCE4F5' stroke='white' stroke-width='.6' opacity='.95'/%3E%3Cellipse cx='12' cy='12.5' rx='2.8' ry='4.6' fill='%23243B5A' stroke='white' stroke-width='1'/%3E%3Ccircle cx='12' cy='6.6' r='2.2' fill='%23243B5A' stroke='white' stroke-width='1'/%3E%3Ccircle cx='12' cy='17.6' r='2.6' fill='%23F3D77A' stroke='white' stroke-width='.7'/%3E%3C/g%3E%3C/svg%3E") 7 7, auto;
}

:root[data-theme="ember"] {
  --firefly-cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cdefs%3E%3CradialGradient id='g'%3E%3Cstop offset='0' stop-color='%23FFB054' stop-opacity='.95'/%3E%3Cstop offset='.45' stop-color='%23FFB054' stop-opacity='.5'/%3E%3Cstop offset='1' stop-color='%23FFB054' stop-opacity='0'/%3E%3C/radialGradient%3E%3C/defs%3E%3Ccircle cx='17' cy='17' r='12' fill='url(%23g)'/%3E%3Cg transform='rotate(-45 12 12)'%3E%3Cellipse cx='8.2' cy='10.5' rx='3.6' ry='2.2' fill='%23DCE4F5' stroke='white' stroke-width='.6' opacity='.95'/%3E%3Cellipse cx='15.8' cy='10.5' rx='3.6' ry='2.2' fill='%23DCE4F5' stroke='white' stroke-width='.6' opacity='.95'/%3E%3Cellipse cx='12' cy='12.5' rx='2.8' ry='4.6' fill='%233A0E10' stroke='white' stroke-width='1'/%3E%3Ccircle cx='12' cy='6.6' r='2.2' fill='%233A0E10' stroke='white' stroke-width='1'/%3E%3Ccircle cx='12' cy='17.6' r='2.6' fill='%23FFB054' stroke='white' stroke-width='.7'/%3E%3C/g%3E%3C/svg%3E") 7 7, auto;
}

:root[data-theme="pumpkin"] {
  --firefly-cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cdefs%3E%3CradialGradient id='g'%3E%3Cstop offset='0' stop-color='%23FFC76B' stop-opacity='.95'/%3E%3Cstop offset='.45' stop-color='%23FFC76B' stop-opacity='.5'/%3E%3Cstop offset='1' stop-color='%23FFC76B' stop-opacity='0'/%3E%3C/radialGradient%3E%3C/defs%3E%3Ccircle cx='17' cy='17' r='12' fill='url(%23g)'/%3E%3Cg transform='rotate(-45 12 12)'%3E%3Cellipse cx='8.2' cy='10.5' rx='3.6' ry='2.2' fill='%23DCE4F5' stroke='white' stroke-width='.6' opacity='.95'/%3E%3Cellipse cx='15.8' cy='10.5' rx='3.6' ry='2.2' fill='%23DCE4F5' stroke='white' stroke-width='.6' opacity='.95'/%3E%3Cellipse cx='12' cy='12.5' rx='2.8' ry='4.6' fill='%236B3F22' stroke='white' stroke-width='1'/%3E%3Ccircle cx='12' cy='6.6' r='2.2' fill='%236B3F22' stroke='white' stroke-width='1'/%3E%3Ccircle cx='12' cy='17.6' r='2.6' fill='%23FFC76B' stroke='white' stroke-width='.7'/%3E%3C/g%3E%3C/svg%3E") 7 7, auto;
}

:root[data-theme="pink"] {
  --firefly-cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cdefs%3E%3CradialGradient id='g'%3E%3Cstop offset='0' stop-color='%23FF7FB6' stop-opacity='.95'/%3E%3Cstop offset='.45' stop-color='%23FF7FB6' stop-opacity='.5'/%3E%3Cstop offset='1' stop-color='%23FF7FB6' stop-opacity='0'/%3E%3C/radialGradient%3E%3C/defs%3E%3Ccircle cx='17' cy='17' r='12' fill='url(%23g)'/%3E%3Cg transform='rotate(-45 12 12)'%3E%3Cellipse cx='8.2' cy='10.5' rx='3.6' ry='2.2' fill='%23DCE4F5' stroke='white' stroke-width='.6' opacity='.95'/%3E%3Cellipse cx='15.8' cy='10.5' rx='3.6' ry='2.2' fill='%23DCE4F5' stroke='white' stroke-width='.6' opacity='.95'/%3E%3Cellipse cx='12' cy='12.5' rx='2.8' ry='4.6' fill='%232F3C57' stroke='white' stroke-width='1'/%3E%3Ccircle cx='12' cy='6.6' r='2.2' fill='%232F3C57' stroke='white' stroke-width='1'/%3E%3Ccircle cx='12' cy='17.6' r='2.6' fill='%23FF7FB6' stroke='white' stroke-width='.7'/%3E%3C/g%3E%3C/svg%3E") 7 7, auto;
}

:root[data-theme="cherry"] {
  --firefly-cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cdefs%3E%3CradialGradient id='g'%3E%3Cstop offset='0' stop-color='%23FF4D5E' stop-opacity='.95'/%3E%3Cstop offset='.45' stop-color='%23FF4D5E' stop-opacity='.5'/%3E%3Cstop offset='1' stop-color='%23FF4D5E' stop-opacity='0'/%3E%3C/radialGradient%3E%3C/defs%3E%3Ccircle cx='17' cy='17' r='12' fill='url(%23g)'/%3E%3Cg transform='rotate(-45 12 12)'%3E%3Cellipse cx='8.2' cy='10.5' rx='3.6' ry='2.2' fill='%23DCE4F5' stroke='white' stroke-width='.6' opacity='.95'/%3E%3Cellipse cx='15.8' cy='10.5' rx='3.6' ry='2.2' fill='%23DCE4F5' stroke='white' stroke-width='.6' opacity='.95'/%3E%3Cellipse cx='12' cy='12.5' rx='2.8' ry='4.6' fill='%230E0E10' stroke='white' stroke-width='1'/%3E%3Ccircle cx='12' cy='6.6' r='2.2' fill='%230E0E10' stroke='white' stroke-width='1'/%3E%3Ccircle cx='12' cy='17.6' r='2.6' fill='%23FF4D5E' stroke='white' stroke-width='.7'/%3E%3C/g%3E%3C/svg%3E") 7 7, auto;
}

:root[data-theme="retro"] {
  --firefly-cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cdefs%3E%3CradialGradient id='g'%3E%3Cstop offset='0' stop-color='%23F6D97A' stop-opacity='.95'/%3E%3Cstop offset='.45' stop-color='%23F6D97A' stop-opacity='.5'/%3E%3Cstop offset='1' stop-color='%23F6D97A' stop-opacity='0'/%3E%3C/radialGradient%3E%3C/defs%3E%3Ccircle cx='17' cy='17' r='12' fill='url(%23g)'/%3E%3Cg transform='rotate(-45 12 12)'%3E%3Cellipse cx='8.2' cy='10.5' rx='3.6' ry='2.2' fill='%23DCE4F5' stroke='white' stroke-width='.6' opacity='.95'/%3E%3Cellipse cx='15.8' cy='10.5' rx='3.6' ry='2.2' fill='%23DCE4F5' stroke='white' stroke-width='.6' opacity='.95'/%3E%3Cellipse cx='12' cy='12.5' rx='2.8' ry='4.6' fill='%235A3A2E' stroke='white' stroke-width='1'/%3E%3Ccircle cx='12' cy='6.6' r='2.2' fill='%235A3A2E' stroke='white' stroke-width='1'/%3E%3Ccircle cx='12' cy='17.6' r='2.6' fill='%23F6D97A' stroke='white' stroke-width='.7'/%3E%3C/g%3E%3C/svg%3E") 7 7, auto;
}

@media (hover: hover) and (pointer: fine) {
  body.app,
  body.app *,
  body.auth-page,
  body.auth-page *,
  body.shell,
  body.shell * {
    cursor: var(--firefly-cursor) !important;
  }

  body.app :is(input:not([type="checkbox"], [type="radio"], [type="file"]), textarea, [contenteditable="true"]),
  body.auth-page :is(input:not([type="checkbox"], [type="radio"], [type="file"]), textarea, [contenteditable="true"]),
  body.shell input:not([type="range"]) {
    cursor: text !important;
  }
}

/* study group updates and new chats */
.new-chat-row {
  display: flex;
  gap: 8px;
  margin: 2px 8px 12px;
}

.new-chat-row .new-group-btn {
  flex: 1;
  width: auto;
  margin: 0;
  white-space: nowrap;
}

.chat-thread.feed-only :is(.composer, .composer-error) {
  display: none;
}

.chat-dialog .dialog-body {
  padding-bottom: 20px;
}

.chat-dialog .member-list.pick {
  max-height: 320px;
}

.friend-pick {
  width: 100%;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}

.friend-pick:hover {
  background: var(--second-soft);
}

.timer-body .status {
  max-width: 100%;
}

.timer-body .status > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* firefly cursor for the newer themes */
:root[data-theme="ocean"] {
  --firefly-cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cdefs%3E%3CradialGradient id='g'%3E%3Cstop offset='0' stop-color='%237FE8DA' stop-opacity='.95'/%3E%3Cstop offset='.45' stop-color='%237FE8DA' stop-opacity='.5'/%3E%3Cstop offset='1' stop-color='%237FE8DA' stop-opacity='0'/%3E%3C/radialGradient%3E%3C/defs%3E%3Ccircle cx='17' cy='17' r='12' fill='url(%23g)'/%3E%3Cg transform='rotate(-45 12 12)'%3E%3Cellipse cx='8.2' cy='10.5' rx='3.6' ry='2.2' fill='%23DCE4F5' stroke='white' stroke-width='.6' opacity='.95'/%3E%3Cellipse cx='15.8' cy='10.5' rx='3.6' ry='2.2' fill='%23DCE4F5' stroke='white' stroke-width='.6' opacity='.95'/%3E%3Cellipse cx='12' cy='12.5' rx='2.8' ry='4.6' fill='%230E3F57' stroke='white' stroke-width='1'/%3E%3Ccircle cx='12' cy='6.6' r='2.2' fill='%230E3F57' stroke='white' stroke-width='1'/%3E%3Ccircle cx='12' cy='17.6' r='2.6' fill='%237FE8DA' stroke='white' stroke-width='.7'/%3E%3C/g%3E%3C/svg%3E") 7 7, auto;
}

:root[data-theme="aurora"] {
  --firefly-cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cdefs%3E%3CradialGradient id='g'%3E%3Cstop offset='0' stop-color='%239CFFD9' stop-opacity='.95'/%3E%3Cstop offset='.45' stop-color='%239CFFD9' stop-opacity='.5'/%3E%3Cstop offset='1' stop-color='%239CFFD9' stop-opacity='0'/%3E%3C/radialGradient%3E%3C/defs%3E%3Ccircle cx='17' cy='17' r='12' fill='url(%23g)'/%3E%3Cg transform='rotate(-45 12 12)'%3E%3Cellipse cx='8.2' cy='10.5' rx='3.6' ry='2.2' fill='%23DCE4F5' stroke='white' stroke-width='.6' opacity='.95'/%3E%3Cellipse cx='15.8' cy='10.5' rx='3.6' ry='2.2' fill='%23DCE4F5' stroke='white' stroke-width='.6' opacity='.95'/%3E%3Cellipse cx='12' cy='12.5' rx='2.8' ry='4.6' fill='%231B1650' stroke='white' stroke-width='1'/%3E%3Ccircle cx='12' cy='6.6' r='2.2' fill='%231B1650' stroke='white' stroke-width='1'/%3E%3Ccircle cx='12' cy='17.6' r='2.6' fill='%239CFFD9' stroke='white' stroke-width='.7'/%3E%3C/g%3E%3C/svg%3E") 7 7, auto;
}

:root[data-theme="sunflower"] {
  --firefly-cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cdefs%3E%3CradialGradient id='g'%3E%3Cstop offset='0' stop-color='%23FFD84D' stop-opacity='.95'/%3E%3Cstop offset='.45' stop-color='%23FFD84D' stop-opacity='.5'/%3E%3Cstop offset='1' stop-color='%23FFD84D' stop-opacity='0'/%3E%3C/radialGradient%3E%3C/defs%3E%3Ccircle cx='17' cy='17' r='12' fill='url(%23g)'/%3E%3Cg transform='rotate(-45 12 12)'%3E%3Cellipse cx='8.2' cy='10.5' rx='3.6' ry='2.2' fill='%23DCE4F5' stroke='white' stroke-width='.6' opacity='.95'/%3E%3Cellipse cx='15.8' cy='10.5' rx='3.6' ry='2.2' fill='%23DCE4F5' stroke='white' stroke-width='.6' opacity='.95'/%3E%3Cellipse cx='12' cy='12.5' rx='2.8' ry='4.6' fill='%235B3A12' stroke='white' stroke-width='1'/%3E%3Ccircle cx='12' cy='6.6' r='2.2' fill='%235B3A12' stroke='white' stroke-width='1'/%3E%3Ccircle cx='12' cy='17.6' r='2.6' fill='%23FFD84D' stroke='white' stroke-width='.7'/%3E%3C/g%3E%3C/svg%3E") 7 7, auto;
}

/* study glow grid */
.streak-panel {
  flex-wrap: wrap;
}

.streak-grid {
  flex: 1 1 100%;
  min-width: 0;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.glow-panel {
  margin-bottom: 20px;
}

.grid-summary {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--muted);
}

.grid-summary strong {
  color: var(--text);
  font-weight: 600;
}

.grid-scroll {
  overflow-x: auto;
  padding: 2px 2px 4px;
}

.study-grid {
  --cell: 13px;
  --gap: 3px;
  display: grid;
  grid-template-columns: auto max-content;
  gap: 4px 6px;
  width: max-content;
}

.grid-months {
  grid-column: 2;
  display: grid;
  grid-template-columns: repeat(var(--weeks), var(--cell));
  column-gap: var(--gap);
  height: 13px;
  font-size: 10px;
  line-height: 13px;
  color: var(--muted);
}

.grid-months span {
  white-space: nowrap;
}

.grid-weekdays {
  grid-column: 1;
  grid-row: 2;
  display: grid;
  grid-template-rows: repeat(7, var(--cell));
  row-gap: var(--gap);
  font-size: 10px;
  line-height: var(--cell);
  color: var(--muted);
}

.grid-cells {
  grid-column: 2;
  grid-row: 2;
  display: grid;
  grid-template-rows: repeat(7, var(--cell));
  grid-auto-flow: column;
  grid-auto-columns: var(--cell);
  gap: var(--gap);
}

.g-cell {
  position: relative;
  display: block;
  width: var(--cell, 10px);
  height: var(--cell, 10px);
  border-radius: 3px;
  background: var(--ring-track);
}

.g-1 { background: color-mix(in srgb, var(--ring) 35%, var(--ring-track)); }
.g-2 { background: color-mix(in srgb, var(--ring) 58%, var(--ring-track)); }
.g-3 { background: color-mix(in srgb, var(--ring) 80%, var(--ring-track)); }

.g-4 {
  background: var(--ring);
  box-shadow: 0 0 6px color-mix(in srgb, var(--glow) 70%, transparent);
}

.g-future {
  background: transparent;
}

.g-today {
  outline: 1.5px solid var(--number);
  outline-offset: 1px;
}

.grid-cells .g-cell[data-label]:hover {
  outline: 1.5px solid var(--text);
  outline-offset: 1px;
}

.g-best::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 5px;
  height: 5px;
  margin: -2.5px 0 0 -2.5px;
  border-radius: 50%;
  background: var(--glow);
  box-shadow: 0 0 4px 2px var(--glow);
  animation: grid-firefly 2.4s ease-in-out infinite;
}

@keyframes grid-firefly {
  0%, 100% { opacity: 1; }
  50% { opacity: .45; }
}

.grid-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 12px;
  margin-top: 8px;
  font-size: 11.5px;
  color: var(--muted);
}

.grid-legend {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

/* calendar */
.kind-test { --kind: var(--accent); }
.kind-exam { --kind: #E0564B; }
.kind-assignment { --kind: var(--second); }
.kind-other { --kind: var(--muted); }

.cal-add.btn-small {
  margin-top: 0;
  padding: 6px 12px;
}

.cal-countdown {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--text);
  font-size: 14px;
}

.cal-countdown-days {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 44px;
  font: 600 22px/1 var(--heading-font);
  color: var(--kind);
}

.cal-countdown-days small {
  margin-top: 3px;
  font: 500 11px var(--font-body);
  color: var(--muted);
}

.cal-countdown strong {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.cal-countdown small {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 14px 0 6px;
  font: 600 14px var(--heading-font);
  color: var(--text);
}

.cal-nav {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--text);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.cal-nav:hover {
  background: var(--second-soft);
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 2px;
  text-align: center;
}

.cal-weekday {
  padding: 2px 0;
  font-size: 11px;
  color: var(--muted);
}

.cal-day {
  position: relative;
  aspect-ratio: 1;
  max-height: 40px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--text);
  font: 500 13px var(--font-body);
  cursor: pointer;
}

.cal-day:hover {
  background: var(--second-soft);
}

.cal-day.studied {
  background: color-mix(in srgb, var(--ring) 32%, transparent);
}

.cal-day.today {
  box-shadow: inset 0 0 0 1.5px var(--number);
  font-weight: 700;
}

.cal-day.selected {
  background: var(--accent);
  color: #fff;
}

.cal-dots {
  position: absolute;
  bottom: 2px;
  left: 50%;
  display: flex;
  gap: 2px;
  transform: translateX(-50%);
}

.cal-dots i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--kind);
}

.cal-day.selected .cal-dots i {
  background: #fff;
}

.cal-key {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin: 8px 0 0;
  font-size: 11px;
  color: var(--muted);
}

.cal-key i {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-left: 6px;
  border-radius: 50%;
  background: var(--kind);
}

.cal-key i:first-child {
  margin-left: 0;
}

.cal-key i.studied {
  background: color-mix(in srgb, var(--ring) 55%, transparent);
}

.cal-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.cal-list .panel-hint {
  margin: 0;
}

.cal-list-label {
  margin: 4px 0 0;
  font: 600 12px var(--heading-font);
  color: var(--muted);
}

.cal-list-label:first-child {
  margin-top: 0;
}

.cal-event {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-left: 3px solid var(--kind);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.cal-event:hover {
  background: var(--second-soft);
}

.cal-kind {
  flex: none;
  padding: 2px 7px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--kind) 18%, transparent);
  color: var(--kind);
  font-size: 11px;
  font-weight: 600;
}

.cal-event-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.cal-event-text strong {
  font-size: 14px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.cal-event-text small {
  font-size: 12px;
  color: var(--muted);
}

.cal-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

@media (max-width: 640px) {
  .cal-fields {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  .g-best::after {
    animation: none;
  }
}

/* music player */
.player-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  margin-bottom: 14px;
  border-radius: 12px;
  background: var(--second-soft);
}

.player-tab {
  padding: 8px 4px;
  border: 0;
  border-radius: 9px;
  background: none;
  color: var(--muted);
  font: 600 13px var(--font-body);
  cursor: pointer;
}

.player-tab.on {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
}

.player-panels {
  position: relative;
}

.player-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.player-panel.off {
  position: absolute;
  top: 0;
  left: -10000px;
  width: 100%;
}

.player-panel .panel-hint,
.player-panel .form-message {
  margin: 0;
}

.player-panel .form-message:empty {
  display: none;
}

.sound-mixes,
.player-picks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.player-picks:empty {
  display: none;
}

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

.sound-row {
  display: grid;
  grid-template-columns: 28px 96px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--bg);
  font-weight: 600;
  font-size: 14px;
}

.sound-icon {
  font-size: 20px;
}

.sound-row input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.player-link {
  display: flex;
  gap: 8px;
}

.player-link input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font: 14px var(--font-body);
}

.player-link .btn-leaf {
  padding: 10px 16px;
}

.video-box {
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  background: #000;
}

.video-box[hidden] {
  display: none;
}

.spotify-frame {
  display: block;
  width: 100%;
  height: 380px;
  border: 0;
  border-radius: 12px;
}

.room-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.room,
.room-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font: 600 14px var(--font-body);
}

.room {
  width: 100%;
  border: 1.5px solid transparent;
  text-align: left;
  cursor: pointer;
}

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

.room-head .link-btn {
  margin-left: auto;
}

.room-icon {
  font-size: 20px;
}

.now-playing {
  margin: 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.together-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.together-controls .btn-small {
  margin-top: 0;
}

.together-controls .btn-outline {
  padding: 8px 14px;
}

.player-panel .panel-hint a {
  color: var(--accent-text);
}

/* page transitions: the sidebar stays put and the page moves in a way that suits the theme */
:root,
:root[data-theme="meadow"] {
  --page-in: page-lift .45s cubic-bezier(.22, 1, .36, 1);
  --page-out: page-fade-out .16s ease-in forwards;
}

:root[data-theme="ember"] {
  --page-in: page-haze .55s ease-out;
  --page-out: page-haze-out .16s ease-in forwards;
}

:root[data-theme="pumpkin"] {
  --page-in: page-rise .5s cubic-bezier(.2, .8, .2, 1);
  --page-out: page-fade-out .16s ease-in forwards;
}

:root[data-theme="pink"] {
  --page-in: page-pop .45s cubic-bezier(.34, 1.56, .64, 1);
  --page-out: page-shrink-out .16s ease-in forwards;
}

:root[data-theme="cherry"] {
  --page-in: page-snap .28s cubic-bezier(.2, .9, .3, 1);
  --page-out: page-snap-out .14s ease-in forwards;
}

:root[data-theme="retro"] {
  --page-in: page-turn .55s cubic-bezier(.22, 1, .36, 1);
  --page-out: page-turn-out .18s ease-in forwards;
}

:root[data-theme="ocean"] {
  --page-in: page-wave .6s cubic-bezier(.22, 1, .36, 1);
  --page-out: page-fade-out .16s ease-in forwards;
}

:root[data-theme="aurora"] {
  --page-in: page-glow .65s ease-out;
  --page-out: page-glow-out .18s ease-in forwards;
}

:root[data-theme="sunflower"] {
  --page-in: page-bloom .6s cubic-bezier(.22, 1, .36, 1);
  --page-out: page-fade-out .16s ease-in forwards;
}

/* wait for the page's data with the sidebar showing, then bring the page in */
body.app.checking {
  visibility: visible;
}

body.app.checking .dash {
  visibility: hidden;
}

body.app:not(.checking) .dash {
  animation: var(--page-in);
}

body.app.leaving .dash {
  animation: var(--page-out);
}

@keyframes page-lift {
  from { opacity: 0; transform: translateY(12px); }
}

@keyframes page-fade-out {
  to { opacity: 0; transform: translateY(-6px); }
}

@keyframes page-haze {
  from { opacity: 0; filter: blur(6px) sepia(.4); transform: translateY(6px); }
}

@keyframes page-haze-out {
  to { opacity: 0; filter: blur(4px); }
}

@keyframes page-rise {
  from { opacity: 0; transform: translateY(28px); }
}

@keyframes page-pop {
  from { opacity: 0; transform: scale(.96); }
}

@keyframes page-shrink-out {
  to { opacity: 0; transform: scale(.98); }
}

@keyframes page-snap {
  from { opacity: 0; transform: translateX(22px); }
}

@keyframes page-snap-out {
  to { opacity: 0; transform: translateX(-14px); }
}

@keyframes page-turn {
  from { opacity: 0; transform: perspective(1400px) rotateY(-7deg) translateX(-18px); transform-origin: left center; }
}

@keyframes page-turn-out {
  to { opacity: 0; transform: perspective(1400px) rotateY(5deg); transform-origin: right center; }
}

@keyframes page-wave {
  0% { opacity: 0; transform: translateY(26px); }
  60% { opacity: 1; transform: translateY(-3px); }
  100% { transform: translateY(0); }
}

@keyframes page-glow {
  from { opacity: 0; filter: blur(10px) brightness(1.5) saturate(1.4); }
}

@keyframes page-glow-out {
  to { opacity: 0; filter: blur(8px) brightness(1.3); }
}

@keyframes page-bloom {
  from { opacity: .2; clip-path: circle(0% at 50% 35%); }
  to { opacity: 1; clip-path: circle(150% at 50% 35%); }
}

@media (prefers-reduced-motion: reduce) {
  body.app:not(.checking) .dash,
  body.app.leaving .dash {
    animation: none;
  }
}

/* planner */
.planner-tabs {
  display: flex;
  gap: 4px;
  width: max-content;
  max-width: 100%;
  overflow-x: auto;
  margin: 0 0 18px;
  padding: 4px;
  border-radius: 12px;
  background: var(--second-soft);
}

.planner-tab {
  padding: 8px 18px;
  border: 0;
  border-radius: 9px;
  background: none;
  color: var(--muted);
  font: 600 14px var(--font-body);
  white-space: nowrap;
  cursor: pointer;
}

.planner-tab.on {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
}

.planner-view {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.planner-view[hidden] {
  display: none;
}

.planner-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  margin-bottom: 14px;
}

.planner-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  font: 600 15px var(--heading-font);
  color: var(--text);
}

.planner-summary {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

.planner-summary strong {
  color: var(--text);
}

.planner-bar .btn-small {
  margin-top: 0;
}

.planner-empty {
  margin: 20px 0 8px;
  color: var(--muted);
  text-align: center;
}

/* planner: week */
.week-daypicker {
  display: none;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.week-daypicker .chip {
  white-space: nowrap;
}

.week-scroll {
  max-height: 620px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.week-grid {
  display: grid;
  grid-template-columns: 58px repeat(7, minmax(92px, 1fr));
  min-width: 720px;
}

.week-corner,
.week-dayhead {
  position: sticky;
  top: 0;
  z-index: 3;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.week-dayhead {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 0;
  padding: 8px 4px;
  border-left: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
}

.week-dayhead strong {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font: 600 17px var(--heading-font);
  color: var(--text);
}

.week-dayhead.today strong {
  background: var(--accent);
  color: #fff;
}

.week-event {
  max-width: 100%;
  padding: 1px 6px;
  overflow: hidden;
  border: 0;
  border-radius: 6px;
  background: color-mix(in srgb, var(--kind) 20%, transparent);
  color: var(--text);
  font: 600 11px var(--font-body);
  white-space: nowrap;
  text-overflow: ellipsis;
  cursor: pointer;
}

.week-times {
  position: relative;
  grid-row: 2;
  grid-column: 1;
}

.week-times span {
  position: absolute;
  right: 8px;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  transform: translateY(-50%);
}

.week-times span:first-child {
  transform: none;
}

.week-day {
  position: relative;
  grid-row: 2;
  border-left: 1px solid var(--border);
  background-image: linear-gradient(var(--border) 1px, transparent 1px);
  background-size: 100% 48px;
  cursor: pointer;
}

.week-day.today {
  background-color: color-mix(in srgb, var(--accent-soft) 50%, transparent);
}

.week-block {
  position: absolute;
  left: 3px;
  right: 3px;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  overflow: hidden;
  padding: 4px 6px;
  border: 0;
  border-left: 3px solid var(--block);
  border-radius: 8px;
  background: color-mix(in srgb, var(--block) 26%, var(--surface));
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: grab;
  touch-action: none;
}

.week-block strong,
.week-block small {
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.week-block strong {
  font-size: 12px;
  font-weight: 700;
}

.week-block small {
  font-size: 11px;
  color: var(--muted);
}

.week-block.short {
  flex-direction: row;
  align-items: center;
  gap: 6px;
  padding-top: 2px;
  padding-bottom: 2px;
}

.week-block.short .week-block-note {
  display: none;
}

.week-block.done {
  opacity: .6;
}

.week-block.dragging {
  z-index: 5;
  opacity: .9;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .2);
  cursor: grabbing;
}

.week-now {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 2;
  height: 2px;
  background: #E0564B;
  pointer-events: none;
}

.week-now::before {
  content: "";
  position: absolute;
  left: -4px;
  top: -3px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #E0564B;
}

@media (max-width: 700px) {
  .week-daypicker {
    display: flex;
  }

  .week-grid {
    grid-template-columns: 54px minmax(0, 1fr);
    min-width: 0;
  }

  .week-dayhead:not(.focus),
  .week-day:not(.focus) {
    display: none;
  }
}

/* planner: to-do */
.todo-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px 150px auto;
  gap: 8px;
}

.todo-form input,
.todo-form select {
  min-width: 0;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font: 14px var(--font-body);
}

.todo-panel .form-message:empty {
  display: none;
}

.todo-filters {
  margin: 14px 0 0;
}

.todo-group {
  margin-top: 16px;
}

.todo-group.overdue .cal-list-label {
  color: #E0564B;
}

.todo-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
}

.todo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-left: 3px solid var(--block);
  border-radius: 10px;
  background: var(--bg);
}

.todo input {
  flex: none;
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.todo-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.todo-text strong {
  font-size: 14px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.todo-text small {
  font-size: 12px;
  color: var(--muted);
}

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

.todo-panel > .link-btn {
  margin-top: 16px;
}

@media (max-width: 760px) {
  .todo-form {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .todo-form [name="title"],
  .todo-form button {
    grid-column: 1 / -1;
  }
}

/* planner: calendar */
.month-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  align-items: start;
  gap: 20px;
}

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

.month-weekday {
  padding: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
}

.month-cell {
  min-width: 0;
  min-height: 96px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 3px;
  overflow: hidden;
  padding: 6px;
  border: 1.5px solid transparent;
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.month-cell:hover {
  border-color: var(--border);
}

.month-cell.selected {
  border-color: var(--accent);
}

.month-num {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  font: 600 13px var(--heading-font);
}

.month-cell.today .month-num {
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
}

.month-chips {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.month-chip {
  display: block;
  overflow: hidden;
  padding: 1px 5px;
  border-radius: 5px;
  background: color-mix(in srgb, var(--kind, var(--block)) 22%, transparent);
  color: var(--text);
  font-size: 11px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.month-chip.todo {
  padding-left: 2px;
  background: none;
  color: var(--muted);
}

.month-chip.todo.done {
  text-decoration: line-through;
}

.month-more {
  font-size: 11px;
  color: var(--muted);
}

.month-dots {
  display: none;
}

.month-day {
  position: sticky;
  top: 20px;
}

.month-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.cal-event.done strong {
  text-decoration: line-through;
}

@media (max-width: 1000px) {
  .month-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .month-day {
    position: static;
  }
}

@media (max-width: 640px) {
  .month-cell {
    min-height: 52px;
    align-items: center;
    padding: 4px 2px;
  }

  .month-chips {
    display: none;
  }

  .month-dots {
    position: static;
    display: flex;
    margin-top: auto;
    transform: none;
  }
}

/* planner: semester */
.semester-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 200px)) auto;
  align-items: end;
  gap: 12px;
  margin-top: 12px;
}

.semester-form-actions {
  display: flex;
  gap: 8px;
}

.semester-setup .form-message:empty {
  display: none;
}

.semester-week {
  margin: 4px 0 0;
  font: 600 26px/1.1 var(--heading-font);
  color: var(--number);
}

.semester-week small {
  font: 500 14px var(--font-body);
  color: var(--muted);
}

.semester-bar {
  height: 10px;
  margin-top: 4px;
}

.countdowns {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.countdowns .cal-countdown {
  width: 100%;
  margin: 0;
  border: 0;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.timeline {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.timeline-row {
  display: grid;
  grid-template-columns: 180px minmax(360px, 1fr);
  align-items: center;
  gap: 12px;
}

.timeline-label {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.timeline-track {
  position: relative;
  height: 30px;
  margin: 0 8px;
  border-radius: 8px;
  background: var(--bg);
}

.timeline-axis .timeline-track {
  height: 18px;
  background: none;
}

.timeline-axis .timeline-track span {
  position: absolute;
  top: 0;
  font-size: 11px;
  color: var(--muted);
}

.timeline-mark {
  position: absolute;
  top: 50%;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  padding: 0;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--kind);
  cursor: pointer;
}

.timeline-mark.kind-exam {
  border-radius: 3px;
  transform: rotate(45deg);
}

.timeline-mark:hover {
  scale: 1.3;
}

.timeline-today {
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 2px;
  margin-left: -1px;
  background: var(--number);
  opacity: .5;
}

.semester-hours {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.semester-hours-row {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) 70px;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}

.semester-hours-row .bar {
  margin: 0;
  background: var(--bg);
}

.semester-hours-row strong {
  text-align: right;
}

.block-times {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 640px) {
  .semester-form {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .semester-form-actions {
    grid-column: 1 / -1;
  }

  .timeline-row {
    grid-template-columns: 110px minmax(300px, 1fr);
  }

  .semester-hours-row {
    grid-template-columns: 80px minmax(0, 1fr) 60px;
  }

  .block-times {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .block-times .field:first-child {
    grid-column: 1 / -1;
  }

  .side-link {
    min-width: 42px;
    padding: 7px 2px;
    font-size: 10px;
  }

  .side-nav {
    gap: 0;
  }
}

.planner-tabs,
.week-daypicker {
  scrollbar-width: none;
}

.week-daypicker .chip {
  flex: none;
}

@media (max-width: 640px) {
  .planner-tabs {
    width: 100%;
  }

  .planner-tab {
    flex: 1;
    padding: 8px 6px;
    font-size: 13px;
  }
}

.spotify-open {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.spotify-open a {
  text-decoration: none;
}

.spotify-open .btn-leaf {
  padding: 10px 16px;
  font-size: 14px;
}

.spotify-open .btn-outline {
  padding: 9px 14px;
}

.premium-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--accent-soft);
}

.premium-art {
  flex: none;
  width: 52px;
  height: 52px;
  border-radius: 8px;
  object-fit: cover;
}

.premium-art.empty {
  display: grid;
  place-items: center;
  background: var(--surface);
  color: var(--accent-text);
  font-size: 22px;
}

.premium-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.premium-text strong,
.premium-text small {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.premium-text strong {
  font-size: 14px;
}

.premium-text small {
  font-size: 12px;
  color: var(--muted);
}

.premium-card .btn-small {
  margin-top: 0;
  white-space: nowrap;
}

.premium-controls {
  flex: none;
  display: flex;
  align-items: center;
  gap: 2px;
}

.premium-controls button {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
}

.premium-controls button:disabled {
  opacity: .4;
  cursor: default;
}

.premium-controls .premium-play {
  width: 38px;
  height: 38px;
  background: var(--accent);
  color: #fff;
}

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

.premium-volume {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
}

.premium-volume input {
  flex: 1;
  max-width: 200px;
  accent-color: var(--accent);
}

.spotify-open button.btn-leaf {
  padding: 10px 16px;
  font-size: 14px;
}

/* app frame: Firefly's pages sit in a frame so the record player keeps playing between them */
body.shell {
  margin: 0;
  overflow: hidden;
  background: var(--bg);
}

.shell-page {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* record player: its wood, record label and arm change with the theme */
:root,
:root[data-theme="meadow"] {
  --tt-base: repeating-linear-gradient(90deg, rgba(255, 255, 255, .1) 0 6px, transparent 6px 12px), linear-gradient(#9DBB89, #7FA070);
  --tt-label: radial-gradient(circle, #FFFEF9 0 18%, #F3D77A 19%);
  --tt-arm: #F6F5EC;
}

:root[data-theme="ember"] {
  --tt-base: linear-gradient(#4A1A14, #2B090B);
  --tt-label: radial-gradient(circle, #2B090B 0 18%, #E9782F 19% 70%, #F2C27A 71%);
  --tt-arm: #F2C27A;
}

:root[data-theme="pumpkin"] {
  --tt-base: repeating-linear-gradient(8deg, rgba(0, 0, 0, .08) 0 3px, transparent 3px 9px), linear-gradient(#B07A48, #8A5A35);
  --tt-label: radial-gradient(circle, #FBEBD6 0 18%, #E08A3C 19%);
  --tt-arm: #FBEBD6;
}

:root[data-theme="pink"] {
  --tt-base: linear-gradient(#F9D6E5, #F0B3CD);
  --tt-label: radial-gradient(circle, #FFFFFF 0 18%, #D63F84 19% 72%, #9B59B6 73%);
  --tt-arm: #2F3C57;
}

:root[data-theme="cherry"] {
  --tt-base: linear-gradient(#26262B, #0B0B0C);
  --tt-label: radial-gradient(circle, #0E0E10 0 18%, #D7263D 19%);
  --tt-arm: #D9D2D3;
}

:root[data-theme="retro"] {
  --tt-base: linear-gradient(90deg, rgba(232, 154, 176, .25) 50%, transparent 50%) 0 0 / 12px 12px, linear-gradient(rgba(141, 179, 90, .25) 50%, transparent 50%) 0 0 / 12px 12px, #6E4B3A;
  --tt-label: repeating-radial-gradient(circle, #F6D97A 0 3px, #E07A9A 3px 6px);
  --tt-arm: #F6D97A;
}

:root[data-theme="ocean"] {
  --tt-base: radial-gradient(circle at 50% 100%, transparent 6px, rgba(255, 255, 255, .18) 7px 8px, transparent 9px) 0 0 / 16px 10px, linear-gradient(#2A8BA6, #0E4A63);
  --tt-label: radial-gradient(circle, #EAF6F9 0 18%, #3FB8AF 19% 70%, #7FE8DA 71%);
  --tt-arm: #EAF6F9;
}

:root[data-theme="aurora"] {
  --tt-base: radial-gradient(1px 1px at 20% 30%, #FFFFFF, transparent) 0 0 / 18px 18px, radial-gradient(ellipse at 30% 0%, rgba(110, 231, 183, .45), transparent 60%), linear-gradient(#241E5E, #0D1026);
  --tt-label: radial-gradient(circle, #0D1026 0 18%, transparent 19%), conic-gradient(#8B6CF0, #6EE7B7, #EC4899, #8B6CF0);
  --tt-arm: #CFC8F7;
}

:root[data-theme="sunflower"] {
  --tt-base: radial-gradient(circle, rgba(91, 58, 18, .25) 0 2px, transparent 3px) 0 0 / 12px 12px, linear-gradient(#FFCB2E, #F2AE00);
  --tt-label: radial-gradient(circle, #FFD84D 0 14%, #5B3A12 15% 58%, #F5B800 59%);
  --tt-arm: #FFFFFF;
}

.record {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  pointer-events: none;
}

.record[hidden] {
  display: none;
}

.record > * {
  pointer-events: auto;
}

.record[data-page="chat"] {
  bottom: 120px;
}

.turntable {
  position: relative;
  flex: none;
  width: 78px;
  height: 64px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  transition: transform .2s;
}

.turntable:hover {
  transform: translateY(-2px) rotate(-2deg);
}

.tt-base {
  position: absolute;
  inset: 0;
  border-radius: 14px;
  background: var(--tt-base);
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .18), inset 0 1px 0 rgba(255, 255, 255, .25), 0 8px 18px rgba(0, 0, 0, .28);
}

.tt-platter {
  position: absolute;
  top: 6px;
  left: 7px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(0, 0, 0, .25);
}

.tt-record {
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  background: repeating-radial-gradient(circle, #151515 0 1.4px, #262626 1.4px 2.8px);
}

.tt-label {
  position: absolute;
  inset: 31%;
  border-radius: 50%;
  background: var(--tt-label);
}

.tt-label::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 3px;
  height: 3px;
  margin: -1.5px 0 0 -1.5px;
  border-radius: 50%;
  background: #111;
}

.tt-shine {
  position: absolute;
  top: 8px;
  left: 9px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: conic-gradient(transparent 0 30deg, rgba(255, 255, 255, .16) 50deg, transparent 70deg 210deg, rgba(255, 255, 255, .1) 230deg, transparent 250deg);
  pointer-events: none;
}

.tt-knob {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--tt-arm);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .35);
}

.tt-arm {
  position: absolute;
  top: 12px;
  right: 11px;
  width: 3.5px;
  height: 36px;
  border-radius: 2px;
  background: var(--tt-arm);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .3);
  transform-origin: 50% 0;
  transform: rotate(6deg);
  transition: transform .6s cubic-bezier(.22, 1, .36, 1);
}

.tt-arm::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: -2px;
  width: 7px;
  height: 6px;
  border-radius: 2px;
  background: var(--tt-arm);
}

.tt-note {
  position: absolute;
  top: -6px;
  left: 30px;
  opacity: 0;
  color: var(--glow);
  font-size: 16px;
  text-shadow: 0 0 6px var(--glow);
  pointer-events: none;
}

.record.playing .tt-record {
  animation: record-spin 1.8s linear infinite;
}

.record.playing .tt-arm {
  transform: rotate(30deg);
}

.record.playing .tt-note {
  animation: record-note 2.4s ease-out infinite;
}

.record.playing .tt-base {
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .18), inset 0 1px 0 rgba(255, 255, 255, .25), 0 8px 18px rgba(0, 0, 0, .28), 0 0 18px color-mix(in srgb, var(--glow) 55%, transparent);
}

@keyframes record-spin {
  to { transform: rotate(360deg); }
}

@keyframes record-note {
  0% { opacity: 0; transform: translate(0, 6px) scale(.8); }
  25% { opacity: 1; }
  100% { opacity: 0; transform: translate(-14px, -22px) scale(1.1) rotate(-15deg); }
}

.record-card {
  width: min(360px, calc(100vw - 24px));
  max-height: min(620px, calc(100vh - 130px));
  overflow-y: auto;
  padding: 16px 18px 18px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px) scale(.96);
  transform-origin: bottom right;
  transition: opacity .2s, transform .25s cubic-bezier(.22, 1, .36, 1), visibility 0s .25s;
  box-shadow: 0 18px 50px -12px rgba(0, 0, 0, .35);
}

.record.open .record-card {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity .2s, transform .25s cubic-bezier(.22, 1, .36, 1);
}

.record-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.record-card-title {
  font: 600 18px var(--heading-font);
  color: var(--text);
}

.record-card .player-tabs {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.record-card .sound-row {
  grid-template-columns: 24px 88px minmax(0, 1fr);
}

@media (max-width: 640px) {
  .record {
    right: 12px;
    bottom: 92px;
  }

  .record[data-page="chat"] {
    bottom: 160px;
  }

  .turntable {
    transform: scale(.85);
    transform-origin: bottom right;
  }

  .record-card {
    max-height: calc(100vh - 200px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .record.playing .tt-record,
  .record.playing .tt-note {
    animation: none;
  }
}

/* friends */
.friend-search {
  width: 100%;
  margin-top: 12px;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font: 15px var(--font-body);
}

.people-rows {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.people-rows:empty {
  display: none;
}

.person-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.person-row:last-child {
  border-bottom: 0;
}

.person-row-text {
  flex: 1 1 120px;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.person-row-text strong {
  overflow: hidden;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--text);
}

.person-row-text small {
  font-size: 12px;
  color: var(--muted);
}

.person-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.person-row-actions .btn-small {
  margin-top: 0;
}

.person-row-actions .btn-outline {
  padding: 7px 12px;
  font-size: 13px;
  text-decoration: none;
}

.friend-tag {
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 13px;
  font-weight: 600;
}

@media (max-width: 640px) {
  .side-link {
    min-width: 36px;
    font-size: 9px;
  }
}

@media (max-width: 400px) {
  .sidebar .side-link {
    font-size: 0;
    gap: 0;
  }

  .sidebar .side-link svg {
    width: 24px;
    height: 24px;
  }
}

/* focus */
.focus-grid {
  align-items: start;
}

.focus-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  overflow: hidden;
  padding: 22px 24px 26px;
  text-align: center;
  --phase: var(--ring);
}

.focus-stage.on-break {
  --phase: var(--second);
}

.focus-glow {
  position: absolute;
  top: 30px;
  left: 50%;
  width: 320px;
  height: 320px;
  margin-left: -160px;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--glow) 35%, transparent), transparent 65%);
  opacity: 0;
  pointer-events: none;
  transition: opacity .6s;
}

.focus-stage.focusing .focus-glow,
.focus-stage.on-break .focus-glow {
  opacity: 1;
  animation: focus-breathe 6s ease-in-out infinite;
}

@keyframes focus-breathe {
  0%, 100% { transform: scale(.9); opacity: .55; }
  50% { transform: scale(1.08); opacity: 1; }
}

.focus-top {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.focus-phase {
  padding: 4px 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--phase) 22%, transparent);
  color: var(--text);
  font: 600 13px var(--heading-font);
}

.focus-ring {
  position: relative;
  width: 240px;
  height: 240px;
}

.focus-ring svg {
  position: absolute;
  inset: 0;
  transform: rotate(-90deg);
}

.focus-ring circle {
  fill: none;
  stroke-width: 10;
}

.focus-ring-track {
  stroke: var(--ring-track);
}

.focus-ring-fill {
  stroke: var(--phase);
  stroke-linecap: round;
  stroke-dasharray: 615.75;
  transition: stroke-dashoffset .5s linear;
}

.focus-time {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.focus-time strong {
  font: 600 52px/1 var(--heading-font);
  color: var(--number);
  font-variant-numeric: tabular-nums;
}

.focus-time small {
  max-width: 170px;
  overflow: hidden;
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.focus-rounds {
  display: flex;
  gap: 8px;
}

.focus-rounds span {
  width: 12px;
  height: 12px;
  border: 2px solid var(--phase);
  border-radius: 50%;
}

.focus-rounds .done {
  background: var(--phase);
}

.focus-rounds .now {
  box-shadow: 0 0 8px var(--glow);
}

.focus-message {
  position: relative;
  min-height: 1.5em;
  margin: 0;
  color: var(--muted);
}

.focus-setup {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
}

.focus-setup[hidden] {
  display: none;
}

.focus-actions {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.focus-actions .btn-outline {
  padding: 11px 18px;
}

.focus-note {
  position: relative;
  margin: 0;
}

.focus-today {
  margin: 8px 0 0;
  color: var(--text);
}

.room-group-start {
  width: 100%;
  margin-top: 10px;
  padding: 9px 14px;
}

.room-group-start[hidden] {
  display: none;
}

.room-invite {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--text);
  font-size: 14px;
}

.room-invite .btn-small {
  margin-top: 0;
}

.room-following {
  margin: 10px 0 0;
}

.room-status {
  font: 600 13px var(--heading-font);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.room-member.focus .room-status {
  color: var(--number);
}

.room-member.break .room-status {
  color: var(--second);
}

.room-chat {
  max-height: 160px;
  overflow-y: auto;
  margin: 12px 0 8px;
  font-size: 14px;
}

.room-chat:empty {
  display: none;
}

.room-chat p {
  margin: 0 0 4px;
  color: var(--text);
  overflow-wrap: anywhere;
}

/* focus full screen: only the timer */
body.focus-immersive .sidebar,
body.focus-immersive .dash-top,
body.focus-immersive .focus-grid > .dash-col {
  display: none;
}

body.focus-immersive {
  grid-template-columns: minmax(0, 1fr);
  padding-bottom: 0;
}

body.focus-immersive .dash {
  grid-column: 1;
  max-width: none;
  padding: 0;
}

body.focus-immersive .focus-grid {
  grid-template-columns: minmax(0, 1fr);
  margin: 0;
}

body.focus-immersive .focus-stage {
  min-height: 100vh;
  justify-content: center;
  border: 0;
  border-radius: 0;
}

body.focus-immersive .focus-ring {
  width: 320px;
  height: 320px;
}

body.focus-immersive .focus-time strong {
  font-size: 72px;
}

body.focus-immersive .focus-glow {
  top: 50%;
  width: 520px;
  height: 520px;
  margin: -330px 0 0 -260px;
}

@media (max-width: 640px) {
  .side-link[data-music] {
    display: none;
  }

  .focus-ring {
    width: 210px;
    height: 210px;
  }

  .focus-time strong {
    font-size: 44px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .focus-stage.focusing .focus-glow,
  .focus-stage.on-break .focus-glow {
    animation: none;
  }
}

/* security check on the login page */
.captcha:empty {
  display: none;
}

.captcha {
  display: flex;
  justify-content: center;
  margin: 4px 0 8px;
}

/* admin page */
.admin-top-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

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

.admin-stats div {
  display: flex;
  flex-direction: column;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--accent-soft);
}

.admin-stats strong {
  font: 600 26px var(--font-heading);
  color: var(--text);
}

.admin-stats small {
  font-size: 12px;
  color: var(--muted);
}

.admin-sub {
  margin-top: 18px;
}

.day-bars {
  display: grid;
  grid-template-columns: repeat(14, 1fr);
  align-items: end;
  gap: 4px;
  height: 90px;
  margin-top: 14px;
}

.day-bar {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 4px;
  height: 100%;
}

.day-bar-fill {
  width: 100%;
  min-height: 3px;
  border-radius: 6px 6px 2px 2px;
  background: var(--ring);
}

.day-bar small {
  font-size: 10px;
  color: var(--muted);
}

.top-users,
.limit-rows,
.problem-rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.top-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.top-user-rank {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-text);
  font: 600 13px/26px var(--font-heading);
  text-align: center;
}

.top-user-text,
.limit-row {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.top-user-text .bar,
.limit-row .bar,
.generate-meter .bar {
  margin-top: 6px;
}

.top-user-text small,
.limit-row small {
  font-size: 12px;
  color: var(--muted);
}

.limit-row {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.limit-row:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.limit-model {
  font: 500 12px "Roboto Mono", monospace;
  color: var(--muted);
}

.limit-link {
  font-size: 13px;
  color: var(--accent-text);
}

.generate-meter {
  display: block;
  max-width: 260px;
  margin-top: 4px;
}

.online-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 5px;
  border-radius: 50%;
  background: #3DBE6B;
  vertical-align: 1px;
}

.access-tag.blocked {
  color: #C8403F;
  font-weight: 600;
}

.problem-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.problem-row small {
  font-size: 12px;
  color: var(--muted);
}

.problem-row code {
  overflow-wrap: anywhere;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--text);
  font-size: 12px;
}

/* the full emoji picker */
.emoji-picker-box {
  position: fixed;
  inset: auto;
  margin: 0;
  padding: 0;
  overflow: visible;
  border: 0;
  background: transparent;
}

.emoji-picker-box emoji-picker {
  --background: var(--surface);
  --border-color: var(--border);
  --border-radius: 16px;
  --button-hover-background: var(--second-soft);
  --button-active-background: var(--accent-soft);
  --category-font-color: var(--muted);
  --indicator-color: var(--accent);
  --input-border-color: var(--border);
  --input-font-color: var(--text);
  --input-placeholder-color: var(--muted);
  --outline-color: var(--accent);
  --emoji-size: 1.45rem;
  display: block;
  height: 380px;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 18px 40px -14px rgba(0, 0, 0, .45);
  overflow: hidden;
}

@media (max-width: 559px) {
  .emoji-picker-box emoji-picker {
    width: 100%;
    height: min(380px, 60vh);
    --num-columns: 8;
  }
}

/* two-factor login */
.two-factor-panel,
.admin-lock {
  max-width: 560px;
  margin-top: 18px;
}

.two-factor-status {
  margin: 8px 0 4px;
  font: 600 15px var(--font-heading);
  color: var(--text);
}

.two-factor-status.on {
  color: var(--accent-text);
}

.two-factor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.two-factor-actions .btn-small {
  margin-top: 0;
}

.two-factor-qr {
  display: inline-flex;
  margin: 8px 0;
  padding: 10px;
  border-radius: 14px;
  background: #fff;
}

.two-factor-qr img {
  display: block;
}

.two-factor-secret {
  display: block;
  margin: 4px 0 12px;
  padding: 8px 10px;
  overflow-wrap: anywhere;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--text);
  font: 500 13px "Roboto Mono", monospace;
  letter-spacing: .05em;
}

.two-factor-form .field input {
  max-width: 180px;
  letter-spacing: .2em;
}

#code-form .auth-link {
  display: block;
  margin: 12px auto 0;
}
