:root {
  --bg0: #1a211c;
  --bg1: #243028;
  --ink: #f2efe6;
  --muted: #b7c0b4;
  --line: rgba(242, 239, 230, 0.12);
  --accent: #d6ff4b;
  --accent-ink: #172016;
  --warn: #ffb454;
  --ok: #7dffb3;
  --danger: #ff7a7a;
  --panel: rgba(20, 26, 22, 0.72);
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  --radius: 18px;
  --font: "Instrument Sans", "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 700px at 10% -10%, #3a4a32 0%, transparent 55%),
    radial-gradient(900px 600px at 100% 0%, #2a4038 0%, transparent 50%),
    linear-gradient(160deg, var(--bg0), var(--bg1));
}

.noise {
  pointer-events: none;
  position: fixed;
  inset: 0;
  opacity: 0.06;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  z-index: 0;
}

.shell {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100% - 32px));
  margin: 28px auto 48px;
}

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

.brand { display: flex; gap: 14px; align-items: center; }
.brand-mark {
  width: 52px; height: 52px;
  border-radius: 14px;
  display: grid; place-items: center;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--accent-ink);
  background: var(--accent);
  box-shadow: 0 0 0 1px rgba(214, 255, 75, 0.35), 0 10px 30px rgba(214, 255, 75, 0.2);
}
.brand h1 {
  margin: 0;
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  letter-spacing: -0.03em;
  line-height: 1;
}
.tag { margin: 6px 0 0; color: var(--muted); font-size: 0.95rem; }
.tag code {
  font-family: var(--mono);
  color: var(--accent);
  background: rgba(214, 255, 75, 0.08);
  padding: 0.1em 0.4em;
  border-radius: 6px;
}

.badge {
  font-family: var(--mono);
  font-size: 0.78rem;
  padding: 0.55rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(0,0,0,0.25);
}
.badge.ok { color: var(--ok); border-color: rgba(125, 255, 179, 0.35); }
.badge.warn { color: var(--warn); border-color: rgba(255, 180, 84, 0.35); }
.badge.bad { color: var(--danger); border-color: rgba(255, 122, 122, 0.35); }

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.8fr);
  gap: 18px;
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  padding: 18px;
}

.form { display: grid; gap: 14px; }
.field { display: grid; gap: 7px; }
.field span {
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.field span em {
  font-style: normal;
  color: var(--accent);
  margin-left: 0.4rem;
  font-family: var(--mono);
}
.hint { font-size: 0.82rem; color: var(--muted); text-transform: none; letter-spacing: 0; }

textarea, input[type="text"], select {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.03);
  color: var(--ink);
  border-radius: 12px;
  padding: 0.85rem 0.95rem;
  font: inherit;
  outline: none;
  transition: border-color .15s ease, background .15s ease;
}
textarea { resize: vertical; min-height: 160px; line-height: 1.45; }
textarea:focus, input[type="text"]:focus, select:focus {
  border-color: rgba(214, 255, 75, 0.55);
  background: rgba(214, 255, 75, 0.04);
}
select option { color: #111; }

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

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

.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }

.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.04);
  color: var(--ink);
  border-radius: 12px;
  padding: 0.85rem 1.1rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform .12s ease, background .12s ease, border-color .12s ease;
}
.btn:hover { transform: translateY(-1px); border-color: rgba(242,239,230,0.28); }
.btn:disabled { opacity: 0.55; cursor: wait; transform: none; }
.btn.primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: transparent;
}
.btn.ghost { background: transparent; }
.btn.block { display: block; text-align: center; text-decoration: none; margin-top: 12px; }

.side { display: grid; gap: 14px; }
.meter h2, .result h2 {
  margin: 0 0 8px;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.price {
  margin: 0;
  font-family: var(--mono);
  font-size: clamp(1.6rem, 3vw, 2rem);
  letter-spacing: -0.03em;
}
.meter.after .price { color: var(--ok); }
.meta {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  gap: 6px;
  font-size: 0.9rem;
  color: var(--muted);
}
.meta li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 6px;
}
.meta strong { color: var(--ink); font-weight: 500; font-family: var(--mono); font-size: 0.85rem; }

#player {
  width: 100%;
  margin-top: 4px;
}

.error {
  color: #ffe1e1;
  background: rgba(120, 28, 28, 0.45);
  border-color: rgba(255, 122, 122, 0.35);
  white-space: pre-wrap;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.logout-btn {
  text-decoration: none;
  padding: 0.55rem 0.85rem;
  font-size: 0.85rem;
}

.login-shell {
  min-height: calc(100vh - 56px);
  display: grid;
  place-items: center;
}
.login-card {
  width: min(420px, 100%);
  display: grid;
  gap: 14px;
}
.login-brand { margin-bottom: 4px; }
.login-error { margin: 0; padding: 12px 14px; }
.login-hint {
  margin: 0;
  text-align: center;
}
.login-hint code {
  font-family: var(--mono);
  color: var(--accent);
}

@media (max-width: 900px) {
  .workspace { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .top { align-items: flex-start; flex-direction: column; }
}
