:root {
  color-scheme: light;
  --ink: #173033;
  --muted: #627276;
  --paper: #f4f7f6;
  --surface: #ffffff;
  --line: #d8e2df;
  --teal: #126b69;
  --teal-soft: #e3f1ef;
  --green: #2f7d5b;
  --amber: #b87927;
  --amber-soft: #fff4e5;
  --coral: #b95c4b;
  --blue: #3b6f8c;
  --shadow: 0 14px 34px rgba(23, 48, 51, 0.10);
  font-family: "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.45;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: default;
  opacity: 0.52;
}

[hidden] {
  display: none !important;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 68px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 28px;
  align-items: center;
  gap: 10px;
  padding: max(10px, env(safe-area-inset-top)) 16px 10px;
  color: #fff;
  background: #183b3d;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.brand {
  grid-column: 2;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: var(--teal);
  font-size: 13px;
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand strong {
  font-size: 16px;
}

.brand small {
  color: #c8ddda;
  font-size: 12px;
}

.icon-button {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: rgba(255, 255, 255, 0.10);
  font-size: 24px;
}

.connection-dot {
  grid-column: 3;
  width: 12px;
  height: 12px;
  justify-self: center;
  border-radius: 50%;
  background: #9aa8aa;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.08);
}

.connection-dot.online {
  background: #70d59a;
}

.connection-dot.offline {
  background: #f19b86;
}

.app-shell {
  width: min(100%, 720px);
  min-height: calc(100dvh - 68px);
  margin: 0 auto;
  padding: 20px 16px calc(24px + env(safe-area-inset-bottom));
}

.screen {
  display: grid;
  gap: 16px;
}

.centered {
  min-height: calc(100dvh - 116px);
  align-content: center;
  justify-items: center;
  text-align: center;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.2;
}

h2 {
  font-size: 20px;
}

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

.device-image {
  width: min(100%, 420px);
  height: 210px;
  object-fit: contain;
  object-position: center;
}

.status-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--green);
  font-weight: 650;
  text-align: center;
}

.status-line.unavailable {
  color: var(--coral);
}

.price {
  text-align: center;
}

.price strong {
  display: block;
  font-size: 38px;
  line-height: 1.1;
}

.primary-button,
.secondary-button,
.danger-button,
.choice-button,
.program-button {
  width: 100%;
  min-height: 54px;
  border-radius: 8px;
  transition: background-color 140ms ease, border-color 140ms ease;
}

.primary-button {
  border: 1px solid var(--teal);
  color: #fff;
  background: var(--teal);
  font-weight: 700;
}

.secondary-button {
  border: 1px solid var(--teal);
  color: var(--teal);
  background: var(--surface);
  font-weight: 650;
}

.danger-button {
  border: 1px solid #d8a397;
  color: var(--coral);
  background: var(--surface);
  font-weight: 650;
}

.choices,
.programs {
  display: grid;
  gap: 12px;
}

.choice-button,
.program-button {
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--surface);
  text-align: left;
  box-shadow: 0 5px 16px rgba(23, 48, 51, 0.05);
}

.choice-button {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 14px;
}

.choice-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--teal);
  background: var(--teal-soft);
  font-size: 15px;
  font-weight: 800;
}

.choice-button strong,
.choice-button small,
.program-button strong,
.program-button span,
.program-button small {
  display: block;
}

.choice-button small,
.program-button small {
  color: var(--muted);
}

.program-button {
  padding: 16px;
}

.program-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
}

.tag {
  padding: 4px 8px;
  border-radius: 6px;
  color: var(--teal);
  background: var(--teal-soft);
  font-size: 12px;
  font-weight: 650;
}

.safety-panel {
  padding: 14px;
  border: 1px solid #efd7b5;
  border-radius: 8px;
  color: #65471f;
  background: var(--amber-soft);
}

.safety-panel ul {
  margin: 8px 0 0;
  padding-left: 20px;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  font-weight: 650;
}

.field input {
  width: 100%;
  height: 52px;
  padding: 0 14px;
  border: 1px solid #aebcba;
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface);
  font-size: 18px;
}

.check-list {
  display: grid;
  gap: 10px;
}

.check-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.check-row input {
  width: 22px;
  height: 22px;
  margin: 1px 0 0;
  accent-color: var(--teal);
}

.spinner {
  width: 42px;
  height: 42px;
  border: 4px solid #cfe1de;
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin 900ms linear infinite;
}

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

.timer {
  font-size: 64px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

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

.metric {
  min-height: 98px;
  display: grid;
  place-content: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: center;
  background: var(--surface);
}

.metric strong {
  font-size: 28px;
}

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

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

.progress-track {
  width: 100%;
  height: 8px;
  overflow: hidden;
  border-radius: 4px;
  background: #dfe9e7;
}

.progress-fill {
  height: 100%;
  background: var(--green);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom));
  z-index: 20;
  width: min(calc(100% - 32px), 560px);
  transform: translateX(-50%);
  padding: 12px 14px;
  border-radius: 8px;
  color: #fff;
  background: #263c40;
  box-shadow: var(--shadow);
  text-align: center;
}

.noscript {
  margin: 32px;
  padding: 16px;
  border: 1px solid var(--coral);
  border-radius: 8px;
  background: var(--surface);
}

@media (min-width: 680px) {
  .app-shell {
    padding-top: 28px;
  }

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

  .device-image {
    height: 260px;
  }
}

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