:root {
  --orange: #ff8a00;
  --orange-press: #e67c00;
  --ok: #1f9d55;
  --bad: #d64545;
  --bg: #fbfaf8;
  --fg: #1b1a19;
  --muted: #6b6762;
  --line: #e7e3de;
  --disabled-bg: #e9e6e2;
  --disabled-fg: #8f8a84;
  --card: #ffffff;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121110;
    --fg: #f3f1ee;
    --muted: #a39e98;
    --line: #2a2826;
    --disabled-bg: #2a2826;
    --disabled-fg: #77726c;
    --card: #1b1a19;
  }
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 17px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  padding: env(safe-area-inset-top) max(16px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(16px, env(safe-area-inset-left));
  -webkit-tap-highlight-color: transparent;
}

.top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 0;
}
.top .title { font-weight: 650; letter-spacing: 0.01em; }
.top .link { margin-left: auto; }

.banner {
  background: #fff3e0;
  color: #8a4b00;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 14px;
  text-align: center;
}
@media (prefers-color-scheme: dark) {
  .banner { background: #3a2a14; color: #ffc680; }
}

main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.view {
  width: 100%;
  max-width: 420px;
  text-align: center;
}

h1 { font-size: 30px; line-height: 1.15; margin: 0 0 12px; }
.muted { color: var(--muted); }
.hello { color: var(--muted); margin: 0 0 28px; }
.hello .as:not(:empty)::before { content: " · "; }

.cta {
  display: inline-block;
  margin-top: 18px;
  padding: 15px 26px;
  border-radius: 14px;
  color: #fff;
  font-weight: 650;
  text-decoration: none;
}
.cta.hoiv { background: var(--fg); color: var(--bg); }

.link {
  background: none;
  border: 0;
  padding: 6px 4px;
  color: var(--muted);
  font: inherit;
  font-size: 15px;
  cursor: pointer;
}
a { color: inherit; }

/* The button */
.door {
  --size: min(72vw, 300px);
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  border: 0;
  background: var(--orange);
  color: #fff;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font: inherit;
  font-size: 24px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 30px rgb(255 138 0 / 0.35);
  transition: transform 120ms ease, background-color 200ms ease, box-shadow 200ms ease;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
.door:active:not(:disabled) { transform: scale(0.97); background: var(--orange-press); }
/* Grey only while it can't be used; while opening or showing the result it keeps its colour. */
.door:disabled:not([data-state]) {
  background: var(--disabled-bg);
  color: var(--disabled-fg);
  box-shadow: none;
  cursor: not-allowed;
}
.door:disabled[data-state] { cursor: default; }
.door .icon { width: 64px; height: 64px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.door .icon-open { display: none; }

.door[data-state="opening"] { animation: pulse 1s ease-in-out infinite; }
.door[data-state="opened"] { background: var(--ok); box-shadow: 0 10px 30px rgb(31 157 85 / 0.35); }
.door[data-state="opened"] .icon-open { display: block; }
.door[data-state="opened"] .icon-closed { display: none; }
.door[data-state="failed"] { background: var(--bad); box-shadow: 0 10px 30px rgb(214 69 69 / 0.3); }

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(0.96); }
}
@media (prefers-reduced-motion: reduce) {
  .door[data-state="opening"] { animation: none; opacity: 0.85; }
}

.status {
  margin: 26px 0 0;
  font-weight: 550;
  min-height: 1.45em;
}
.status::before {
  content: "";
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: 1px;
  background: var(--disabled-fg);
}
.status[data-tone="ok"]::before { background: var(--ok); }
.status[data-tone="bad"]::before { background: var(--bad); }
.status[data-tone="note"]::before { background: var(--orange); }

.hint {
  margin: 8px auto 0;
  max-width: 340px;
  color: var(--muted);
  font-size: 15px;
}

.error {
  color: var(--bad);
  font-weight: 550;
}

.log {
  width: 100%;
  max-width: 420px;
  margin: 0 auto 10px;
  font-size: 14px;
}
.log summary {
  cursor: pointer;
  color: var(--muted);
  text-align: center;
  padding: 6px 0;
}
.log ol {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 40vh;
  overflow-y: auto;
  border-top: 1px solid var(--line);
}
.log li {
  padding: 7px 2px;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}
.log li[data-outcome="failed"] { color: var(--bad); }
.log li[data-outcome="refused"] { color: var(--muted); }

.install {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 auto 10px;
  max-width: 420px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  font-size: 14px;
}
.install .link { margin-left: auto; }

.foot {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  padding: 12px 0 18px;
}

[hidden] { display: none !important; }
