:root {
  --bg: #ffffff;
  --fg: #111111;
  --muted: #8c8c8c;
  --line: #e6e6e6;
  --danger: #b3261e;
  --gutter: clamp(20px, 6vw, 48px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e0e0e;
    --fg: #f2f2f2;
    --muted: #7a7a7a;
    --line: #262626;
    --danger: #f2b8b5;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

a { color: inherit; text-decoration: none; }

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

[hidden] { display: none !important; }

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

.screen {
  min-height: 100svh;
  padding:
    calc(env(safe-area-inset-top) + var(--gutter))
    var(--gutter)
    calc(env(safe-area-inset-bottom) + var(--gutter));
  max-width: 720px;
  margin: 0 auto;
  animation: fade 300ms ease both;
}

.screen--full {
  max-width: none;
  padding: 0;
}

@keyframes fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Botón de texto: sin fondo ni borde, solo subrayado */
.text-button {
  background: none;
  border: 0;
  padding: 12px 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 6px;
  text-decoration-thickness: 1px;
}

.text-button:disabled { color: var(--muted); cursor: default; }

/* Intro */
#intro {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(2.6rem, 12vw, 4.5rem);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1;
}

.lead {
  margin: 20px 0 40px;
  max-width: 28ch;
  font-size: 1.2rem;
}

.steps {
  margin: 0 0 48px;
  padding: 0;
  list-style: none;
  counter-reset: step;
  color: var(--muted);
}

.steps li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 2.2em 1fr;
  padding: 6px 0;
}

.steps li::before {
  content: counter(step, decimal-leading-zero);
  font-variant-numeric: tabular-nums;
}

#start {
  align-self: flex-start;
  font-size: 1.2rem;
}

/* Barra superior */
.bar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  font-size: 0.95rem;
}

.bar--overlay {
  position: fixed;
  inset: 0 0 auto;
  z-index: 2;
  padding: calc(env(safe-area-inset-top) + 20px) var(--gutter) 20px;
}

.bar-links {
  display: flex;
  gap: 20px;
}

.bar-links .text-button {
  padding: 0;
  text-decoration: none;
}

.back::before { content: "\2190\00a0"; }

/* Menú */
.model-list {
  margin: 48px 0 0;
  padding: 0;
  list-style: none;
}

.model-list a {
  display: grid;
  grid-template-columns: 88px 2.4em 1fr;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
}

.model-list a:active .name { opacity: 0.5; }

.thumb {
  width: 88px;
  height: 88px;
  pointer-events: none;
  --poster-color: transparent;
  --progress-bar-height: 0;
}

.index {
  color: var(--muted);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

.name {
  font-size: 1.5rem;
  letter-spacing: -0.02em;
}

#menu-status { margin-top: 32px; }

/* Visor */
#mv {
  width: 100%;
  height: 100svh;
  background: var(--bg);
  --poster-color: transparent;
}

.ar-button {
  position: absolute;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 28px);
  transform: translateX(-50%);
  font-size: 1.15rem;
  white-space: nowrap;
}

.ar-prompt {
  position: absolute;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 40px);
  transform: translateX(-50%);
  margin: 0;
  color: #fff;
  font-size: 0.95rem;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6);
  white-space: nowrap;
}

.progress {
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  transition: opacity 400ms ease;
}

.progress span {
  display: block;
  height: 100%;
  background: var(--fg);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 200ms ease;
}

.progress.done { opacity: 0; }

.viewer-note {
  position: fixed;
  left: var(--gutter);
  right: var(--gutter);
  bottom: calc(env(safe-area-inset-bottom) + 88px);
  margin: 0;
  text-align: center;
  font-size: 0.9rem;
}

/* Panel */
.admin-form {
  display: grid;
  gap: 24px;
  margin-top: 48px;
}

.admin-form--tight { margin-top: 16px; }

.field {
  display: grid;
  gap: 4px;
}

.field span {
  color: var(--muted);
  font-size: 0.82rem;
}

.input {
  width: 100%;
  padding: 8px 0;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  outline: none;
}

.input:focus { border-bottom-color: var(--fg); }

.input[type="file"] {
  border-bottom: 0;
  padding: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.input[type="file"]::file-selector-button {
  margin-right: 16px;
  padding: 8px 0;
  background: none;
  border: 0;
  color: var(--fg);
  font: inherit;
  font-size: 1rem;
  text-decoration: underline;
  text-underline-offset: 6px;
  cursor: pointer;
}

.admin-section-title {
  margin: 64px 0 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.admin-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.admin-list li {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 4px 16px;
  padding: 12px 0;
}

@media (max-width: 600px) {
  .admin-list li { grid-template-columns: 1fr; }
}

.admin-list li.is-hidden .input { color: var(--muted); }

.admin-list .input {
  border-bottom-color: transparent;
  font-size: 1.2rem;
}

.admin-list .input:focus { border-bottom-color: var(--fg); }

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0 16px;
  font-size: 0.9rem;
}

.admin-actions .text-button {
  padding: 8px 0;
  text-decoration: none;
  color: var(--muted);
}

.admin-actions .text-button:disabled { opacity: 0.3; }

.admin-actions .text-button:hover,
.admin-actions .text-button:focus-visible { color: var(--fg); }

.admin-actions .danger:hover,
.admin-actions .danger:focus-visible { color: var(--danger); }

.status {
  min-height: 1.5em;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.status.error { color: var(--danger); }
