:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --page: #111116;
  --surface: #19191f;
  --surface-raised: #1e1e26;
  --surface-soft: #22222b;
  --border: #30303a;
  --border-light: #393945;
  --text: #f3f2f8;
  --muted: #a4a2b1;
  --subtle: #a6a4b2;
  --accent: #9288ff;
  --accent-bright: #aaa2ff;
  --accent-soft: #29263f;
  --blue: #79baff;
  --green: #70d7b1;
  --red: #ff8c9a;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
  scroll-padding-top: 90px;
}

body {
  min-height: 100vh;
  margin: 0;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse at 50% -22rem, rgba(100, 87, 190, 0.17), transparent 58rem),
    var(--page);
  color: var(--text);
  line-height: 1.55;
}

button, input, select {
  font: inherit;
}

button, a, input, select {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid rgba(170, 162, 255, 0.72);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.site-header {
  position: sticky;
  z-index: 5;
  top: 0;
  border-bottom: 1px solid rgba(56, 55, 67, 0.76);
  background: rgba(17, 17, 22, 0.94);
  backdrop-filter: blur(16px);
}

.header-inner, .footer-inner {
  width: min(1120px, calc(100% - 48px));
  margin: 0 auto;
}

.header-inner {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--text);
  text-decoration: none;
  flex-shrink: 0;
}

.brand-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(170, 162, 255, 0.32);
  border-radius: 13px;
  background: linear-gradient(145deg, #302a53, #211f32);
  color: var(--accent-bright);
}

.brand-mark svg {
  width: 25px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.brand-copy, .profile-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.brand-copy strong {
  font-size: 1rem;
  font-weight: 760;
  letter-spacing: -0.02em;
}

.brand-copy > span {
  margin-top: 4px;
  color: var(--subtle);
  font-size: 0.7rem;
  letter-spacing: 0.035em;
}

.primary-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.primary-nav a {
  padding: 8px 11px;
  border-radius: 9px;
  color: var(--muted);
  font-size: 0.82rem;
  text-decoration: none;
  transition: background-color 160ms ease, color 160ms ease;
}

.primary-nav a:hover {
  background: var(--surface-soft);
  color: var(--text);
}

.account-area {
  display: flex;
  justify-content: flex-end;
  min-width: 165px;
}

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

.avatar-frame {
  position: relative;
  width: 36px;
  height: 36px;
  display: grid;
  flex: 0 0 36px;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--border-light);
  border-radius: 50%;
  background: var(--surface-soft);
}

.avatar-frame img {
  position: absolute;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-frame img:not([src]), .avatar-frame img[src=""] {
  display: none;
}

.avatar-fallback {
  color: var(--accent-bright);
  font-size: 0.85rem;
}

.profile-copy {
  max-width: 150px;
  gap: 4px;
}

.profile-copy strong {
  overflow: hidden;
  color: var(--text);
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-copy span {
  overflow: hidden;
  color: var(--subtle);
  font-size: 0.68rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

main {
  width: min(1120px, calc(100% - 48px));
  flex: 1;
  margin: 0 auto;
  padding: 42px 0 76px;
}

.button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 17px;
  border: 1px solid transparent;
  border-radius: 11px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 680;
  line-height: 1.2;
  text-decoration: none;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.button svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.button-primary {
  border-color: #9c93ff;
  background: var(--accent);
  color: #171522;
}

.button-primary:hover:not(:disabled) {
  background: var(--accent-bright);
}

.button-secondary {
  border-color: #504a83;
  background: #2a2740;
  color: #d3ceff;
}

.button-secondary:hover:not(:disabled) {
  border-color: #7169ad;
  background: #34304f;
}

.button-quiet {
  border-color: var(--border);
  background: transparent;
  color: #cfced8;
}

.button-quiet:hover:not(:disabled) {
  border-color: var(--border-light);
  background: var(--surface-soft);
}

.button-discord {
  min-height: 39px;
  padding: 0 14px;
  border-color: #4a4670;
  background: #26243a;
  color: #d6d2ff;
  font-size: 0.76rem;
}

.button-discord:hover {
  background: #302d49;
}

.button-danger {
  border-color: rgba(255, 140, 154, 0.4);
  background: rgba(115, 42, 59, 0.26);
  color: #ffabb5;
}

.button-danger:hover:not(:disabled) {
  border-color: rgba(255, 140, 154, 0.65);
  background: rgba(134, 48, 67, 0.4);
}

.button-large {
  min-height: 49px;
  padding: 0 25px;
  font-size: 0.88rem;
}

.button-small {
  min-height: 34px;
  padding: 0 12px;
  font-size: 0.73rem;
}

.login-layout {
  min-height: 560px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 0.9fr);
  align-items: center;
  gap: 56px;
  padding: 48px 6%;
  border: 1px solid var(--border);
  border-radius: 25px;
  background: linear-gradient(125deg, rgba(30, 29, 39, 0.96), rgba(24, 24, 31, 0.95));
}

.login-copy {
  max-width: 560px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #aaa4e9;
  font-size: 0.68rem;
  font-weight: 760;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.status-dot, .state-dot {
  width: 7px;
  height: 7px;
  display: inline-block;
  border-radius: 50%;
  background: var(--green);
}

.login-copy h1 {
  margin: 22px 0 18px;
  font-size: clamp(2.2rem, 5vw, 3.75rem);
  font-weight: 760;
  letter-spacing: -0.055em;
  line-height: 1.12;
}

.login-copy h1 span {
  color: var(--accent-bright);
}

.login-copy > p:not(.login-note) {
  max-width: 470px;
  margin-bottom: 27px;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.8;
}

.login-copy .button svg {
  width: 19px;
  height: 19px;
}

.login-note {
  max-width: 400px;
  margin-top: 16px;
  color: var(--subtle);
  font-size: 0.74rem;
}

.login-art {
  position: relative;
  width: min(100%, 390px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  justify-self: center;
}

.art-orbit {
  position: absolute;
  border: 1px solid rgba(158, 148, 247, 0.18);
  border-radius: 50%;
}

.orbit-one {
  inset: 5%;
}

.orbit-two {
  inset: 18%;
  border-color: rgba(158, 148, 247, 0.22);
}

.art-core {
  width: 42%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 1px solid rgba(190, 183, 255, 0.48);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #423d6b, #242238 70%);
  box-shadow: 0 0 90px rgba(113, 101, 209, 0.2);
}

.art-core span {
  width: 27%;
  aspect-ratio: 1;
  border: 2px solid #c0b9ff;
  border-radius: 50%;
  background: #8e84f8;
}

.art-caption {
  position: absolute;
  right: 3%;
  bottom: 17%;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 14px;
  border: 1px solid var(--border-light);
  border-radius: 11px;
  background: #22212b;
  color: #d4d1df;
  font-size: 0.72rem;
}

.art-caption-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}

.notice {
  margin-bottom: 22px;
  padding: 13px 16px;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  background: var(--surface-raised);
  color: #dedce7;
  font-size: 0.84rem;
}

.notice[data-kind="success"] {
  border-color: rgba(112, 215, 177, 0.32);
  background: rgba(34, 84, 69, 0.2);
  color: #a5ecd2;
}

.notice[data-kind="error"] {
  border-color: rgba(255, 140, 154, 0.35);
  background: rgba(105, 43, 56, 0.2);
  color: #ffb1ba;
}

.notice[data-kind="info"] {
  border-color: rgba(121, 186, 255, 0.32);
  background: rgba(39, 72, 108, 0.22);
  color: #b6d9ff;
}

.app-view {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.page-heading, .section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
}

.page-heading {
  margin-bottom: 3px;
}

.page-heading h1 {
  margin: 7px 0 5px;
  font-size: clamp(1.7rem, 3.5vw, 2.25rem);
  font-weight: 730;
  letter-spacing: -0.04em;
  line-height: 1.2;
}

.page-heading p, .section-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.page-heading > .button {
  flex-shrink: 0;
}

.page-heading > .button svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
  gap: 18px;
  scroll-margin-top: 94px;
}

.panel {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(29, 29, 37, 0.98), rgba(24, 24, 31, 0.98));
}

.timer-panel {
  min-height: 550px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 27px 30px 25px;
}

.panel-topline {
  width: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.panel-topline h2, .section-heading h2 {
  margin: 5px 0 0;
  font-size: 1.18rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.state-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  border: 1px solid var(--border-light);
  border-radius: 999px;
  background: #22222b;
  color: #b7b5c2;
  font-size: 0.68rem;
  font-weight: 640;
  white-space: nowrap;
}

.state-pill[data-state="running"] {
  border-color: rgba(146, 136, 255, 0.35);
  background: var(--accent-soft);
  color: #c5c0ff;
}

.state-pill[data-state="running"] .state-dot {
  background: var(--accent-bright);
}

.state-pill[data-state="break"] {
  border-color: rgba(112, 215, 177, 0.28);
  background: rgba(33, 75, 63, 0.3);
  color: #a6e8d0;
}

.state-pill[data-state="break"] .state-dot {
  background: var(--green);
}

.timer-wrap {
  position: relative;
  width: min(290px, 68vw);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  margin: 15px auto 4px;
}

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

.timer-track, .timer-progress {
  fill: none;
  stroke-width: 5;
}

.timer-track {
  stroke: #30303a;
}

.timer-progress {
  stroke: var(--accent);
  stroke-dasharray: 640.885;
  stroke-dashoffset: 640.885;
  stroke-linecap: round;
  transition: stroke-dashoffset 320ms linear, stroke 180ms ease;
}

.timer-wrap[data-mode="break-short"] .timer-progress,
.timer-wrap[data-mode="break-long"] .timer-progress {
  stroke: var(--green);
}

.timer-center {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.timer-time {
  font-variant-numeric: tabular-nums;
  font-size: clamp(2.75rem, 7vw, 4.2rem);
  font-weight: 710;
  letter-spacing: -0.065em;
  line-height: 1;
}

.timer-caption {
  color: var(--subtle);
  font-size: 0.64rem;
  font-weight: 730;
  letter-spacing: 0.15em;
}

.timer-message {
  min-height: 23px;
  margin: 4px 0 17px;
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
}

.timer-actions {
  min-height: 49px;
  display: flex;
  justify-content: center;
}

.timer-footnote {
  max-width: 400px;
  margin: 14px 0 0;
  color: var(--subtle);
  font-size: 0.68rem;
  text-align: center;
}

.routine-panel {
  display: flex;
  flex-direction: column;
  padding: 27px 24px;
}

.routine-panel .panel-topline {
  margin-bottom: 27px;
}

.routine-icon, .metric-icon {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(146, 136, 255, 0.22);
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent-bright);
}

.routine-icon {
  width: 42px;
  height: 42px;
}

.routine-icon svg, .metric-icon svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.field-label {
  display: block;
  margin-bottom: 8px;
  color: #d4d2dd;
  font-size: 0.76rem;
  font-weight: 650;
}

.field-control {
  width: 100%;
  min-height: 45px;
  padding: 0 13px;
  border: 1px solid var(--border-light);
  border-radius: 10px;
  background: #17171e;
  color: var(--text);
  font-size: 0.82rem;
}

.field-control::placeholder {
  color: var(--subtle);
}

.field-control:disabled {
  color: var(--subtle);
  cursor: not-allowed;
}

select.field-control {
  appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none' stroke='%23a4a2b1' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.session-progress {
  margin-top: 26px;
  padding: 16px 15px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: rgba(18, 18, 24, 0.54);
}

.session-progress-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #c4c2cd;
  font-size: 0.74rem;
}

.session-progress-heading strong {
  color: #e2dfff;
  font-variant-numeric: tabular-nums;
}

.cycle-dots {
  display: flex;
  gap: 7px;
  margin: 13px 0 10px;
}

.cycle-dot {
  width: 9px;
  height: 9px;
  border: 1px solid #555260;
  border-radius: 50%;
  background: transparent;
}

.cycle-dot.is-complete {
  border-color: var(--accent);
  background: var(--accent);
}

.muted-copy {
  margin: 0;
  color: var(--subtle);
  font-size: 0.68rem;
  line-height: 1.5;
}

.routine-divider {
  height: 1px;
  margin: 22px 0 18px;
  background: var(--border);
}

.routine-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.routine-note p {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.65;
}

.note-icon {
  width: 17px;
  height: 17px;
  display: grid;
  flex: 0 0 17px;
  place-items: center;
  margin-top: 1px;
  border: 1px solid #514b7b;
  border-radius: 50%;
  color: var(--accent-bright);
  font-size: 0.65rem;
  font-weight: 750;
}

.section-panel {
  padding: 26px;
  scroll-margin-top: 94px;
}

.section-heading {
  align-items: flex-start;
}

.section-heading p {
  margin-top: 6px;
}

.inline-form {
  display: flex;
  gap: 10px;
  margin-top: 22px;
}

.inline-form .field-control {
  max-width: 420px;
}

.form-hint {
  margin: 8px 0 0;
  color: var(--subtle);
  font-size: 0.68rem;
}

.subject-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin: 19px 0 0;
  padding: 0;
  list-style: none;
}

.subject-row {
  min-height: 57px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 9px 11px 9px 15px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(18, 18, 24, 0.42);
}

.subject-name {
  min-width: 0;
  overflow: hidden;
  color: #e2e0e9;
  font-size: 0.82rem;
  font-weight: 620;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.subject-actions {
  display: flex;
  flex-shrink: 0;
  gap: 7px;
}

.subject-actions .button {
  min-height: 33px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 0.69rem;
}

.subject-edit-form {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
}

.subject-edit-form .field-control {
  min-height: 38px;
  max-width: 430px;
}

.empty-state {
  margin: 17px 0 0;
  padding: 16px;
  border: 1px dashed var(--border-light);
  border-radius: 12px;
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
}

.metrics-section {
  display: flex;
  flex-direction: column;
  gap: 17px;
  scroll-margin-top: 94px;
}

.metrics-section > .section-heading {
  margin-bottom: 1px;
}

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

.metric-card {
  min-height: 160px;
  display: grid;
  grid-template-columns: 44px 1fr;
  grid-template-rows: auto auto auto;
  align-content: center;
  align-items: center;
  column-gap: 13px;
  padding: 22px;
}

.metric-icon {
  width: 42px;
  height: 42px;
  grid-row: 1 / 4;
}

.metric-icon-violet {
  background: var(--accent-soft);
  color: var(--accent-bright);
}

.metric-icon-blue {
  border-color: rgba(121, 186, 255, 0.22);
  background: rgba(45, 70, 100, 0.3);
  color: var(--blue);
}

.metric-label {
  color: var(--muted);
  font-size: 0.72rem;
}

.metric-value {
  margin-top: 1px;
  font-size: 1.8rem;
  font-variant-numeric: tabular-nums;
  font-weight: 730;
  letter-spacing: -0.045em;
  line-height: 1.2;
}

.metric-footnote {
  margin-top: 4px;
  color: var(--subtle);
  font-size: 0.66rem;
}

.breakdown-panel {
  padding: 23px 25px;
}

.breakdown-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 22px;
}

.breakdown-heading h3 {
  margin: 0;
  font-size: 0.91rem;
  font-weight: 680;
}

.breakdown-heading p {
  margin: 5px 0 0;
  color: var(--subtle);
  font-size: 0.7rem;
}

.breakdown-total {
  color: #cbc6ff;
  font-size: 0.75rem;
  font-weight: 650;
  white-space: nowrap;
}

.breakdown-list {
  display: flex;
  flex-direction: column;
  gap: 17px;
}

.breakdown-row {
  display: grid;
  grid-template-columns: minmax(100px, 0.8fr) minmax(130px, 2fr) minmax(74px, auto);
  align-items: center;
  gap: 14px;
}

.breakdown-subject {
  overflow: hidden;
  color: #d1cfda;
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-track {
  height: 7px;
  overflow: hidden;
  border-radius: 99px;
  background: #30303a;
}

.bar-fill {
  height: 100%;
  min-width: 2px;
  border-radius: inherit;
  background: var(--accent);
}

.bar-fill[data-tone="blue"] {
  background: var(--blue);
}

.bar-fill[data-tone="green"] {
  background: var(--green);
}

.breakdown-value {
  color: var(--muted);
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.inline-error {
  margin: 15px 0 0;
  color: #ffabb5;
  font-size: 0.76rem;
}

.history-note {
  margin: 23px 0 0;
  padding-top: 15px;
  border-top: 1px solid var(--border);
  color: var(--subtle);
  font-size: 0.68rem;
}

.settings-panel {
  scroll-margin-top: 94px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 23px;
}

.number-control {
  position: relative;
}

.number-control .field-control {
  padding-right: 52px;
  font-variant-numeric: tabular-nums;
}

.number-control > span {
  position: absolute;
  top: 50%;
  right: 12px;
  color: var(--subtle);
  font-size: 0.68rem;
  pointer-events: none;
  transform: translateY(-50%);
}

.settings-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin-top: 18px;
}

.settings-footer .form-hint {
  margin: 0;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

.site-footer {
  border-top: 1px solid var(--border);
  background: rgba(18, 18, 23, 0.72);
}

.footer-inner {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  padding: 15px 0;
  color: var(--subtle);
  font-size: 0.68rem;
}

.footer-inner strong {
  color: #c7c4d2;
  font-weight: 650;
}

.footer-inner code {
  color: #c0baff;
  font-family: inherit;
  font-size: inherit;
}

@media (max-width: 900px) {
  .header-inner {
    gap: 15px;
  }

  .primary-nav {
    gap: 0;
  }

  .primary-nav a {
    padding: 8px;
    font-size: 0.74rem;
  }

  .dashboard-grid {
    grid-template-columns: minmax(0, 1.1fr) minmax(260px, 0.9fr);
  }

  .timer-panel {
    min-height: 520px;
    padding-inline: 20px;
  }

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

@media (max-width: 700px) {
  .header-inner, .footer-inner, main {
    width: min(100% - 32px, 560px);
  }

  .header-inner {
    min-height: 68px;
    flex-wrap: wrap;
    padding: 12px 0;
  }

  .brand {
    margin-right: auto;
  }

  .primary-nav {
    order: 3;
    width: 100%;
    justify-content: space-between;
    overflow-x: auto;
    border-top: 1px solid var(--border);
    padding-top: 8px;
  }

  .primary-nav a {
    flex: 0 0 auto;
    padding: 7px 9px;
  }

  .account-area {
    min-width: 0;
  }

  .profile-copy {
    display: none;
  }

  main {
    padding: 26px 0 52px;
  }

  .login-layout {
    min-height: auto;
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 36px 25px 20px;
  }

  .login-copy h1 {
    font-size: clamp(2.1rem, 10vw, 3.1rem);
  }

  .login-art {
    width: min(68vw, 285px);
    margin-top: 7px;
  }

  .art-caption {
    right: -2%;
    bottom: 12%;
  }

  .notice {
    margin-bottom: 16px;
  }

  .app-view {
    gap: 20px;
  }

  .page-heading, .section-heading {
    align-items: flex-start;
  }

  .page-heading {
    flex-direction: column;
  }

  .page-heading > .button {
    align-self: flex-start;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .timer-panel {
    min-height: 0;
    padding: 22px 18px;
  }

  .timer-wrap {
    width: min(270px, 70vw);
  }

  .routine-panel {
    padding: 22px 19px;
  }

  .section-panel {
    padding: 21px 17px;
  }

  .inline-form {
    flex-direction: column;
  }

  .inline-form .field-control {
    max-width: none;
  }

  .inline-form .button {
    align-self: flex-start;
  }

  .metric-cards {
    gap: 11px;
  }

  .metric-card {
    min-height: 145px;
    grid-template-columns: 1fr;
    padding: 17px;
  }

  .metric-icon {
    width: 35px;
    height: 35px;
    grid-row: auto;
    margin-bottom: 10px;
  }

  .metric-icon svg {
    width: 18px;
    height: 18px;
  }

  .metric-value {
    margin-top: 4px;
    font-size: 1.55rem;
  }

  .metric-footnote {
    font-size: 0.6rem;
  }

  .breakdown-panel {
    padding: 19px 16px;
  }

  .breakdown-row {
    grid-template-columns: minmax(76px, 0.8fr) minmax(55px, 1fr) auto;
    gap: 9px;
  }

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

  .subject-row {
    align-items: flex-start;
    flex-direction: column;
    padding: 12px;
  }

  .subject-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .subject-edit-form {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .subject-edit-form .field-control {
    max-width: none;
  }

  .footer-inner {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    padding: 18px 0;
  }
}

@media (max-width: 390px) {
  .header-inner, .footer-inner, main {
    width: calc(100% - 24px);
  }

  .brand-mark {
    width: 36px;
    height: 36px;
  }

  .button-discord {
    min-height: 36px;
    padding: 0 10px;
    font-size: 0.68rem;
  }

  .button-small {
    padding: 0 9px;
  }

  .login-layout {
    padding-inline: 20px;
  }

  .settings-grid {
    gap: 11px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
