:root {
  color-scheme: light;
  --bg: #f6f7f2;
  --surface: #ffffff;
  --surface-soft: #eef5f4;
  --text: #13201f;
  --muted: #63716f;
  --line: #d7ded9;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --danger: #b42318;
  --shadow: 0 18px 55px rgba(36, 48, 43, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: inherit;
}

button,
input,
textarea {
  font: inherit;
}

button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
  font-weight: 700;
  padding: 0 18px;
}

button:hover {
  background: var(--accent-strong);
}

button:disabled {
  cursor: wait;
  opacity: 0.62;
}

button.ghost {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  padding: 12px 14px;
}

textarea {
  min-height: 220px;
  resize: vertical;
}

label {
  color: var(--text);
  font-weight: 700;
}

pre {
  overflow: auto;
  margin: 0;
  white-space: pre-wrap;
}

.shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.auth-shell {
  background:
    linear-gradient(180deg, rgba(15, 118, 110, 0.08), transparent 42%),
    var(--bg);
}

.panel {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 24px;
}

.panel.compact,
.auth-panel {
  max-width: 560px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(246, 247, 242, 0.94);
  padding: 14px 24px;
}

.brand {
  color: var(--text);
  font-size: 18px;
  font-weight: 800;
  text-decoration: none;
}

.nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.nav a {
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
}

.page {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 56px;
}

.page.narrow {
  width: min(760px, calc(100% - 32px));
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: clamp(32px, 5vw, 56px);
  line-height: 1.02;
}

h2 {
  font-size: 18px;
}

.eyebrow {
  margin-bottom: 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.muted {
  color: var(--muted);
  line-height: 1.6;
}

.form {
  display: grid;
  gap: 10px;
  margin-top: 20px;
}

.inline-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.ghost-link {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font-weight: 700;
  padding: 0 18px;
  text-decoration: none;
}

.mode-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 14px;
}

.field-label {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(320px, 0.88fr);
  gap: 18px;
  margin-bottom: 18px;
}

.stack {
  display: grid;
  gap: 18px;
}

.detail-text {
  margin-bottom: 0;
  color: var(--text);
  line-height: 1.75;
  white-space: pre-wrap;
}

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

.status {
  min-height: 24px;
  margin: 16px 0 0;
  color: var(--muted);
}

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

.hidden {
  display: none;
}

.list {
  display: grid;
  gap: 12px;
}

.dream-row {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 18px;
  text-decoration: none;
}

.dream-row:hover {
  border-color: rgba(15, 118, 110, 0.5);
}

.row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.tag {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
  padding: 4px 9px;
}

.player-panel {
  display: grid;
  gap: 14px;
  border: 1px solid rgba(15, 23, 42, 0.22);
  border-radius: 8px;
  background: #05070d;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
  padding: 14px;
}

.player-stage {
  position: relative;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 8px;
  background: #020617;
}

.player-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
  image-rendering: pixelated;
}

.player-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 30% 15%, rgba(20, 184, 166, 0.14), transparent 32%),
    radial-gradient(circle at 78% 70%, rgba(244, 114, 182, 0.12), transparent 34%),
    rgba(2, 6, 23, 0.88);
  color: #e5e7eb;
  font-weight: 800;
  padding: 24px;
  text-align: center;
}

.player-empty.hidden {
  display: none;
}

.player-meta {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(260px, 0.75fr);
  gap: 14px;
  color: #f8fafc;
}

.player-meta .field-label {
  color: #94a3b8;
}

.player-meta .detail-text {
  color: #e2e8f0;
}

.player-placeholder {
  min-height: 360px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111c1b;
  color: #f8fafc;
  margin-bottom: 18px;
  padding: 24px;
  text-align: center;
}

@media (max-width: 680px) {
  .topbar,
  .page-header,
  .inline-row,
  .detail-grid,
  .player-meta {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .topbar,
  .page-header {
    flex-direction: column;
  }

  .nav {
    width: 100%;
    justify-content: space-between;
  }
}
