:root {
  color-scheme: light;
  font-family: "Segoe UI Variable", "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
  --ink: #132b50;
  --navy: #101f38;
  --canvas: #f2f7fc;
  --muted: #4b6079;
  --line: #d4e1ee;
  --blue: #225ba3;
  --blue-soft: #e6f0fc;
  --green: #18724e;
  --green-dark: #125638;
  --green-soft: #e4f4ea;
  --yellow: #ffe270;
  --yellow-ink: #705518;
  --yellow-soft: #fff5cc;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-width: 0;
}
h1, h2, p { margin: 0; }
h2 {
  font-size: 1.125rem;
  letter-spacing: -0.025em;
}
button, input { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}

.shell {
  width: min(69rem, calc(100% - 3rem));
  margin-inline: auto;
}
.site-header {
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4.75rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  font-weight: 750;
  letter-spacing: -0.025em;
  text-decoration: none;
}
.brand-mark {
  position: relative;
  flex: none;
  width: 2.3rem;
  height: 2.3rem;
  border-radius: 0.75rem;
  background: linear-gradient(150deg, #2f5784, var(--navy));
}
.brand-mark::before, .brand-mark::after {
  content: "";
  position: absolute;
  top: 0.68rem;
  width: 0.49rem;
  height: 0.92rem;
  border: 1.5px solid var(--yellow);
  border-radius: 0.16rem;
  background: linear-gradient(#86dfad, #86dfad) center 40% / 70% 1px no-repeat,
    linear-gradient(#86dfad, #86dfad) center 65% / 70% 1px no-repeat;
}
.brand-mark::before {
  left: 0.64rem;
  transform: skewY(15deg);
}
.brand-mark::after {
  right: 0.64rem;
  transform: skewY(-15deg);
}
.site-nav {
  display: flex;
  gap: 0.25rem;
}
.nav-link {
  display: grid;
  place-items: center;
  min-height: 2.75rem;
  padding-inline: 1rem;
  border-radius: 0.75rem;
  color: var(--muted);
  font-size: 0.9375rem;
  font-weight: 650;
  text-decoration: none;
}
.nav-link:hover {
  background: #f0f6fd;
  color: var(--green-dark);
}
.nav-link[aria-current="page"] {
  background: var(--blue-soft);
  color: var(--blue);
}

.main-content { padding-block: clamp(1.65rem, 5vw, 4rem) 2rem; }
.page-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.4rem 1rem;
  margin-bottom: 1.45rem;
}
.page-heading h1 {
  font-size: clamp(2.4rem, 6vw, 3.6rem);
  letter-spacing: -0.065em;
  line-height: 1.05;
}
.page-heading h1:focus { outline: none; }
.today-date, .history-summary {
  color: var(--muted);
  font-size: 0.9375rem;
}
.today-date:first-letter { text-transform: uppercase; }
.dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}
.timer-card, .goal-card, .streak-card, .history-day, .history-empty { border-radius: 1.4rem; }
.timer-card {
  padding: clamp(1.25rem, 3vw, 2rem);
  background: radial-gradient(ellipse at 86% 0%, #2f5784 0%, var(--ink) 54%, var(--navy) 100%);
  color: #fff;
  box-shadow: 0 12px 24px rgb(16 31 56 / 16%);
}
.timer-card :focus-visible { outline-color: #a9d1f9; }
.card-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  column-gap: 0.6rem;
}
.timer-card h2 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.clock-icon {
  position: relative;
  width: 1.12rem;
  height: 1.12rem;
  border: 1.5px solid #a9d1f9;
  border-radius: 50%;
}
.clock-icon::after {
  content: "";
  position: absolute;
  left: 48%;
  top: 21%;
  width: 35%;
  height: 36%;
  border-left: 1.5px solid #a9d1f9;
  border-bottom: 1.5px solid #a9d1f9;
}
.timer-status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  max-width: 100%;
  padding: 0.36rem 0.65rem;
  border: 1px solid #627e9f;
  border-radius: 2rem;
  background: #ffffff0b;
  color: #e4f1ff;
  font-size: 0.875rem;
}
.timer-status::before {
  content: "";
  width: 0.4rem;
  height: 0.4rem;
  flex: none;
  border-radius: 50%;
  background: #acbed5;
}
.timer-status[data-state="running"]::before { background: #86dfad; }
.timer-status[data-state="paused"]::before { background: var(--yellow); }
.timer-clock {
  margin-block: 1.8rem 1.65rem;
  color: #f4f9ff;
  text-align: center;
  font-size: clamp(2.55rem, 7.45vw, 6rem);
  font-weight: 650;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.07em;
  white-space: nowrap;
}
.subject-field label, #goal-form label {
  display: block;
  margin-bottom: 0.45rem;
  font-size: 0.9375rem;
  font-weight: 650;
}
.subject-field input, #goal-minutes {
  width: 100%;
  min-height: 3rem;
  padding: 0.65rem 0.875rem;
  border: 1px solid #93abc5;
  border-radius: 0.7rem;
}
.subject-field input {
  background: #fff1;
  border-color: #7494b8;
  color: #fff;
}
.subject-field input::placeholder { color: #cbd9ea; }
.subject-field input[readonly] { color: #e3eef8; }
.timer-actions, .dialog-actions {
  display: flex;
  gap: 0.65rem;
  margin-top: 0.95rem;
}
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 3rem;
  padding: 0.55rem 1rem;
  border: 1px solid transparent;
  border-radius: 0.7rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
}
.button-start {
  flex: 1;
  background: var(--yellow);
  color: var(--navy);
}
.button-start:hover { background: #ffedaa; }
.button-finish {
  flex: 1;
  border-color: #93abc5;
  background: #ffffff0f;
  color: #fff;
}
.button-finish:hover:not(:disabled) { background: #ffffff21; }
.button-finish:disabled {
  border-color: #53749c;
  background: transparent;
  color: #b2c5dd;
  cursor: default;
}
.timer-action-icon {
  display: inline-block;
  width: 0.63rem;
  height: 0.75rem;
  border-block: 0.375rem solid transparent;
  border-left: 0.6rem solid currentColor;
}
#timer-toggle[data-state="running"] .timer-action-icon {
  border: 0;
  border-inline: 0.19rem solid currentColor;
}

.progress-column {
  display: grid;
  gap: 1.25rem;
}
.goal-card {
  padding: clamp(1.15rem, 2.5vw, 1.6rem);
  border: 1px solid var(--line);
  background: #fff;
}
.text-button {
  min-height: 2.75rem;
  padding: 0.3rem 0;
  border: 0;
  background: transparent;
  color: var(--green-dark);
  font-size: 0.875rem;
  font-weight: 700;
}
.text-button:hover {
  text-decoration: underline;
  text-underline-offset: 0.23em;
}
.goal-numbers {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-block: 0.85rem 0.75rem;
  overflow-wrap: anywhere;
}
.goal-numbers strong {
  font-size: clamp(1.9rem, 4vw, 2.65rem);
  line-height: 1.1;
  letter-spacing: -0.055em;
}
.goal-target { color: var(--muted); }
progress {
  display: block;
  width: 100%;
  height: 0.65rem;
  overflow: hidden;
  border: 0;
  border-radius: 1rem;
  appearance: none;
  color: var(--green);
  background: var(--green-soft);
}
progress::-webkit-progress-bar {
  border-radius: 1rem;
  background: var(--green-soft);
}
progress::-webkit-progress-value {
  border-radius: 1rem;
  background: var(--green);
}
progress::-moz-progress-bar {
  border-radius: 1rem;
  background: var(--green);
}
.goal-status, .goal-pending {
  margin-top: 0.85rem;
  color: var(--muted);
  font-size: 0.9375rem;
}
.goal-pending {
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
  color: var(--green-dark);
  overflow-wrap: anywhere;
}

.streak-card {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  min-height: 7rem;
  padding: clamp(1.15rem, 2.5vw, 1.6rem);
  border: 1px solid #c8e7d6;
  background: var(--green-soft);
}
.streak-icon {
  position: relative;
  display: block;
  flex: none;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 0.85rem;
  background: var(--yellow-soft);
}
.streak-icon::before {
  content: "";
  position: absolute;
  left: 0.77rem;
  top: 0.76rem;
  width: 1.03rem;
  height: 1.1rem;
  transform: rotate(-33deg);
  border: 1.5px solid var(--green-dark);
  border-radius: 60% 8% 54% 50%;
}
.streak-icon::after {
  content: "";
  position: absolute;
  left: 1.12rem;
  top: 1.25rem;
  width: 0.4rem;
  height: 0.47rem;
  transform: rotate(20deg);
  border-radius: 68% 8% 60% 50%;
  background: var(--green);
}
.streak-copy { flex: 1; }
.streak-copy p {
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.35;
}
.streak-value {
  display: grid;
  justify-items: center;
  flex: none;
  color: var(--green-dark);
}
.streak-value strong {
  font-size: 2rem;
  line-height: 1;
  letter-spacing: -0.05em;
}
.streak-value span { font-size: 0.875rem; }

.history-list {
  display: grid;
  gap: 1rem;
}
.history-day, .history-empty {
  border: 1px solid var(--line);
  background: #fff;
}
.history-empty {
  display: grid;
  justify-items: center;
  gap: 0.75rem;
  padding: 2.5rem 1.25rem;
  text-align: center;
}
.history-empty p {
  max-width: 28rem;
  color: var(--muted);
}
.history-empty .button { margin-top: 0.25rem; }
.history-icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 3.4rem;
  height: 3.4rem;
  border-radius: 1rem;
  background: var(--blue-soft);
}
.history-icon::before {
  content: "";
  width: 1.2rem;
  height: 1.45rem;
  border: 2px solid var(--blue);
  border-radius: 0.2rem;
}
.history-icon::after {
  content: "";
  position: absolute;
  width: 0.55rem;
  height: 0.3rem;
  border-block: 1.5px solid var(--blue);
}
.history-day { padding-inline: clamp(1rem, 3vw, 1.5rem); }
.history-day-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.2rem 1rem;
  padding-block: 1.1rem;
}
.history-day-heading h2:first-letter { text-transform: uppercase; }
.history-day-total, .session-duration {
  color: var(--muted);
  font-size: 0.9375rem;
}
.history-sessions {
  margin: 0;
  padding: 0;
  list-style: none;
}
.history-session {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(5rem, auto) 5rem;
  align-items: center;
  column-gap: 0.8rem;
  min-height: 3.55rem;
  padding-block: 0.55rem;
  border-top: 1px solid var(--line);
}
.session-subject {
  font-weight: 650;
  overflow-wrap: anywhere;
}
.session-duration { text-align: right; }
.difficulty-pill {
  justify-self: end;
  padding: 0.27rem 0.6rem;
  border-radius: 1rem;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 0.875rem;
}
.difficulty-pill[data-difficulty="easy"] {
  background: var(--green-soft);
  color: var(--green-dark);
}
.difficulty-pill[data-difficulty="hard"] {
  background: var(--yellow-soft);
  color: var(--yellow-ink);
}

.history-sync {
  margin-bottom: 0.9rem;
  color: var(--green-dark);
  font-size: 0.9375rem;
}

.session-pending {
  grid-column: 1 / -1;
  color: var(--yellow-ink);
  font-size: 0.875rem;
}

.account-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}

.account-access, .account-settings {
  display: grid;
  gap: 1.25rem;
}

.account-card {
  padding: clamp(1rem, 2.5vw, 1.6rem);
  border: 1px solid var(--line);
  border-radius: 1.4rem;
  background: #fff;
  overflow-wrap: anywhere;
}

.account-card p {
  margin-top: 0.45rem;
  color: var(--muted);
  line-height: 1.45;
}

.account-card .account-pending { color: var(--green-dark); }

#auth-form label {
  display: block;
  margin: 1rem 0 0.4rem;
  font-size: 0.9375rem;
  font-weight: 650;
}

#auth-form input {
  width: 100%;
  min-height: 3rem;
  padding: 0.65rem 0.875rem;
  border: 1px solid #93abc5;
  border-radius: 0.7rem;
  color: inherit;
}

.account-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1rem;
  align-items: center;
  margin-top: 1rem;
}

.account-actions button:disabled, #account-logout:disabled {
  opacity: 0.65;
  cursor: wait;
}

.account-error { margin-top: 1rem; }

.site-footer {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-top: 1.65rem;
  color: var(--muted);
  font-size: 0.875rem;
}
.device-icon {
  position: relative;
  width: 0.95rem;
  height: 0.66rem;
  border: 1.5px solid currentColor;
  border-radius: 0.12rem;
}
.device-icon::after {
  content: "";
  position: absolute;
  left: -0.13rem;
  right: -0.13rem;
  bottom: -0.25rem;
  border-top: 1.5px solid currentColor;
}
.app-feedback:not(:empty), .storage-error {
  padding: 0.75rem 1rem;
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  background: var(--blue-soft);
  color: var(--blue);
}
.app-feedback:not(:empty) { margin-top: 1.1rem; }
.storage-error {
  margin-bottom: 1rem;
  border-color: #dfc579;
  background: var(--yellow-soft);
  color: var(--yellow-ink);
}
.dialog-error { margin-block: 0.9rem 0; }

dialog {
  width: min(28rem, calc(100% - 2rem));
  max-height: calc(100dvh - 2rem);
  padding: clamp(1.15rem, 4vw, 1.65rem);
  border: 1px solid var(--line);
  border-radius: 1.25rem;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 24px 65px #101f3842;
}
dialog::backdrop { background: #101f389c; }
dialog h2 { font-size: 1.5rem; }
.dialog-note {
  margin-block: 0.6rem 1.15rem;
  color: var(--muted);
}
.finish-summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-block: 0.65rem 1.15rem;
  color: var(--muted);
}
.finish-summary strong {
  overflow-wrap: anywhere;
  color: var(--ink);
}
.finish-summary span { flex: none; }
.difficulty-options {
  min-inline-size: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
.difficulty-options legend {
  margin-bottom: 0.55rem;
  padding: 0;
  font-weight: 650;
}
.choice-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
}
.choice-row label {
  position: relative;
  cursor: pointer;
}
.choice-row input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.choice-row span {
  display: grid;
  place-items: center;
  min-height: 2.75rem;
  padding: 0.3rem;
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  font-weight: 600;
}
.choice-row input:checked + span {
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--green-dark);
}
.choice-row input:focus-visible + span {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}
.dialog-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 1.35rem;
}
.button-primary {
  background: var(--green);
  color: #fff;
}
.button-primary:hover { background: var(--green-dark); }
.button-secondary {
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
}
.button-secondary:hover { background: var(--blue-soft); }

@media (max-width: 47rem) {
  .account-grid { grid-template-columns: minmax(0, 1fr); }
  .dashboard {
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
  }
  .progress-column { gap: 1rem; }
  .timer-clock { font-size: clamp(2.5rem, 10vw, 5.7rem); }
}

@media (max-width: 38rem) {
  .header-inner {
    flex-wrap: wrap;
    gap: 0.4rem;
    padding-block: 0.75rem 0.6rem;
  }
  .site-nav {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    width: 100%;
  }
  .site-nav .nav-link {
    padding-inline: 0.25rem;
    font-size: 0.875rem;
  }
  .brand { min-height: 2.75rem; }
}

@media (max-width: 32rem) {
  .shell { width: calc(100% - 2rem); }
  .page-heading {
    flex-direction: column;
    margin-bottom: 1.05rem;
  }
}

@media (max-width: 22rem) {
  .history-session {
    grid-template-columns: minmax(0, 1fr) auto;
    row-gap: 0.3rem;
  }
  .session-subject { grid-column: 1 / -1; }
  .session-duration { text-align: left; }
}
