:root {
  --bg: #0b0d11;
  --fg: #d8d6cf;
  --dim: #7d7b74;
  --accent: #c8b78a;
  --orb: #2a2d35;
  --orb-live: #6d5f3f;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family:
    ui-serif,
    "Iowan Old Style",
    "Palatino Linotype",
    Georgia,
    serif;
  -webkit-font-smoothing: antialiased;
}

.shell {
  min-height: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
}

/* Access gate: nothing on the page but the code field, centered. */
.gate {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
}

.top {
  text-align: center;
}

h1 {
  margin: 0;
  font-weight: 400;
  font-size: 28px;
  letter-spacing: 0.18em;
}

.sub {
  margin: 6px 0 0;
  color: var(--dim);
  font-size: 14px;
  font-style: italic;
}

/* Stacked slots: every child shares one grid cell, so states can crossfade
   in place without the layout moving. */
.stage,
.slot {
  display: grid;
  place-items: center;
  width: 100%;
}

.stage > *,
.slot > * {
  grid-area: 1 / 1;
}

.stage {
  height: 132px;
}

.orb {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #3a3e48, var(--orb) 70%);
  transition:
    background 1.2s ease,
    box-shadow 1.2s ease,
    transform 1.2s ease;
}

.orb.connecting {
  animation: pulse 1.8s ease-in-out infinite;
}

.orb.live {
  background: radial-gradient(circle at 40% 35%, #a08a55, var(--orb-live) 70%);
  box-shadow: 0 0 60px 8px rgba(200, 183, 138, 0.18);
  animation: breathe 6s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.7;
  }
  50% {
    transform: scale(1.06);
    opacity: 1;
  }
}

@keyframes breathe {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.08);
  }
}

.controls {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.row {
  display: flex;
  gap: 12px;
  justify-content: center;
  width: 100%;
}

.hidden {
  display: none;
}

button {
  font: inherit;
  font-size: 15px;
  letter-spacing: 0.08em;
  padding: 12px 28px;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition:
    background 0.3s,
    border-color 0.3s,
    opacity 0.3s;
}

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

button.primary {
  background: var(--accent);
  color: #15130d;
}

button.primary:not(:disabled):hover {
  background: #d9c99c;
}

button.secondary {
  background: transparent;
  color: var(--fg);
  border-color: #2e313a;
}

button.secondary:not(:disabled):hover {
  border-color: var(--dim);
}

/* Voice toggle. Rendered from /api/config; the border appears with the buttons. */
.segment {
  display: inline-flex;
  min-height: 38px;
  padding: 3px;
  gap: 2px;
  border-radius: 999px;
  border: 1px solid transparent;
}

.segment.ready {
  border-color: #2e313a;
}

.segment button {
  font-size: 13px;
  letter-spacing: 0.06em;
  padding: 7px 16px;
  border: none;
  background: transparent;
  color: var(--dim);
}

.segment button[aria-checked="true"] {
  background: #1a1d25;
  color: var(--fg);
}

.segment button:not(:disabled):not([aria-checked="true"]):hover {
  color: var(--fg);
}

input[type="password"] {
  font: inherit;
  font-size: 15px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid #2e313a;
  background: #11141a;
  color: var(--fg);
  width: 220px;
  text-align: center;
  outline: none;
}

input[type="password"]:focus {
  border-color: var(--dim);
}

.status {
  margin: 0;
  color: var(--dim);
  font-size: 14px;
  min-height: 1.4em;
  text-align: center;
}

.status.error {
  color: #c98a7a;
}

.timer {
  margin: 0;
  color: var(--dim);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  min-height: 1.2em;
}

button.small {
  font-size: 13px;
  padding: 8px 18px;
}

/* Gentle show/hide. Hidden elements keep their space (so nothing jumps) and
   become non-interactive. Visibility flips after the fade when hiding, and
   immediately when showing, so the fade-in is visible. */
.fade {
  transition:
    opacity 1s ease,
    visibility 0s linear 0s;
}

.fade.gone {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 1s ease,
    visibility 0s linear 1s;
}
