:root {
  --bg: #0f1320;
  --panel: #1a2031;
  --panel-elev: #222b43;
  --panel-soft: #20283d;
  --text: #f2f5fb;
  --muted: #9aa6c0;
  --primary: #28c0a8;
  --primary-strong: #1bc7aa;
  --danger: #d84444;
  --ok: #27a562;
  --warn: #d4a530;
  --border: #2e3852;
  --focus: rgba(40, 192, 168, 0.28);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 20% 0%, rgba(43, 75, 160, 0.24), transparent 42%),
    radial-gradient(circle at 85% 12%, rgba(13, 131, 120, 0.16), transparent 36%),
    radial-gradient(circle at top, #20253a, #0f1320 45%, #0b101b);
  color: var(--text);
}

a {
  color: var(--primary);
}

.ar-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px clamp(12px, 2vw, 20px);
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

h1 {
  margin: 0;
  font-size: clamp(1.4rem, 2.8vw, 1.95rem);
  letter-spacing: 0.01em;
}

.subhead {
  margin: 4px 0 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.status.connected {
  color: #d9ffe8;
  border-color: #2f7f58;
}

.status.error {
  color: #ffd8d8;
  border-color: #9e3a3a;
}

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

.control-row {
  display: grid;
  grid-template-columns: minmax(230px, 1.15fr) minmax(210px, 1fr) minmax(180px, 0.75fr);
  align-items: end;
  gap: 12px;
  margin-bottom: 8px;
}

.recipe-picker {
  display: grid;
  gap: 6px;
}

.recipe-label {
  font-size: 0.74rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}

.recipe-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.recipe-option {
  position: relative;
  display: block;
  cursor: pointer;
}

.recipe-option input {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}

.recipe-option-text {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 52px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--panel-elev), var(--panel));
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  user-select: none;
  transition: border-color 120ms ease, filter 120ms ease, transform 120ms ease;
}

.recipe-option:hover .recipe-option-text {
  border-color: #4a5b86;
  filter: brightness(1.06);
}

.recipe-option input:checked + .recipe-option-text {
  border-color: transparent;
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: #062922;
}

.recipe-option input:focus-visible + .recipe-option-text {
  box-shadow: 0 0 0 3px var(--focus);
}

.recipe-option input:disabled + .recipe-option-text {
  opacity: 0.58;
  cursor: not-allowed;
}

.ar-button-slot {
  min-height: 52px;
  display: flex;
  align-items: flex-end;
}

.help-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 8px 0 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(78, 93, 132, 0.48);
  background: rgba(19, 26, 42, 0.72);
}

.help-text {
  font-size: 0.82rem;
  color: var(--muted);
}

.btn {
  border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--panel-elev), var(--panel));
  color: var(--text);
  border-radius: 12px;
  min-height: 52px;
  padding: 0 14px;
  font-size: 0.98rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 120ms ease, transform 120ms ease, filter 120ms ease;
}

.btn:hover:not(:disabled) {
  border-color: #4a5b86;
  filter: brightness(1.06);
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.btn.primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: #062922;
  border-color: transparent;
  font-weight: 700;
}

.btn.danger {
  background: var(--danger);
  color: #fff;
  border-color: transparent;
}

.ar-native-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  width: 100%;
  min-height: 52px;
  border-radius: 12px;
  font-size: 0.92rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.hud-panel,
.xr-container {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.hud-header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
  margin-bottom: 8px;
}

.hud-header h2 {
  margin: 0;
  font-size: 1.05rem;
}

#progress-updated {
  color: var(--muted);
  font-size: 0.76rem;
}

.progress-list {
  display: grid;
  gap: 8px;
}

.progress-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-soft);
  padding: 8px 10px;
}

.progress-item.done {
  border-color: #2c7c56;
}

.progress-item.in_progress {
  border-color: #d4a530;
}

.progress-item.wait {
  border-color: #455175;
}

.progress-step {
  font-size: 0.9rem;
}

.progress-state {
  margin-top: 4px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.xr-container {
  margin-top: 12px;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  position: relative;
}

.hud-floating {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 12;
  width: min(350px, calc(100% - 20px));
  max-height: calc(100% - 20px);
  overflow: auto;
  padding: 10px;
  background: rgba(18, 23, 36, 0.82);
  border: 1px solid rgba(154, 166, 192, 0.28);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.xr-container canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.hidden-media {
  display: none;
}

.transcript-strip {
  position: fixed;
  left: 50%;
  bottom: max(12px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(980px, calc(100% - 20px));
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 14px;
  background: rgba(6, 10, 17, 0.72);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  padding: 10px 12px;
  z-index: 50;
  pointer-events: none;
}

.transcript-history {
  font-size: 0.74rem;
  color: rgba(242, 245, 251, 0.66);
  margin-bottom: 3px;
  line-height: 1.35;
  min-height: 1.1em;
}

.transcript-current {
  font-size: 1.08rem;
  line-height: 1.38;
  text-align: center;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
  min-height: 1.4em;
}

@media (max-width: 900px) {
  .control-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .recipe-options {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 1.3rem;
  }

  .subhead {
    font-size: 0.82rem;
  }

  .hud-floating {
    width: min(280px, calc(100% - 16px));
    top: 8px;
    left: 8px;
    padding: 8px;
  }

  .hud-header h2 {
    font-size: 0.9rem;
  }

  #progress-updated {
    font-size: 0.66rem;
  }

  .progress-step {
    font-size: 0.78rem;
  }

  .progress-state {
    font-size: 0.64rem;
  }

  .transcript-strip {
    bottom: max(8px, env(safe-area-inset-bottom));
    padding: 8px 10px;
    border-radius: 10px;
  }

  .transcript-history {
    font-size: 0.68rem;
  }

  .transcript-current {
    font-size: 0.96rem;
  }
}
