/* Edge Games — Roblox AI Studio. One stylesheet for the portal and console. */

:root {
  --bg: #f5f6fb;
  --surface: #ffffff;
  --surface-2: #f0f1f8;
  --ink: #141a2e;
  --ink-2: #4a5170;
  --ink-3: #7a809b;
  --line: #e2e4ef;
  --brand: #6b47ff;
  --brand-2: #16c3ff;
  --brand-ink: #ffffff;
  --grad: linear-gradient(135deg, #6b47ff 0%, #3d7bff 50%, #16c3ff 100%);
  --ok: #17a673;
  --ok-bg: #e3f7ef;
  --warn: #c77700;
  --warn-bg: #fff3dc;
  --bad: #d63a4a;
  --bad-bg: #fde8ea;
  --info-bg: #ebe6ff;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(20, 26, 46, 0.06), 0 8px 24px rgba(20, 26, 46, 0.06);
  --font: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0f1c;
    --surface: #141a2e;
    --surface-2: #1b2240;
    --ink: #eef0fb;
    --ink-2: #b7bcd6;
    --ink-3: #8a90ad;
    --line: #262e50;
    --ok-bg: #0f3327;
    --warn-bg: #3a2a07;
    --bad-bg: #3b1219;
    --info-bg: #231c4d;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5em; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 0.8em; }
.muted { color: var(--ink-3); }
.small { font-size: 0.875rem; }
.hidden { display: none !important; }

/* ── layout ─────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-in { max-width: 1180px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 800; letter-spacing: -0.02em; }
.brand:hover { text-decoration: none; }
.brand img { width: 34px; height: 34px; }
.brand small { display: block; font-weight: 600; color: var(--ink-3); font-size: 0.72rem; letter-spacing: 0.02em; text-transform: uppercase; }
.nav { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.nav a, .nav button {
  padding: 8px 12px; border-radius: 999px; color: var(--ink-2); font-weight: 600; font-size: 0.93rem;
  background: none; border: 0; cursor: pointer; font-family: inherit;
}
.nav a:hover, .nav button:hover { background: var(--surface-2); text-decoration: none; color: var(--ink); }
.nav a.on { background: var(--info-bg); color: var(--brand); }
.wrap { max-width: 1180px; margin: 0 auto; padding: 24px 16px 64px; }
.narrow { max-width: 760px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px;
}
.card.flat { box-shadow: none; }
.card h2 { margin-bottom: 0.6em; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 28px 0 12px; }
.section-title h2 { margin: 0; }

/* ── buttons & fields ───────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font: 700 0.95rem/1 var(--font);
  cursor: pointer; transition: transform 0.06s ease, background 0.15s ease, box-shadow 0.15s ease;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary { background: var(--grad); color: var(--brand-ink); border-color: transparent; box-shadow: 0 6px 18px rgba(107, 71, 255, 0.28); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); }
.btn.danger:hover { background: var(--bad-bg); }
.btn.ok { background: var(--ok); color: #fff; border-color: transparent; }
.btn.small { padding: 7px 12px; font-size: 0.85rem; }
.btn.big { padding: 15px 26px; font-size: 1.05rem; }
.btn.block { width: 100%; }

label { display: block; font-weight: 700; margin-bottom: 6px; }
.hint { color: var(--ink-3); font-size: 0.875rem; font-weight: 400; margin-top: 6px; }
input[type="text"], input[type="email"], input[type="url"], input[type="number"], textarea, select {
  width: 100%; padding: 12px 14px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--line); background: var(--surface); color: var(--ink);
  font: 1rem/1.4 var(--font); transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent); }
textarea { resize: vertical; min-height: 120px; }
.field { margin-bottom: 18px; }
.field-error { color: var(--bad); font-size: 0.875rem; margin-top: 6px; }
.check { display: flex; gap: 12px; align-items: flex-start; font-weight: 500; padding: 12px; border-radius: var(--radius-sm); background: var(--surface-2); cursor: pointer; margin-bottom: 10px; }
.check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--brand); flex: none; }
input[type="range"] { width: 100%; accent-color: var(--brand); }

/* ── chips, badges, progress ────────────────────────────── */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: 700; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.chip.live { background: var(--ok-bg); color: var(--ok); }
.chip.live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); animation: pulse 1.4s infinite; }
.chip.wait { background: var(--info-bg); color: var(--brand); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.bad { background: var(--bad-bg); color: var(--bad); }
.chip.good { background: var(--ok-bg); color: var(--ok); }
@keyframes pulse { 50% { opacity: 0.35; } }
.progress { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.progress > div { height: 100%; background: var(--grad); border-radius: inherit; transition: width 0.4s ease; width: 0; }
.meter-label { display: flex; justify-content: space-between; font-size: 0.875rem; color: var(--ink-2); margin-bottom: 6px; }

/* ── landing ────────────────────────────────────────────── */
.hero { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 32px; align-items: center; padding: 32px 0 8px; }
.hero h1 { font-size: clamp(2rem, 5.2vw, 3.3rem); letter-spacing: -0.03em; }
.hero .lead { font-size: 1.15rem; color: var(--ink-2); max-width: 560px; }
.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-top: 32px; }
.step { padding: 20px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.step b { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--info-bg); color: var(--brand); margin-bottom: 10px; }
.promise { display: flex; gap: 10px; align-items: flex-start; margin: 8px 0; color: var(--ink-2); }
.promise::before { content: "✓"; color: var(--ok); font-weight: 900; }
@media (max-width: 820px) { .hero { grid-template-columns: 1fr; } }

/* ── jobs & videos ──────────────────────────────────────── */
.job-card { display: block; color: inherit; }
.job-card:hover { text-decoration: none; border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); }
.job-card .title { font-weight: 800; font-size: 1.05rem; }
.job-card .meta { color: var(--ink-3); font-size: 0.85rem; margin: 4px 0 12px; }
.video-tile { display: block; color: inherit; border-radius: var(--radius); overflow: hidden; background: var(--surface); border: 1px solid var(--line); }
.video-tile:hover { text-decoration: none; transform: translateY(-2px); transition: transform 0.15s ease; }
.video-tile .cover { aspect-ratio: 9 / 16; background: var(--grad); display: grid; place-items: center; color: #fff; font-weight: 800; overflow: hidden; }
.video-tile .cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.video-tile .body { padding: 10px 12px; }
.empty { text-align: center; padding: 32px 16px; color: var(--ink-3); border: 2px dashed var(--line); border-radius: var(--radius); }
.empty .btn { margin-top: 12px; }
.stat { font-size: 2rem; font-weight: 900; letter-spacing: -0.02em; }

/* ── new-job form ───────────────────────────────────────── */
.form-step { position: relative; padding-left: 48px; }
.form-step > .num { position: absolute; left: 0; top: 18px; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--grad); color: #fff; font-weight: 800; }
.game-preview { display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: var(--radius-sm); background: var(--ok-bg); margin-top: 10px; }
.game-preview .gname { font-weight: 800; }
.style-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.style-card { border: 2px solid var(--line); border-radius: var(--radius-sm); padding: 12px; cursor: pointer; background: var(--surface); text-align: left; font: inherit; color: inherit; }
.style-card b { display: block; }
.style-card span { color: var(--ink-3); font-size: 0.85rem; }
.style-card[aria-pressed="true"] { border-color: var(--brand); background: var(--info-bg); }
.instructions-box { border: 2px solid color-mix(in srgb, var(--brand) 40%, var(--line)); border-radius: var(--radius); padding: 16px; background: linear-gradient(180deg, var(--info-bg), var(--surface) 60%); }
.instructions-box textarea { min-height: 180px; font-size: 1.05rem; }
.examples { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.examples button { border: 1px dashed var(--line); background: var(--surface); border-radius: 999px; padding: 6px 12px; font: 600 0.85rem var(--font); color: var(--ink-2); cursor: pointer; }
.examples button:hover { border-color: var(--brand); color: var(--brand); }
.counter { display: inline-flex; align-items: center; border: 1.5px solid var(--line); border-radius: 999px; overflow: hidden; }
.counter button { width: 44px; height: 44px; border: 0; background: var(--surface-2); font: 800 1.2rem var(--font); color: var(--ink); cursor: pointer; }
.counter output { min-width: 48px; text-align: center; font-weight: 800; font-size: 1.1rem; }
.friend-box { display: flex; gap: 14px; align-items: center; padding: 14px; border-radius: var(--radius-sm); background: var(--surface-2); }
.friend-box .avatar { width: 48px; height: 48px; border-radius: 50%; background: var(--grad); display: grid; place-items: center; color: #fff; font-weight: 900; flex: none; }
.sticky-submit { position: sticky; bottom: 0; padding: 12px 0; background: linear-gradient(0deg, var(--bg) 70%, transparent); }

/* Intro text: a 9:16 phone frame showing the opening title card. */
.intro-wrap { display: grid; grid-template-columns: 1fr 150px; gap: 16px; align-items: start; }
.phone916 {
  aspect-ratio: 9 / 16; width: 150px; border-radius: 18px; overflow: hidden; position: relative;
  background: radial-gradient(120% 80% at 30% 20%, #8c6bff 0%, #3d7bff 45%, #0d1430 100%);
  box-shadow: 0 0 0 4px #10162b, 0 10px 30px rgba(20, 26, 46, 0.3);
}
.phone916 .scene { position: absolute; inset: 0; opacity: 0.35; background:
  linear-gradient(transparent 62%, rgba(0,0,0,0.5)),
  repeating-linear-gradient(90deg, rgba(255,255,255,0.08) 0 12px, transparent 12px 24px); }
.phone916 .intro {
  position: absolute; left: 8%; right: 8%; top: 22%;
  color: #fff; font-weight: 900; text-transform: uppercase; text-align: center; line-height: 1.05;
  font-size: 17px; letter-spacing: 0.01em; word-wrap: break-word;
  text-shadow: 0 2px 0 #000, 0 0 12px rgba(0,0,0,0.6);
  -webkit-text-stroke: 1px rgba(0,0,0,0.6);
}
.phone916 .intro.empty { opacity: 0.45; }
.phone916 .bar { position: absolute; bottom: 10px; left: 10px; right: 10px; height: 4px; border-radius: 4px; background: rgba(255,255,255,0.35); }
.phone916 .bar::after { content: ""; display: block; width: 30%; height: 100%; border-radius: inherit; background: #fff; }
.char-count { font-variant-numeric: tabular-nums; }
.char-count.over { color: var(--bad); font-weight: 700; }
.overrides { margin-top: 12px; display: grid; gap: 8px; }
@media (max-width: 560px) { .intro-wrap { grid-template-columns: 1fr; } .intro-wrap .phone916 { margin: 0 auto; } }

/* ── job page ───────────────────────────────────────────── */
.job-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; }
@media (max-width: 960px) { .job-layout { grid-template-columns: 1fr; } }
.liveview {
  position: relative; background: #05070f; border-radius: var(--radius); overflow: hidden;
  aspect-ratio: 16 / 9; display: grid; place-items: center; color: #9aa3c7; user-select: none; touch-action: none;
}
.liveview.portrait { aspect-ratio: 9 / 16; max-height: 75vh; margin: 0 auto; }
.liveview img, .liveview video { width: 100%; height: 100%; object-fit: contain; display: block; }
.liveview .overlay { position: absolute; left: 12px; top: 12px; display: flex; gap: 8px; }
.liveview .placeholder { text-align: center; padding: 24px; }
.liveview.control { outline: 3px solid var(--ok); outline-offset: -3px; cursor: crosshair; }
.liveview .tapdot { position: absolute; width: 26px; height: 26px; margin: -13px 0 0 -13px; border-radius: 50%; border: 3px solid #fff; pointer-events: none; animation: tap 0.5s ease-out forwards; }
@keyframes tap { to { transform: scale(1.8); opacity: 0; } }
.timeline { list-style: none; margin: 0; padding: 0; max-height: 520px; overflow: auto; }
.timeline li { display: grid; grid-template-columns: 58px 1fr; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 0.93rem; }
.timeline li:last-child { border-bottom: 0; }
.timeline time { color: var(--ink-3); font-size: 0.8rem; font-variant-numeric: tabular-nums; padding-top: 2px; }
.timeline .k-status { font-weight: 700; }
.timeline .k-directive { color: var(--brand); }
.timeline .k-players_present, .timeline .k-farm_offline { color: var(--warn); }
.direct-box { border: 2px solid color-mix(in srgb, var(--brand) 45%, var(--line)); }
.direct-box textarea { min-height: 80px; }
.keys { display: flex; gap: 6px; flex-wrap: wrap; }

/* ── video studio ───────────────────────────────────────── */
.studio { display: grid; grid-template-columns: minmax(240px, 380px) 1fr; gap: 24px; align-items: start; }
@media (max-width: 820px) { .studio { grid-template-columns: 1fr; } }
.player { aspect-ratio: 9 / 16; width: 100%; background: #000; border-radius: var(--radius); overflow: hidden; }
.player video { width: 100%; height: 100%; display: block; object-fit: contain; background: #000; }
.copy-box { position: relative; background: var(--surface-2); border-radius: var(--radius-sm); padding: 12px 14px; white-space: pre-wrap; font-size: 0.95rem; }
.copy-box .btn { position: absolute; top: 8px; right: 8px; }
.copy-box p { margin: 0; padding-right: 72px; }

/* ── admin ──────────────────────────────────────────────── */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.tabs button { padding: 9px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font: 700 0.9rem var(--font); color: var(--ink-2); cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.tabs .count { margin-left: 6px; background: var(--bad); color: #fff; border-radius: 999px; padding: 0 7px; font-size: 0.75rem; }
.devices { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.device { border-radius: var(--radius-sm); padding: 12px; background: var(--surface); border: 1px solid var(--line); border-left: 6px solid var(--ink-3); font-size: 0.88rem; min-height: 96px; }
.device .id { font-weight: 900; font-size: 1rem; }
.device.s-idle { border-left-color: var(--ok); }
.device.s-busy { border-left-color: var(--brand); }
.device.s-offline { border-left-color: var(--line); opacity: 0.7; }
.device.s-error, .device.s-unhealthy, .device.s-unauthorized { border-left-color: var(--bad); }
.device.s-maintenance { border-left-color: var(--warn); }
.alert { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--warn-bg); margin-bottom: 8px; }
.alert.k-players_present { background: var(--bad-bg); }
.alert .msg { flex: 1; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--ink-3); font-weight: 700; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }
.table-wrap { overflow-x: auto; }
td select { min-width: 120px; padding: 6px 8px; }
.duty { display: flex; align-items: center; gap: 10px; }
.switch { position: relative; width: 52px; height: 30px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--line); transition: 0.2s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; width: 24px; height: 24px; left: 3px; top: 3px; border-radius: 50%; background: #fff; transition: 0.2s; box-shadow: 0 1px 3px rgba(0,0,0,0.2); }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::after { transform: translateX(22px); }
.banner { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-weight: 600; }
.banner.warn { background: var(--warn-bg); color: var(--warn); }
.banner.bad { background: var(--bad-bg); color: var(--bad); }
.banner.info { background: var(--info-bg); color: var(--brand); }
.banner.ok { background: var(--ok-bg); color: var(--ok); }

/* ── toast ──────────────────────────────────────────────── */
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100; display: grid; gap: 8px; width: min(92vw, 440px); }
.toast { background: var(--ink); color: var(--surface); padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow); font-weight: 600; animation: rise 0.2s ease; }
.toast.err { background: var(--bad); color: #fff; }
@keyframes rise { from { transform: translateY(10px); opacity: 0; } }

footer.site { text-align: center; color: var(--ink-3); font-size: 0.85rem; padding: 24px 16px 40px; }

/* ── small screens ──────────────────────────────────────── */
@media (max-width: 640px) {
  .topbar-in { flex-wrap: wrap; gap: 6px 12px; padding: 8px 12px; }
  .brand small { display: none; }
  .nav { margin-left: 0; width: 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .nav a, .nav button { padding: 6px 10px; flex: none; }
  .wrap { padding: 16px 12px 56px; }
  .card { padding: 16px; }
  .form-step { padding-left: 16px; padding-top: 52px; }
  .form-step > .num { left: 16px; top: 14px; }
  .form-step > h2 { position: absolute; left: 58px; top: 18px; }
}
.section-gap { margin-top: 16px; }
