:root {
  --navy: #0e1a2b;
  --panel: #16263a;
  --panel-edge: #3a4d3a;
  --hunter: #2c5e45;
  --hunter-active: #3e7a5a;
  --brass: #c6a15a;
  --text: #e7efe4;
  --muted: #c9bea4;
  --danger: #e7c9a4;
  color: var(--text);
  background: var(--navy);
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  font-size: 18px;
  line-height: 1.4;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(800px 380px at 50% -12%, rgb(198 161 90 / 22%), transparent 62%),
    var(--navy);
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

#app {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px 40px;
}

.panel {
  width: min(100%, 28rem);
  background: var(--panel);
  border: 1px solid var(--brass);
  border-radius: 28px;
  padding: 28px 22px 24px;
  box-shadow: 0 24px 60px rgb(0 0 0 / 35%);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

/* The icon that switches between the lights and the blanket site. */
.site-switch {
  margin-left: auto;
  width: 46px;
  height: 46px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 2px solid var(--panel-edge);
  color: var(--brass);
}

.site-switch:hover,
.site-switch:focus-visible {
  border-color: var(--brass);
  outline: none;
}

.horse {
  width: 72px;
  height: 72px;
  flex: none;
  object-fit: cover;
  border-radius: 50%;
  border: 3px solid var(--brass);
  background: var(--navy);
}

h1 {
  margin: 0;
  font-family: Georgia, "Iowan Old Style", Palatino, serif;
  font-size: clamp(1.45rem, 6.2vw, 1.85rem);
  letter-spacing: 0.01em;
  font-weight: 600;
}

.sub {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.state {
  margin: 28px 0 0;
  font-family: Georgia, "Iowan Old Style", Palatino, serif;
  font-size: clamp(2rem, 8vw, 2.4rem);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.state.on {
  color: #d5efe0;
}

.countdown {
  min-height: 1.6rem;
  margin: 4px 0 0;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 22px;
}

.durations {
  grid-template-columns: repeat(3, 1fr);
  margin-top: 12px;
}

.action,
.duration {
  border-radius: 16px;
  min-height: 64px;
  border: 2px solid transparent;
  background: var(--hunter);
  color: var(--text);
}

.action.primary,
.duration {
  background: var(--hunter);
}

.action.off {
  background: transparent;
  border-color: var(--panel-edge);
}

.action.active,
.duration.active {
  background: var(--hunter-active);
  border-color: var(--brass);
}

.action.off.active {
  background: transparent;
  border-color: var(--brass);
}

.banner {
  min-height: 1.4rem;
  margin: 18px 0 0;
  color: var(--danger);
}

input[type="text"] {
  width: 100%;
  min-height: 64px;
  padding: 0 16px;
  border-radius: 16px;
  border: 2px solid var(--panel-edge);
  background: var(--navy);
}

input:focus,
button:focus-visible {
  outline: 3px solid var(--hunter-active);
  outline-offset: 2px;
}

.login-form {
  display: grid;
  gap: 12px;
  margin-top: 28px;
}

.login-form label {
  color: var(--muted);
}

.login-form button {
  min-height: 64px;
  border: 0;
  border-radius: 16px;
  background: var(--hunter);
}

@media (max-width: 380px) {
  .horse {
    width: 60px;
    height: 60px;
  }

  .panel {
    padding-inline: 16px;
  }

  .sub {
    font-size: 0.88rem;
  }
}

[hidden] {
  display: none !important;
}

.signout {
  display: block;
  margin: 22px auto 0;
  padding: 8px 12px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 0.92rem;
  text-decoration: underline;
}

.changed-by,
.whoami {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.whoami {
  margin-top: 22px;
  text-align: center;
}

.whoami + .signout {
  margin-top: 4px;
}

/* Toasts: what other people (and the timer) did. Top center on phones, where
   they only cover the title; top right on wider screens. Newest on top. */
.toasts {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  width: min(calc(100% - 32px), 28rem);
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  pointer-events: none;
  z-index: 10;
}

@media (min-width: 900px) {
  .toasts {
    left: auto;
    right: 24px;
    transform: none;
    width: 22rem;
  }
}

.toast {
  padding: 14px 18px;
  border-radius: 16px;
  border: 1px solid var(--brass);
  background: var(--hunter);
  color: var(--text);
  box-shadow: 0 12px 30px rgb(0 0 0 / 40%);
  animation: toast-in 180ms ease-out;
  transition: opacity 300ms ease;
}

.toast.leaving {
  opacity: 0;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .toast {
    animation: none;
    transition: none;
  }
}
