.fks-app {
  --fks-navy: #102a43;
  --fks-blue: #1565c0;
  --fks-blue-dark: #0d47a1;
  --fks-cyan: #00a6a6;
  --fks-bg: #f3f7fb;
  --fks-border: #d8e3ee;
  --fks-danger: #c62828;
  --fks-text: #243b53;
  box-sizing: border-box;
  width: 100%;
  max-width: 1120px;
  margin: 24px auto;
  padding: 24px;
  color: var(--fks-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

.fks-app *, .fks-app *::before, .fks-app *::after { box-sizing: border-box; }
.fks-app [hidden] { display: none !important; }

.fks-card {
  max-width: 760px;
  margin: 0 auto;
  padding: clamp(24px, 5vw, 52px);
  background: #fff;
  border: 1px solid var(--fks-border);
  border-radius: 22px;
  box-shadow: 0 18px 50px rgba(16, 42, 67, .12);
  text-align: center;
}

.fks-brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 18px;
  color: var(--fks-blue);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: .02em;
  text-transform: uppercase;
}

.fks-brand-icon {
  display: inline-grid;
  width: 28px;
  height: 28px;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--fks-blue), var(--fks-cyan));
  border-radius: 50%;
}

.fks-app h1 {
  margin: 0 0 12px;
  color: var(--fks-navy);
  font-size: clamp(30px, 5vw, 46px);
  line-height: 1.12;
}

.fks-lead {
  margin: 0 auto 30px;
  color: #526d82;
  font-size: clamp(17px, 2vw, 20px);
  line-height: 1.55;
}

.fks-start-panel { display: grid; justify-items: center; gap: 22px; }
.fks-field { display: grid; width: min(100%, 430px); gap: 8px; color: var(--fks-navy); font-size: 16px; font-weight: 800; text-align: left; }
.fks-field select { width: 100%; min-height: 52px; padding: 10px 42px 10px 14px; border: 2px solid #b8cadb; border-radius: 11px; color: var(--fks-navy); background-color: #fff; font: inherit; font-weight: 700; }
.fks-field select:focus { border-color: var(--fks-blue); outline: 4px solid rgba(21, 101, 192, .18); }
.fks-field small { color: #627d98; font-size: 13px; font-weight: 600; line-height: 1.45; }
.fks-check { display: flex; align-items: center; gap: 10px; font-size: 16px; cursor: pointer; }
.fks-check input { width: 20px; height: 20px; accent-color: var(--fks-blue); }

.fks-button {
  min-height: 52px;
  padding: 13px 24px;
  border: 0;
  border-radius: 12px;
  font: inherit;
  font-size: 17px;
  font-weight: 800;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
}

.fks-button:hover:not(:disabled) { transform: translateY(-1px); }
.fks-button:focus-visible, .fks-control-button:focus-visible, .fks-code-form input:focus-visible { outline: 4px solid rgba(21, 101, 192, .22); outline-offset: 2px; }
.fks-button:disabled { cursor: not-allowed; opacity: .5; }
.fks-button-primary { color: #fff; background: linear-gradient(135deg, var(--fks-blue), var(--fks-blue-dark)); box-shadow: 0 8px 20px rgba(21, 101, 192, .25); }
.fks-button-danger { color: #fff; background: var(--fks-danger); }

.fks-label { margin: 0 0 12px; font-size: 16px; line-height: 1.55; }
.fks-code { margin: 10px 0 18px; color: var(--fks-blue-dark); font-size: clamp(48px, 10vw, 82px); font-weight: 900; letter-spacing: .16em; line-height: 1; font-variant-numeric: tabular-nums; }

.fks-status {
  margin: 22px 0;
  padding: 14px 18px;
  border-radius: 12px;
  font-size: 17px;
  font-weight: 700;
}

.fks-status-waiting { color: #7a4d00; background: #fff4d6; }
.fks-status-connected { color: #075e54; background: #dff7ec; }
.fks-status-warning { color: #7a4d00; background: #fff4d6; }
.fks-status-error { color: #8a1c1c; background: #fde7e7; }
.fks-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.fks-help { margin: 22px 0 0; color: #627d98; font-size: 14px; line-height: 1.5; }

.fks-error, .fks-inline-notice {
  max-width: 760px;
  margin: 18px auto 0;
  padding: 14px 18px;
  border: 1px solid #f2b8b5;
  border-radius: 10px;
  color: #8a1c1c;
  background: #fff0ef;
  font-weight: 650;
  line-height: 1.5;
}

.fks-inline-warning { color: #7a4d00; border-color: #ecd48d; background: #fff8e5; }

.fks-code-form { display: grid; max-width: 440px; margin: 0 auto; gap: 14px; text-align: left; }
.fks-code-form label { color: var(--fks-navy); font-weight: 800; }
.fks-code-form input {
  width: 100%;
  height: 76px;
  padding: 10px 18px;
  border: 2px solid #b8cadb;
  border-radius: 12px;
  color: var(--fks-navy);
  background: #fff;
  font-size: 38px;
  font-weight: 900;
  letter-spacing: .2em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.fks-code-form input:focus { border-color: var(--fks-blue); }

.fks-viewer.fks-stage-active {
  max-width: none;
  margin: 0;
  padding: 0;
}

.fks-stage {
  position: relative;
  width: 100%;
  min-height: 70vh;
  overflow: hidden;
  background: #05080c;
  border-radius: 8px;
}

.fks-stage:fullscreen { width: 100vw; height: 100vh; border-radius: 0; }
.fks-stage video { display: block; width: 100%; height: 100%; min-height: 70vh; object-fit: contain; background: #05080c; }
.fks-stage:fullscreen video { min-height: 100vh; }

.fks-stage-message {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 40px;
  color: #fff;
  background: radial-gradient(circle at center, #173a58, #05080c 70%);
  font-size: clamp(22px, 4vw, 40px);
  font-weight: 800;
  text-align: center;
}

.fks-stage-controls { position: absolute; z-index: 2; right: 18px; bottom: 18px; display: flex; gap: 10px; opacity: .25; transition: opacity .2s ease; }
.fks-stage:hover .fks-stage-controls, .fks-stage-controls:focus-within { opacity: 1; }
.fks-control-button { padding: 11px 16px; border: 1px solid rgba(255,255,255,.35); border-radius: 9px; color: #fff; background: rgba(5,8,12,.82); font: inherit; font-weight: 750; cursor: pointer; }

@media (max-width: 640px) {
  .fks-app { margin: 10px auto; padding: 12px; }
  .fks-card { padding: 26px 18px; border-radius: 16px; }
  .fks-code { letter-spacing: .1em; }
  .fks-actions { display: grid; }
  .fks-button { width: 100%; }
}
