:root {
  color-scheme: light;
  --navy: #112d52;
  --ink: #18314f;
  --blue: #215eae;
  --blue-soft: #edf4fc;
  --muted: #52657b;
  --orange: #f58232;
  --line: #dce5ef;
  --paper: #fff;
  --canvas: #f5f8fc;
  --green: #0e704e;
  --red: #a32c28;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; }
h1, h2, p { margin: 0; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .48; cursor: not-allowed; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid #2876cb;
  outline-offset: 3px;
}

.topbar { background: var(--paper); border-bottom: 1px solid var(--line); }
.top-inner, .dashboard { max-width: 1240px; margin-inline: auto; padding-inline: 32px; }
.top-inner { min-height: 70px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: inline-flex; gap: 10px; align-items: center; text-decoration: none; font-size: 1.65rem; font-weight: 850; letter-spacing: -.065em; color: var(--navy); }
.brand-dot { color: #b94f14; }
.brand sup { margin-left: 4px; font-size: .56rem; vertical-align: super; }
.mark { width: 37px; height: 37px; border-radius: 10px; background: var(--navy); display: flex; gap: 3px; align-items: center; justify-content: center; }
.mark i { width: 3px; border-radius: 3px; background: #fff; height: 10px; }
.mark i:nth-child(2) { height: 18px; background: #ff9a52; }
.mark i:nth-child(3) { height: 13px; }
.account { display: flex; align-items: center; gap: 15px; color: var(--muted); font-size: .85rem; overflow-wrap: anywhere; }
.dashboard { padding-block: 35px 48px; }
.page-heading { display: flex; justify-content: space-between; align-items: start; gap: 12px; margin-bottom: 22px; }
.page-heading h1, .login-card h1 { font-size: clamp(1.7rem, 4vw, 2.45rem); letter-spacing: -.05em; }
.page-heading p { color: var(--muted); margin-top: 6px; font-size: .95rem; }
.version { font-size: .75rem; color: var(--muted); padding-top: 9px; white-space: nowrap; }

.button { font-size: .85rem; font-weight: 750; padding: 9px 14px; min-height: 40px; border-radius: 8px; border: 1px solid transparent; white-space: nowrap; }
.primary { color: var(--navy); background: var(--orange); }
.primary:not(:disabled):hover { background: #ff9a52; }
.secondary { color: var(--navy); background: var(--blue-soft); border-color: #d7e5f4; }
.secondary:not(:disabled):hover, .pale:not(:disabled):hover { background: #dbeafb; }
.pale { color: var(--navy); background: #fff; }
.outline { color: #fff; border-color: #8299b6; background: transparent; }
.outline:not(:disabled):hover { background: #fff2; }
.danger { color: var(--red); background: #fff4f3; border-color: #f1d8d5; }
.danger:not(:disabled):hover { background: #fbe4e1; }
.live-actions :focus-visible { outline-color: #fff; }

.live-panel {
  display: flex; justify-content: space-between; align-items: center; gap: 23px;
  background: linear-gradient(120deg, #112d52, #174579); color: #fff; border-radius: 16px; padding: 24px 28px;
}
.live-info { min-width: 0; }
.live-info h2 { font-size: clamp(1.25rem, 3vw, 1.75rem); margin-block: 8px 4px; overflow-wrap: anywhere; letter-spacing: -.03em; }
.live-info p { color: #d8e6f4; font-size: .88rem; line-height: 1.45; }
.live-actions, .form-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.phase { display: inline-flex; align-items: center; gap: 7px; color: #fff; font-size: .76rem; font-weight: 700; }
.phase::before { content: ""; height: 8px; width: 8px; border-radius: 50%; background: #b4c7db; }
.phase[data-phase="live"]::before { background: #69e4b7; box-shadow: 0 0 0 3px #69e4b733; }
.phase[data-phase="starting"]::before, .phase[data-phase="retrying"]::before { background: #ffc184; }

.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-block: 16px 21px; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 13px; box-shadow: 0 5px 16px #16365c07; }
.metric { min-width: 0; display: grid; align-content: start; gap: 6px; padding: 16px; }
.metric h2 { font-size: .79rem; color: var(--muted); }
.metric strong { font-size: clamp(1.25rem, 3.2vw, 1.68rem); font-variant-numeric: tabular-nums; letter-spacing: -.045em; }
.metric span { font-size: .73rem; color: var(--muted); }
progress { width: 100%; height: 6px; margin-top: 5px; appearance: none; border: 0; border-radius: 9px; overflow: hidden; background: #e6eef8; }
progress::-webkit-progress-bar { background: #e6eef8; }
progress::-webkit-progress-value { background: var(--blue); }
progress::-moz-progress-bar { background: var(--blue); }

.workspace-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); align-items: start; gap: 16px; }
.configuration, .playback { padding: 22px; min-width: 0; }
.configuration h2, .playback h2 { font-size: 1.2rem; letter-spacing: -.025em; }
.profile-bar { display: flex; align-items: end; gap: 9px; margin-block: 17px; padding-bottom: 17px; border-bottom: 1px solid var(--line); }
.profile-bar label { flex: 1; min-width: 0; }
.profile-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.wide { grid-column: 1 / -1; }
label { min-width: 0; display: grid; gap: 5px; font-size: .8rem; color: var(--ink); font-weight: 700; }
input, select { width: 100%; min-width: 0; border: 1px solid #c9d7e7; color: var(--ink); background: #fff; border-radius: 8px; padding: 9px 10px; min-height: 40px; font-size: .88rem; }
input::placeholder { color: #63758a; }
label small { color: var(--muted); font-weight: 500; overflow-wrap: anywhere; }
.form-actions { margin-top: 4px; }
.playback > p, .player-note p { color: var(--muted); font-size: .86rem; line-height: 1.5; margin-top: 7px; }
.output { margin-top: 17px; }
.output label { display: flex; justify-content: space-between; margin-bottom: 6px; }
.output small[data-ready="true"] { color: var(--green); font-weight: 700; }
.copy-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; }
.copy-row input { background: #f8fafc; font-family: ui-monospace, monospace; font-size: .75rem; }
.player-note { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 19px; font-size: .84rem; }
.notice { border: 1px solid #cedff3; border-radius: 9px; background: var(--blue-soft); color: var(--navy); padding: 10px 12px; margin-bottom: 13px; font-size: .87rem; }
.notice.error { border-color: #f1d8d5; background: #fff4f3; color: var(--red); }

.login-page { padding: clamp(30px, 12vh, 105px) 20px; }
.login-card { max-width: 450px; margin: auto; padding: 28px; }
.login-card h1 { font-size: 1.6rem; }
.login-card form { display: grid; gap: 15px; margin-top: 24px; }
.login-card .notice { margin: 14px 0 0; }

@media (max-width: 790px) {
  .top-inner, .dashboard { padding-inline: 20px; }
  .workspace-grid { grid-template-columns: 1fr; }
  .live-panel { align-items: start; flex-direction: column; gap: 14px; }
}
@media (max-width: 520px) {
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .metric { padding: 12px; }
  .top-inner, .dashboard { padding-inline: 13px; }
  .dashboard { padding-top: 23px; }
  .live-panel, .configuration, .playback { padding: 16px; }
}
