:root {
  --bg: #0c0b14;
  --surface: #14121f;
  --surface-2: #1c1a2b;
  --border: #2a2740;
  --text: #ecebf5;
  --text-muted: #9a97b3;
  --accent: #8b5cf6;
  --accent-soft: color-mix(in srgb, var(--accent) 18%, transparent);
  --radius: 16px;
  --radius-sm: 10px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Outfit", var(--font);
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(900px 420px at 80% -160px, var(--accent-soft), transparent),
    var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.app {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  height: 100%;
}

/* Sidebar */
.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 80%, transparent);
}

.sidebar__head {
  padding: 20px 18px 14px;
  border-bottom: 1px solid var(--border);
}

.back {
  color: var(--text-muted);
  font-size: 13px;
  text-decoration: none;
}

.back:hover {
  color: var(--text);
}

.title {
  margin: 10px 0 2px;
  font: 700 24px/1.15 var(--font-display);
  letter-spacing: -0.01em;
}

.subtitle {
  margin: 0 0 14px;
  color: var(--text-muted);
  font-size: 13px;
}

.search input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 14px;
}

.search input::placeholder {
  color: var(--text-muted);
}

.list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 10px 24px;
}

.group__title {
  margin: 14px 8px 6px;
  color: var(--text-muted);
  font: 600 11px/1 var(--font-display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.item {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition: background 0.2s var(--ease-out);
}

.item:hover {
  background: var(--surface-2);
}

.item[aria-current="true"] {
  background: var(--accent-soft);
  box-shadow: inset 3px 0 0 var(--accent);
}

.empty {
  margin: 16px 8px;
  color: var(--text-muted);
  font-size: 14px;
}

/* Stage */
.stage {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: 18px;
  gap: 14px;
}

.stage__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 20px;
}

.stage__info {
  min-width: 0;
  flex: 1 1 320px;
}

.stage__group {
  margin: 0;
  color: var(--accent);
  font: 600 12px/1.2 var(--font-display);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.stage__name {
  margin: 4px 0 2px;
  font: 700 26px/1.15 var(--font-display);
}

.stage__desc {
  margin: 0;
  color: var(--text-muted);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.tags li {
  padding: 2px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 12px;
}

.stage__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  font: 500 14px/1 var(--font);
  text-decoration: none;
  cursor: pointer;
  transition:
    border-color 0.2s var(--ease-out),
    background 0.2s var(--ease-out);
}

.btn:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.btn--icon {
  width: 36px;
  padding: 0;
  font-size: 20px;
}

.stage__frame {
  position: relative;
  flex: 1;
  min-height: 360px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
}

.stage__frame iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.stage__hint {
  position: absolute;
  bottom: 12px;
  left: 50%;
  margin: 0;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgb(12 11 20 / 0.78);
  color: var(--text);
  font-size: 13px;
  white-space: nowrap;
  transform: translateX(-50%);
  pointer-events: none;
  transition: opacity 0.6s var(--ease-out);
}

.stage__hint.is-hidden {
  opacity: 0;
}

/* Phones and small tablets: the list becomes a scrolling strip above the stage */
@media (max-width: 860px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    height: auto;
    min-height: 100%;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .sidebar__head {
    padding: 16px 16px 12px;
    border-bottom: 0;
  }

  .list {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 16px 14px;
    scrollbar-width: thin;
  }

  .group {
    display: contents;
  }

  .group__title {
    display: none;
  }

  .item {
    flex: none;
    width: auto;
    border: 1px solid var(--border);
    border-radius: 999px;
    white-space: nowrap;
  }

  .item[aria-current="true"] {
    box-shadow: none;
    border-color: var(--accent);
  }

  .stage {
    padding: 14px 16px 20px;
  }

  .stage__name {
    font-size: 22px;
  }

  .stage__frame {
    flex: none;
    height: 70vh;
    min-height: 320px;
  }

  .stage__hint {
    white-space: normal;
    width: max-content;
    max-width: calc(100% - 24px);
    text-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
  }
}
