:root {
  --bg: #000;
  --text: #fff;
  --muted: rgba(255, 255, 255, 0.68);
  --line: rgba(255, 255, 255, 0.86);
  --soft-line: rgba(255, 255, 255, 0.22);
  --green: #4cc64a;
  --green-bg: rgba(76, 198, 74, 0.18);
  --red: #ef2b24;
  --red-bg: rgba(239, 43, 36, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  font-family: "Segoe UI", Arial, sans-serif;
}

.board {
  width: min(1100px, calc(100% - 40px));
  margin: 0 auto;
  padding: 42px 0 70px;
}

.topline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 54px;
}

.device,
.section-title {
  margin: 0;
  color: var(--text);
  font-size: clamp(1.45rem, 3vw, 2.35rem);
  font-weight: 300;
  letter-spacing: 0.02em;
}

h1 {
  margin: 20px 0 0;
  font-size: clamp(4rem, 10vw, 8.5rem);
  line-height: 0.9;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

.small-button {
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 12px 18px;
  color: var(--text);
  background: transparent;
  cursor: pointer;
}

.small-button:hover {
  background: rgba(255, 255, 255, 0.1);
}

.small-button:disabled,
.main-switch:disabled {
  cursor: wait;
  opacity: 0.5;
}

.status-section,
.switch-section,
.timer-section,
.debug-section {
  margin-bottom: 54px;
}

.status-row,
.power-line {
  display: flex;
  align-items: center;
  gap: 34px;
  margin-top: 18px;
  font-size: clamp(2.1rem, 5vw, 4.2rem);
  font-weight: 300;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 18px;
  color: var(--red);
  font-weight: 400;
}

.status-pill::before {
  content: "";
  width: clamp(28px, 4vw, 44px);
  height: clamp(28px, 4vw, 44px);
  border-radius: 50%;
  background: currentColor;
}

.status-online {
  color: var(--green);
}

.status-offline {
  color: var(--red);
}

.message-line {
  margin-top: 16px;
  color: var(--muted);
  font-size: 1rem;
}

.power-line,
.temperature-line {
  width: fit-content;
  max-width: 100%;
  border: 1px solid transparent;
  padding: 12px 18px 16px;
  transition: background 160ms ease, border-color 160ms ease;
}

.power-line strong,
.temperature-line strong {
  font-weight: 300;
  white-space: nowrap;
}

.temperature-line,
.requested-line {
  display: flex;
  align-items: baseline;
  gap: 24px;
  margin-top: 18px;
  font-size: clamp(1.8rem, 4vw, 3.4rem);
  font-weight: 300;
}

.requested-line {
  width: fit-content;
  max-width: 100%;
  border: 1px solid var(--soft-line);
  padding: 10px 18px 14px;
  background: rgba(255, 255, 255, 0.03);
  font-size: clamp(1.6rem, 3.5vw, 3rem);
}

.temperature-line small {
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.35rem);
}

.power-active {
  border-color: rgba(76, 198, 74, 0.55);
  background: var(--green-bg);
}

.power-idle {
  border-color: var(--soft-line);
  background: rgba(255, 255, 255, 0.03);
}

.power-offline {
  border-color: rgba(239, 43, 36, 0.55);
  background: var(--red-bg);
}

.temperature-ok {
  border-color: rgba(76, 198, 74, 0.55);
  background: var(--green-bg);
}

.temperature-limit,
.temperature-unknown {
  border-color: rgba(239, 43, 36, 0.55);
  background: var(--red-bg);
}

.split-buttons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: min(980px, 100%);
  margin-top: 28px;
  border: 2px solid var(--line);
}

.main-switch {
  min-height: 132px;
  border: 0;
  color: var(--text);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.main-switch + .main-switch {
  border-left: 2px solid var(--line);
}

.main-switch span {
  display: block;
  padding: 22px 54px 0;
  font-size: clamp(3.8rem, 7vw, 6.2rem);
  font-weight: 300;
  line-height: 0.9;
}

.main-switch small {
  display: block;
  padding: 8px 54px 22px;
  color: var(--muted);
  font-size: clamp(1.2rem, 3vw, 2rem);
}

.switch-on:hover,
.timer-on:hover,
.timer-on.is-active {
  background: var(--green-bg);
}

.switch-off:hover,
.timer-off:hover,
.timer-off.is-active {
  background: var(--red-bg);
}

.section-header {
  display: flex;
  align-items: baseline;
  gap: 26px;
}

.timer-state {
  color: var(--red);
  font-size: clamp(1.45rem, 3vw, 2.35rem);
  font-weight: 300;
}

.timer-state.is-active {
  color: var(--green);
}

.timer-toggle .main-switch {
  min-height: 118px;
}

.timer-form label {
  display: grid;
  grid-template-columns: 230px minmax(180px, 320px);
  align-items: center;
  gap: 20px;
  width: min(620px, 100%);
  margin-top: 28px;
  font-size: clamp(1.8rem, 4vw, 3.6rem);
  font-weight: 300;
}

input[type="time"] {
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 8px 14px;
  color: var(--text);
  background: transparent;
  font-size: clamp(1.4rem, 3vw, 2.4rem);
}

details {
  width: min(980px, 100%);
  border: 1px solid var(--soft-line);
  padding: 18px;
}

summary {
  cursor: pointer;
  font-size: clamp(1.3rem, 3vw, 2.2rem);
  font-weight: 300;
}

details .small-button {
  margin: 18px 0;
}

.debug-output {
  min-height: 220px;
  max-height: 520px;
  margin: 0;
  overflow: auto;
  border: 1px solid var(--soft-line);
  padding: 14px;
  color: rgba(255, 255, 255, 0.84);
  background: rgba(255, 255, 255, 0.04);
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 0.88rem;
  line-height: 1.45;
}

@media (max-width: 760px) {
  .board {
    width: min(100% - 24px, 1100px);
    padding-top: 28px;
  }

  .topline,
  .status-row,
  .power-line,
  .temperature-line,
  .requested-line,
  .section-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
  }

  .split-buttons {
    grid-template-columns: 1fr;
  }

  .main-switch + .main-switch {
    border-left: 0;
    border-top: 2px solid var(--line);
  }

  .timer-form label {
    grid-template-columns: 1fr;
  }

  .main-switch span {
    padding-right: 28px;
    padding-left: 28px;
  }

  .main-switch small {
    padding-right: 28px;
    padding-left: 28px;
  }
}
