@font-face {
  font-family: 'Sora';
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url('fonts/sora-latin-ext-wght-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'Sora';
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url('fonts/sora-latin-wght-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #0D0E12;
  --card: #17191F;
  --line: #262932;
  --line-strong: #343846;
  --track: #22252D;
  --text: #F2F3F5;
  --text-soft: #D5D7DC;
  --muted: #A3A7B1;
  --lime: #C6F432;
  --warn: #FF8A8A;
  --warn-soft: #FFB3B3;
  --warn-bg: #2A1519;
  --warn-line: #6E2A33;
  --freeze: #8FD3FF;
  --freeze-bg: #13232D;
  --freeze-line: #23465A;
  --radius: 22px;
  --toast-duration: 2600;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Sora', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

:focus:not(:focus-visible) {
  outline: none;
}

a {
  color: var(--lime);
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.app {
  max-width: 520px;
  margin: 0 auto;
}

.screen {
  min-height: 100vh;
  min-height: 100dvh;
  padding: calc(18px + env(safe-area-inset-top)) 16px calc(32px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
}

.topbar-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.topbar-title.small {
  font-size: 17px;
}

.icon-btn {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  text-decoration: none;
}

.text-btn {
  min-height: 44px;
  padding: 0 4px;
  display: inline-flex;
  align-items: center;
  background: none;
  border: 0;
  color: var(--lime);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
}

.text-btn.danger {
  color: var(--warn);
}

.btn-a {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 60px;
  padding: 0 24px;
  border-radius: 999px;
  border: 0;
  background: var(--lime);
  color: var(--bg);
  font-size: 17px;
  font-weight: 700;
  text-decoration: none;
}

.btn-a.small {
  width: auto;
  min-height: 48px;
  padding: 0 18px;
  font-size: 15px;
}

.btn-a.secondary {
  background: var(--track);
  color: var(--text);
  border: 1px solid var(--line-strong);
}

.btn-a:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card.warn {
  background: var(--warn-bg);
  border-color: var(--warn-line);
}

.card.freeze {
  background: var(--freeze-bg);
  border-color: var(--freeze-line);
}

.card-title {
  font-size: 15px;
  font-weight: 700;
}

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

.small-text {
  font-size: 13px;
}

.section-title {
  font-size: 15px;
  font-weight: 700;
  margin-top: 8px;
}

.open-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 12px 12px 16px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--line);
}

.open-card-text {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.open-card-date {
  font-size: 15px;
  font-weight: 600;
}

.ring {
  position: relative;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ring > svg:first-child {
  position: absolute;
  inset: 0;
}

.ring-label {
  position: relative;
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.ring-value {
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.05em;
}

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px 0 4px;
  text-align: center;
}

.hero-title {
  font-size: 15px;
  font-weight: 600;
}

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

.goal-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--text);
  text-decoration: none;
}

.goal-card.is-pending {
  background: var(--warn-bg);
  border-color: var(--warn-line);
}

.goal-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 6px;
}

.goal-card-value {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.goal-card-unit {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0;
}

.goal-card.is-pending .goal-card-unit {
  color: var(--warn-soft);
}

.goal-card-name {
  font-size: 14px;
  font-weight: 600;
}

.chip {
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.chip.warn {
  background: var(--warn);
  color: var(--warn-bg);
}

.chip.due {
  background: #1E3A31;
  color: #4BE3B0;
}

.chip.freeze {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  color: var(--freeze);
  font-size: 12px;
}

.chip.plain {
  padding: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.empty-state {
  text-align: center;
  padding: 48px 8px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
}

.checkin-bar {
  display: flex;
  align-items: center;
  gap: 12px;
}

.segments {
  flex-grow: 1;
  display: flex;
  gap: 4px;
}

.segment {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: var(--track);
}

.segment.is-current {
  background: #5A5F6C;
}

.question {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
  margin-top: 40px;
}

.question-title {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.question-hint {
  max-width: 320px;
  font-size: 15px;
  color: var(--muted);
}

.answers {
  margin-top: auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding-top: 24px;
}

.answer {
  min-height: 112px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 8px;
  border-radius: 28px;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--line-strong);
}

.answer.is-good {
  background: var(--goal, var(--lime));
  color: var(--bg);
  border: 0;
}

.answer[aria-pressed="true"] {
  box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--text);
}

.answer-label {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.answer-sub {
  font-size: 13px;
  font-weight: 500;
}

.review-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

.review-row-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dot {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  border-radius: 50%;
  background: #4A4E5A;
}

.dot.kept,
.dot.rest,
.dot.repaired {
  background: var(--lime);
}

.dot.frozen {
  background: var(--freeze);
}

.dot.pending {
  background: transparent;
  border: 2px solid var(--warn);
}

.dot.broken {
  background: var(--warn);
}

.dot.sick {
  background: #4A4E5A;
  border: 2px solid #C9CCD3;
}

.done {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 10px;
}

.done-title {
  margin-top: 16px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.done-note {
  max-width: 320px;
  color: var(--text-soft);
}

.info-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.info-row-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

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

.stat {
  padding: 12px;
  border-radius: 18px;
  background: var(--card);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-value {
  font-size: 22px;
  font-weight: 700;
}

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

.kv {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
}

.bar {
  height: 8px;
  border-radius: 4px;
  background: var(--track);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--freeze);
}

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

.repair-option {
  padding: 12px;
  border-radius: 16px;
  background: var(--card);
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
}

.calendar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  justify-items: center;
}

.calendar-weekday {
  font-size: 11px;
  color: var(--muted);
}

.day {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  background: var(--track);
  color: var(--muted);
}

.day.kept,
.day.rest {
  background: var(--goal);
  color: var(--bg);
}

.day.rest {
  opacity: 0.55;
}

.day.frozen {
  background: transparent;
  border: 2px solid var(--freeze);
  color: var(--freeze);
}

.day.repaired {
  background: transparent;
  border: 2px solid var(--goal);
  color: var(--text);
}

.day.pending {
  background: var(--warn-bg);
  border: 2px dashed var(--warn);
  color: var(--warn-soft);
}

.day.broken {
  background: var(--warn);
  color: var(--warn-bg);
}

.day.sick {
  background: transparent;
  border: 2px dotted #C9CCD3;
  color: var(--text);
}

.day.open {
  background: transparent;
  border: 2px dashed var(--muted);
  color: var(--text);
}

.day.logged {
  background: transparent;
  border: 2px solid var(--goal);
  color: var(--text);
}

.day.blank {
  visibility: hidden;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  font-size: 12px;
  color: var(--muted);
}

.legend span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend .day {
  width: 12px;
  height: 12px;
  font-size: 0;
  border-width: 2px;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

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

.field-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.field-input {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border-radius: 14px;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  color: var(--text);
  font-size: 16px;
}

.field-input::placeholder {
  color: #7D818C;
}

.field-input.short {
  width: 96px;
  text-align: right;
}

.form-error {
  color: var(--warn-soft);
  font-size: 14px;
}

.swatches,
.icons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: space-between;
}

.swatch {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 0;
  padding: 0;
}

.swatch[aria-pressed="true"],
.icon-choice[aria-pressed="true"] {
  box-shadow: 0 0 0 3px var(--card), 0 0 0 5px var(--text);
}

.icon-choice {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid var(--line-strong);
  background: var(--bg);
  color: var(--goal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.segmented {
  display: grid;
  gap: 4px;
  padding: 4px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.segmented button {
  min-height: 44px;
  padding: 0 4px;
  border-radius: 999px;
  border: 0;
  background: transparent;
  color: #C9CCD3;
  font-size: 13px;
  font-weight: 600;
}

.segmented button[aria-pressed="true"] {
  background: var(--goal);
  color: var(--bg);
}

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

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

.stepper button {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--track);
  border: 1px solid var(--line-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.stepper output {
  min-width: 80px;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 0;
  background: none;
  border: 0;
  text-align: left;
}

.switch-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.switch-label {
  font-size: 15px;
  font-weight: 600;
}

.switch {
  position: relative;
  width: 52px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 16px;
  background: var(--line-strong);
}

.switch::after {
  content: '';
  position: absolute;
  top: 4px;
  left: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--muted);
  transition: left 0.15s;
}

[aria-checked="true"] > .switch {
  background: var(--goal, var(--lime));
}

[aria-checked="true"] > .switch::after {
  left: 24px;
  background: var(--bg);
}

.check-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 0 14px;
  border-radius: 16px;
  background: var(--bg);
  border: 1px solid var(--line);
  text-align: left;
  width: 100%;
}

.checkbox {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  border-radius: 7px;
  border: 2px solid #4A4E5A;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--bg);
}

[aria-checked="true"] > .checkbox {
  background: var(--goal);
  border-color: var(--goal);
}

.checkbox svg {
  visibility: hidden;
}

[aria-checked="true"] > .checkbox svg {
  visibility: visible;
}

.divider {
  height: 1px;
  background: var(--line);
}

.list {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  padding: 8px 14px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: none;
  color: var(--text);
  text-decoration: none;
  width: 100%;
  text-align: left;
}

.list-row:last-child {
  border-bottom: 0;
}

.list-row-text {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.color-dot {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--goal);
}

.time-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.time-input {
  min-height: 44px;
  padding: 0 12px;
  border-radius: 12px;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  color: var(--text);
  font-size: 15px;
}

.milestone-ring {
  color: var(--goal);
}

.badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.badge {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  background: var(--goal);
  color: var(--bg);
}

.badge.is-new {
  background: var(--lime);
  box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--lime);
}

.badge.is-locked {
  background: transparent;
  border: 2px dashed #4A4E5A;
  color: var(--muted);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  padding: 12px 18px;
  border-radius: 16px;
  background: var(--text);
  color: var(--bg);
  font-size: 14px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.toast.is-visible {
  opacity: 1;
}

.login {
  justify-content: center;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 360px;
  width: 100%;
  margin: 0 auto;
}

.login-title {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 16px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::after {
    transition: none !important;
  }
}
