:root {
  --bg: #0b0d1a;
  --surface: #151a30;
  --surface-high: #222a48;
  --outline: #33406b;
  --text: #eef1fa;
  --text-dim: #8e98b8;
  --accent: #3df5ff;
  --crystal: #fff0a0;
  --danger: #ff4f6d;
  --good: #22c77a;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--text);
  font: 15px/1.5 Roboto, system-ui, sans-serif;
  background:
    radial-gradient(1200px 500px at 85% -10%, rgba(61,245,255,0.07), transparent 60%),
    radial-gradient(900px 500px at 0% 110%, rgba(199,125,255,0.07), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  min-height: 100vh;
}

a { color: var(--accent); }

.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 10px 24px;
  border-bottom: 1px solid var(--outline);
  background: rgba(21, 26, 48, 0.92);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 5;
  flex-wrap: wrap;
}

/* The logo of the app: speed lines and an italic gradient VELOX. */
.brand { text-decoration: none; display: flex; align-items: center; gap: 6px; }
.brand-lines { display: flex; flex-direction: column; gap: 3px; align-items: flex-end; }
.brand-lines i { display: block; height: 3px; border-radius: 2px; background: linear-gradient(90deg, transparent, #3df5ff); }
.brand-lines i:nth-child(1) { width: 18px; }
.brand-lines i:nth-child(2) { width: 26px; }
.brand-lines i:nth-child(3) { width: 14px; }
.brand-velox {
  font-weight: 900;
  font-style: italic;
  font-size: 28px;
  letter-spacing: 1px;
  background: linear-gradient(90deg, #3df5ff, #c77dff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  padding-right: 4px;
}
.brand-sub { color: var(--text-dim); font-weight: 700; letter-spacing: 4px; text-transform: uppercase; font-size: 11px; margin-left: 8px; }

/* Segmented tabs like the workshop's "Publiczne / Moje": the game's pages
   (as on its website, hosting/) around the workshop's. Too many for a narrow
   screen: there they take a row of their own and scroll sideways. */
.nav {
  position: relative;
  display: flex;
  gap: 2px;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
  background: var(--surface);
  border: 1px solid var(--outline);
  border-radius: 14px;
  padding: 4px;
}
.nav::-webkit-scrollbar { display: none; }
.nav a {
  flex: none;
  white-space: nowrap;
  color: var(--text-dim);
  text-decoration: none;
  padding: 7px 14px;
  border-radius: 10px;
  font-weight: 800;
  font-size: 14px;
}
.nav a:hover { color: var(--text); }
.nav a.active { background: var(--accent); color: var(--bg); }

.account { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.account-name { font-weight: 700; display: flex; align-items: center; gap: 6px; color: var(--text); text-decoration: none; max-width: 180px; }
.account-name:hover, .account-name.active { color: var(--accent); }
.account-name::before { content: ''; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); }

/* PL | EN: the same page in the other language (as on the game's website). */
.langs { display: flex; gap: 2px; padding: 4px; border: 1px solid var(--outline); border-radius: 14px; background: var(--surface); }
.langs a { padding: 5px 9px; border-radius: 10px; color: var(--text-dim); font-size: 12px; font-weight: 800; letter-spacing: 1px; line-height: 20px; text-decoration: none; }
.langs a:hover { color: var(--text); }
.langs a[aria-current="true"] { background: var(--surface-high); color: var(--text); }

.page { max-width: 1280px; margin: 0 auto; padding: 24px 16px 48px; }
.footer { text-align: center; color: var(--text-dim); font-size: 13px; padding: 24px 16px 40px; border-top: 1px solid var(--outline); }
.footer p { margin: 4px 0; }

@media (max-width: 1180px) {
  .nav { order: 3; flex: 1 1 100%; }
}
@media (max-width: 600px) {
  .topbar { gap: 10px; padding: 10px 16px; }
  .brand-sub { display: none; }
  .brand-velox { font-size: 24px; }
  .account { gap: 6px; }
  .account-name { max-width: 110px; overflow: hidden; white-space: nowrap; }
  /* Room for PL | EN on the first row: logging out is on the account page. */
  #account-logout { display: none; }
}

/* ---- VELORUSH MAX and the account ---- */
.max-gate { max-width: 780px; margin: 0 auto 24px; padding: 18px 20px; border: 1px solid #ffd23d; border-radius: 16px; background: var(--surface); }
.max-gate h2 { margin: 0 0 8px; font-size: 18px; font-weight: 900; color: #ffd23d; }
.max-gate p { margin: 0 0 10px; }
.account-facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 16px; margin: 16px 0 8px; }
.account-facts dt { color: var(--text-dim); }
.account-facts dd { margin: 0; overflow-wrap: anywhere; }
.account-facts code { font-size: 14px; background: var(--surface); border: 1px solid var(--outline); border-radius: 8px; padding: 2px 6px; }
.max-yes { color: var(--good); font-weight: 800; }
.max-no { color: #ffd23d; font-weight: 800; }
@media (max-width: 520px) {
  .account-facts { grid-template-columns: 1fr; gap: 2px; }
  .account-facts dd { margin-bottom: 8px; }
}

/* ---- the game's pages: the game, help, privacy ---- */
.prose { max-width: 780px; margin: 0 auto; font-size: 16px; line-height: 1.6; overflow-wrap: anywhere; }
.prose h1 { margin: 8px 0 4px; font-weight: 900; letter-spacing: 3px; text-transform: uppercase; font-size: 26px; line-height: 1.2; }
.prose h2 { margin: 36px 0 8px; font-size: 19px; font-weight: 900; color: var(--accent); }
.prose h3 { margin: 22px 0 6px; font-size: 16px; font-weight: 700; }
.prose ul { padding-left: 22px; }
.prose li { margin-bottom: 6px; }
.prose-date { color: var(--text-dim); margin: 0 0 8px; }
.prose-box { background: var(--surface); border: 1px solid var(--outline); border-radius: 12px; padding: 14px 16px; margin: 20px 0; }
.prose-box p { margin: 0 0 8px; }
.prose-box p:last-child { margin-bottom: 0; }
.game-hero { display: flex; align-items: center; gap: 20px; margin: 8px 0 16px; }
.game-hero img { width: 96px; height: 96px; border-radius: 22px; box-shadow: 0 0 24px rgba(61, 245, 255, 0.25); }
.game-hero h1 { margin: 0 0 4px; }
.tagline { margin: 0; color: var(--text-dim); font-size: 17px; }
.buttons { display: flex; flex-wrap: wrap; gap: 10px; margin: 24px 0; }

/* Questions and answers (help). */
.prose details { margin: 10px 0; padding: 0 16px; border: 1px solid var(--outline); border-radius: 14px; background: var(--surface); }
.prose summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; cursor: pointer; font-weight: 800; list-style: none; }
.prose summary::-webkit-details-marker { display: none; }
.prose summary::after { content: "+"; flex: none; color: var(--accent); font-weight: 900; }
.prose details[open] summary::after { content: "−"; }
.prose details > p { margin-top: 0; }

@media (max-width: 520px) {
  .game-hero { flex-direction: column; align-items: flex-start; gap: 12px; }
}

.hero { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.hero h1 { margin: 0 0 4px; font-weight: 900; letter-spacing: 3px; text-transform: uppercase; font-size: 26px; }
.hero p { margin: 0; color: var(--text-dim); }

/* Buttons like the app's menu tiles and MenuButton. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 14px;
  padding: 12px 20px;
  font: inherit;
  font-weight: 900;
  font-size: 14px;
  letter-spacing: 2px;
  text-transform: uppercase;
  cursor: pointer;
  background: var(--surface-high);
  color: var(--text);
  text-decoration: none;
  transition: transform .08s, box-shadow .15s, background .15s;
}
.btn:hover:not(:disabled) { background: #2b3558; }
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: .45; cursor: default; }
.btn-primary { background: var(--accent); color: var(--bg); box-shadow: 0 0 22px rgba(61, 245, 255, 0.35); }
.btn-primary:hover:not(:disabled) { background: #6ff8ff; }
.btn-ghost { background: transparent; border: 1px solid var(--outline); }
.btn-ghost:hover:not(:disabled) { background: var(--surface); }
.btn-danger { background: transparent; border: 1px solid var(--danger); color: var(--danger); }
.btn-small { padding: 7px 12px; font-size: 12px; letter-spacing: 1.5px; border-radius: 12px; }

.notice { color: var(--text-dim); background: var(--surface); padding: 16px; border-radius: 12px; }
.muted { color: var(--text-dim); }
.small { font-size: 13px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
/* Cards like the episode board tiles in the app. */
.card {
  background: linear-gradient(135deg, var(--surface-high), var(--surface));
  border: 1px solid var(--outline);
  border-radius: 16px;
  overflow: hidden;
  padding: 8px;
  transition: border-color .15s, transform .15s;
}
.card:hover { border-color: rgba(61, 245, 255, 0.6); transform: translateY(-2px); }
.thumb { display: block; width: 100%; aspect-ratio: 42 / 23; height: auto; background: #0b0f2a; border-radius: 10px; }
.thumb-empty { background: var(--surface-high); }
.card-body { padding: 10px 6px 4px; }
.card h3 { margin: 0 0 2px; font-size: 16px; font-weight: 900; }
.meta { display: flex; justify-content: space-between; gap: 8px; color: var(--text-dim); font-size: 13px; margin-bottom: 8px; }
.problems { font-size: 12px; min-height: 0; margin: 0 0 8px; }
.problems:empty { display: none; }

/* Badges like "WKRÓTCE" in the app's menu. */
.tag { font-size: 11px; font-weight: 900; letter-spacing: 1.5px; text-transform: uppercase; padding: 2px 8px; border-radius: 6px; }
.tag-public { color: var(--bg); background: var(--accent); }
.tag-private { color: var(--bg); background: #ffd23d; }
.tag-dim { color: var(--text-dim); background: var(--surface-high); }

/* ---- game levels (admin) ---- */
.episode { margin-bottom: 28px; }
.episode h2 { font-size: 15px; font-weight: 900; letter-spacing: 3px; text-transform: uppercase; color: var(--accent); margin: 0 0 12px; }
.episode-name { color: var(--text); }
.board-card { color: var(--text); text-decoration: none; display: block; }
.level-info { border: 1px solid #ffd23d; border-radius: 12px; padding: 10px; margin-bottom: 16px; font-size: 13px; }
.level-info b { color: #ffd23d; }
.level-finished { margin: 10px 0 0; font-size: 13px; align-items: flex-start; }
.level-finished input { width: 18px; height: 18px; flex: none; accent-color: #ffd23d; }
.tag-wip { color: var(--bg); background: #ffd23d; }
.requires { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--outline); }
.requires-title { color: var(--text) !important; }
.requires p { margin: 4px 0 8px; }
.requires-list { list-style: none; padding: 0; margin: 0 0 8px; display: flex; flex-direction: column; gap: 6px; }
.requirement { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.requirement select { flex: 1 1 100%; min-width: 0; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--outline); background: var(--bg); color: var(--text); font: inherit; font-size: 13px; }
.requirement input { width: 64px; padding: 5px 6px; border-radius: 8px; border: 1px solid var(--outline); background: var(--bg); color: var(--text); font: inherit; font-size: 13px; }
.requirement .btn { margin-left: auto; padding: 3px 9px; }
.episode-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 0 12px; }
.episode-head h2 { margin: 0; }
.episode-head .edit-episode { margin-left: auto; }
.move { display: flex; gap: 4px; align-items: center; }
.move .btn { padding: 4px 10px; min-width: 34px; font-size: 14px; letter-spacing: 0; }
.board-item { display: flex; flex-direction: column; gap: 6px; }
.board-item .board-card { flex: 1; }
.board-move { justify-content: center; }
.board-pos { min-width: 44px; text-align: center; }
.move .delete-board { margin-left: 6px; font-size: 12px; letter-spacing: 1px; }
.move .to-episode { border-color: #ffd23d; color: #ffd23d; }
.episode-title { display: flex; flex-direction: column; gap: 2px; }
.episode-edit { background: var(--surface); border: 1px solid var(--outline); border-radius: 14px; padding: 4px 14px 12px; margin: 0 0 12px; }
.episode-edit .fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0 12px; }
.episode-edit select { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--outline); background: var(--bg); color: var(--text); font: inherit; }
.order-bar { position: sticky; bottom: 12px; z-index: 5; display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  margin: 16px 0; padding: 12px 16px; border-radius: 14px; border: 1px solid #ffd23d;
  background: var(--surface-high); box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5); font-size: 14px; }
.new-episode { background: var(--surface); border: 1px solid var(--outline); border-radius: 16px; padding: 16px; margin-bottom: 28px; }
.new-episode h2 { margin: 0 0 4px; font-size: 15px; font-weight: 900; letter-spacing: 3px; text-transform: uppercase; color: var(--accent); }
.new-episode .fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0 12px; }
.new-episode select { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--outline); background: var(--bg); color: var(--text); font: inherit; }

/* ---- login ---- */
.auth-box { max-width: 440px; margin: 24px auto; background: linear-gradient(135deg, var(--surface-high), var(--surface)); border: 1px solid var(--outline); border-radius: 18px; padding: 24px; }
.tabs { display: flex; background: var(--bg); border-radius: 12px; padding: 4px; margin-bottom: 12px; }
.tab { flex: 1; border: 0; background: transparent; color: var(--text-dim); font: inherit; font-weight: 800; padding: 8px; border-radius: 9px; cursor: pointer; }
.tab.active { background: var(--accent); color: var(--bg); }
.field { display: block; margin: 12px 0; }
.field span { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 4px; }
.field input, .map-name {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--outline);
  background: var(--bg);
  color: var(--text);
  font: inherit;
}
.field input:focus, .map-name:focus { outline: 2px solid var(--accent); border-color: transparent; }
.error { color: var(--danger); }
.ok { color: var(--good); }
[hidden] { display: none !important; }

.btn-google { width: 100%; background: #fff; color: #1f1f1f; margin: 4px 0; letter-spacing: 0.5px; text-transform: none; font-weight: 700; }
.btn-google:hover:not(:disabled) { background: #eef1fa; }
.btn-google .g { color: #4285f4; font-size: 20px; font-weight: 900; }
.btn-apple { width: 100%; background: #000; color: #fff; border: 1px solid #3a3f55; margin: 4px 0; letter-spacing: 0.5px; text-transform: none; font-weight: 700; }
.btn-apple:hover:not(:disabled) { background: #16181f; }
.btn-apple .a { font-size: 20px; font-family: -apple-system, 'Helvetica Neue', sans-serif; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--text-dim); font-size: 12px; margin: 10px 0 0; }
.divider::before, .divider::after { content: ''; flex: 1; border-top: 1px solid var(--outline); }

/* ---- editor ---- */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 20px; align-items: start; }
.editor-bar { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.map-name { width: 240px; font-weight: 700; }
.tools { display: flex; background: var(--surface); border: 1px solid var(--outline); border-radius: 12px; padding: 3px; }
.tool { border: 0; background: transparent; color: var(--text-dim); font: inherit; font-weight: 700; font-size: 13px; padding: 6px 10px; border-radius: 9px; cursor: pointer; }
.tool.active { background: var(--accent); color: var(--bg); }
.canvas-wrap { width: 100%; }
#board { display: block; border-radius: 10px; cursor: crosshair; touch-action: none; border: 1px solid var(--outline); }
.hint { color: var(--text-dim); font-size: 13px; }
.editor-side { background: linear-gradient(160deg, var(--surface-high), var(--surface)); border: 1px solid var(--outline); border-radius: 16px; padding: 16px; position: sticky; top: 80px; }
.editor-side h2 { font-size: 12px; font-weight: 900; letter-spacing: 3px; text-transform: uppercase; color: var(--accent); margin: 0 0 8px; }
.palette { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-bottom: 16px; }
.piece { display: flex; align-items: center; gap: 6px; padding: 4px; border-radius: 8px; border: 1px solid transparent; background: var(--bg); color: var(--text); font: inherit; font-size: 12px; text-align: left; cursor: pointer; line-height: 1.2; }
.piece canvas { flex: none; border-radius: 4px; }
.piece.active { border-color: var(--accent); background: var(--surface-high); }
.checks { list-style: none; padding: 0; margin: 0 0 12px; font-size: 13px; }
.checks li { padding: 2px 0 2px 20px; position: relative; }
.checks li::before { position: absolute; left: 0; }
.checks .bad { color: var(--danger); }
.checks .bad::before { content: '✕'; }
.checks .good { color: var(--good); }
.checks .good::before { content: '✓'; }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 8px; font-size: 13px; }
.setting small { color: var(--text-dim); }
.setting input[type=number], .setting select {
  width: 92px; flex: none; padding: 5px 8px; border-radius: 8px; border: 1px solid var(--outline);
  background: var(--bg); color: var(--text); font: inherit;
}
.setting input[type=range] { width: 110px; flex: none; accent-color: var(--accent); }
.setting select { width: 130px; }
.setting input[type=checkbox] { width: 18px; height: 18px; flex: none; accent-color: var(--accent); }
.drone-panel { border: 1px solid var(--accent); border-radius: 12px; padding: 10px; margin-bottom: 16px; }
.drone-panel h2 span { color: var(--text-dim); letter-spacing: 0; text-transform: none; }
.switch { display: flex; gap: 8px; align-items: center; margin: 0 0 12px; font-size: 14px; }

@media (max-width: 900px) {
  .editor { grid-template-columns: 1fr; }
  .editor-side { position: static; }
}
