/* ---------- Tokens (flat, Material-like; primary đỏ son #C8372D) ---------- */
:root {
  --primary: #C8372D;
  --primary-hover: #D44A3F;
  --positive: #2E7D4F;
  --negative: #B3261E;
  --warning: #F7DC6F;
  --header-h: 56px;
  --radius: 8px;
  --font: 'Be Vietnam Pro', -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --shadow-1: 0 1px 5px rgba(0, 0, 0, .2), 0 2px 2px rgba(0, 0, 0, .14), 0 3px 1px -2px rgba(0, 0, 0, .12);
  --shadow-menu: 0 2px 4px -1px rgba(0, 0, 0, .2), 0 4px 5px rgba(0, 0, 0, .14), 0 1px 10px rgba(0, 0, 0, .12);
  --shadow-dlg: 0 5px 5px -3px rgba(0, 0, 0, .2), 0 8px 10px 1px rgba(0, 0, 0, .14), 0 3px 14px 2px rgba(0, 0, 0, .12);
  --grad-a: rgba(93, 173, 226, .3);
  --grad-b: rgba(175, 122, 197, .3);
  --button-border: 1px solid rgba(255, 255, 255, .2);
}
:root, :root[data-theme="light"] {
  color-scheme: light;
  --bg: #ffffff;
  --text: #1c1917;
  --text-body: #33302d;
  --text-dim: rgba(0, 0, 0, .58);
  --card: #ffffff;
  --card-inner: #f8f6f4;
  --header-bg: #f7f5f3;
  --header-text: #1c1917;
  --secondary-bg: #f8e9e7;
  --secondary-fg: #a52a21;
  --grey-bg: #eeeeee;
  --grey-fg: #424242;
  --border: #dcd7d2;
  --sep: rgba(0, 0, 0, .12);
  --field-bg: rgba(0, 0, 0, .05);
  --field-line: rgba(0, 0, 0, .42);
  --hover: rgba(0, 0, 0, .06);
  --track: rgba(200, 55, 45, .25);
  --menu-bg: #ffffff;
  --dlg-head: rgba(0, 0, 0, .06);
  --backdrop: rgba(0, 0, 0, .4);
  --muted-choice: #616161;
  --link: #a52a21;
  --badge: #757575;
  --accent-text: #a52a21;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121212;
  --text: #ffffff;
  --text-body: #f2efec;
  --text-dim: rgba(255, 255, 255, .66);
  --card: #1d1d1d;
  --card-inner: #171717;
  --header-bg: #212121;
  --header-text: #ffffff;
  --secondary-bg: #4a2a27;
  --secondary-fg: #f8e9e7;
  --grey-bg: #424242;
  --grey-fg: #eeeeee;
  --border: #6e6a67;
  --sep: rgba(255, 255, 255, .16);
  --field-bg: #272727;
  --field-line: rgba(255, 255, 255, .6);
  --hover: rgba(255, 255, 255, .08);
  --track: rgba(255, 255, 255, .26);
  --menu-bg: #2b2b2b;
  --dlg-head: rgba(255, 255, 255, .04);
  --backdrop: rgba(0, 0, 0, .55);
  --muted-choice: #616161;
  --link: #f2a69d;
  --badge: #616161;
  --accent-text: #f2a69d;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; min-width: 300px; font: 14px/1.5 var(--font); color: var(--text-body); background: var(--bg); }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
img { max-width: 100%; }
kbd { font: 500 12px var(--font); padding: 1px 6px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; }
code { font-family: ui-monospace, Consolas, monospace; font-size: .92em; }
[hidden] { display: none !important; }
/* keep room for icons while the icon font is still loading, so buttons don't shift when it arrives */
.tb-btn > i, .btn > i, .menu-item > i, .link-plain > i, .icon-btn > i, .round-btn > i { display: inline-block; min-width: 1em; text-align: center; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.grow { flex: 1; min-width: 0; }
.skip-link { position: absolute; left: 12px; top: -48px; z-index: 100; padding: 8px 12px; border-radius: var(--radius); background: var(--primary); color: #fff; text-decoration: none; font-weight: 500; }
.skip-link:focus { top: 8px; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-text); }
.noscript { text-align: center; padding: 24px; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--header-h);
  display: flex; align-items: stretch;
  padding: 0 12px;
  background: var(--header-bg); color: var(--header-text);
  box-shadow: var(--shadow-menu);
  transition: transform .25s ease;
}
.topbar.is-away { transform: translateY(-110%); }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 4px; text-decoration: none; color: inherit; flex: none; }
.brand img { width: 38px; height: 38px; border-radius: 9px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-size: 1.5em; font-weight: 700; letter-spacing: -.2px; white-space: nowrap; }
.brand-tag { font-size: 11px; color: var(--text-dim); white-space: nowrap; }
.tb-nav { margin-left: auto; display: flex; align-items: stretch; }
.tb-btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 4px 12px; border: 0; border-radius: 0;
  background: transparent; font-weight: 500; white-space: nowrap;
}
.tb-btn:hover:not(:disabled) { background: var(--hover); }
.tb-btn:disabled { opacity: .45; }
.tb-btn .fas, .tb-btn .fa, .tb-btn .fa-solid { font-size: 1rem; }
.tb-btn.tb-icon { padding: 4px 14px; }
.tb-accent { color: var(--accent-text); font-weight: 600; }
.tb-sep { width: 1px; margin: 14px 4px; background: var(--sep); }
.tb-caret { margin-left: -4px; font-size: 11px; }
.tb-nav > .menu-anchor { display: flex; }
.topbar .tb-burger-wrap { display: none; margin-left: auto; align-items: center; }
.tb-burger { width: 42px; height: 42px; padding: 0; justify-content: center; border-radius: 50%; }

/* ---------- Menus ---------- */
.menu-anchor { position: relative; display: inline-flex; }
.menu-anchor.inline { display: inline-block; }
.menu {
  position: absolute; top: calc(100% + 2px); left: 0; z-index: 60;
  min-width: 200px; max-height: 80vh; overflow-y: auto; padding: 6px 0;
  background: var(--menu-bg); color: var(--text-body);
  border-radius: var(--radius); box-shadow: var(--shadow-menu);
}
.menu.flip-up { top: auto; bottom: calc(100% + 2px); }
.menu-right { left: auto; right: 0; }
.menu-scroll { max-height: min(60vh, 480px); min-width: 280px; }
.menu-wide { min-width: 300px; }
.menu-item {
  display: flex; align-items: center; gap: 16px; width: 100%;
  min-height: 42px; padding: 8px 16px; border: 0; background: none; text-align: left; white-space: nowrap; color: inherit; text-decoration: none;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--hover); outline: 0; }
.menu-item > .fas, .menu-item > .fa, .menu-item > .far, .menu-item > .fab, .menu-item > .fa-solid, .menu-item > .fa-regular { width: 18px; text-align: center; opacity: .75; }
.menu-item-tall { min-height: 56px; }
.menu-warn { color: #b26b00; }
:root[data-theme="dark"] .menu-warn { color: var(--warning); }
.menu-sep { border: 0; border-top: 1px solid var(--sep); margin: 6px 0; }
.menu-group { padding: 12px 16px 4px; font-size: 13px; font-weight: 700; opacity: .7; }
.menu-row { display: flex; gap: 8px; padding: 8px 16px; }
.menu-row .field-input { flex: 1; }
.menu-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex: none; background-size: cover; background-position: center; box-shadow: 0 0 0 1px var(--sep); }
.av-bg { background: conic-gradient(#5dade2 0 90deg, #82e0aa 0 180deg, #f7dc6f 0 270deg, #af7ac5 0); }
.av-center { background: radial-gradient(circle, #fff 0 32%, transparent 33%), conic-gradient(#5dade2 0 90deg, #82e0aa 0 180deg, #f7dc6f 0 270deg, #af7ac5 0); }
.av-slice { background: conic-gradient(from -30deg, #af7ac5 0 60deg, transparent 0), #e9e9ef; }
.theme-item { padding-left: 28px; justify-content: space-between; gap: 18px; }
.theme-swatch { display: inline-flex; gap: 2px; flex: none; }
.theme-swatch i { width: 12px; height: 12px; outline: 1px solid #000; outline-offset: -1px; }

/* ---------- Page layout ---------- */
.page {
  position: relative;
  min-height: calc(100vh - var(--header-h));
  min-height: calc(100dvh - var(--header-h));
  padding: 10px;
  background: var(--page-bg-color, transparent);
}
.page-bg { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(at 0% 0%, var(--grad-a) 0, transparent 50%), radial-gradient(at 98% 1%, var(--grad-b) 0, transparent 50%); }
.page.no-gradient .page-bg { display: none; }
.left-col, .center-col, .right-col { position: relative; min-width: 0; }
/* landscape: [title & stats | wheel | editor]; App.layout sizes the side columns so the wheel gets the rest */
body.landscape .page { display: grid; grid-template-columns: var(--left-w, 0px) minmax(0, 1fr) var(--editor-w, 0px); grid-template-rows: minmax(0, 1fr); padding: 12px; height: calc(100vh - var(--header-h)); height: calc(100dvh - var(--header-h)); }
body.landscape .left-col { grid-column: 1; display: flex; flex-direction: column; gap: 16px; padding-right: 16px; overflow-y: auto; scrollbar-width: none; }
body.landscape .center-col { grid-column: 2; }
body.landscape .right-col { grid-column: 3; height: 100%; min-height: 0; padding-left: 16px; }
body.landscape:not(.has-left) .left-col { display: none; }
body.landscape.editor-hidden .right-col, body.is-fullscreen .right-col { display: none; }
/* narrow landscape: the title goes above the wheel and the stats card is dropped, so the wheel stays big */
body.landscape.left-top .page { grid-template-rows: auto minmax(0, 1fr); }
body.landscape.left-top .left-col { grid-column: 2; grid-row: 1; padding: 0 0 8px; overflow: visible; }
body.landscape.left-top .center-col { grid-row: 2; }
body.landscape.left-top .right-col { grid-row: 1 / 3; }
body.landscape.left-top .stage-card { display: none; }
body.landscape.left-top .title-block { align-items: center; text-align: center; gap: 2px; }
body.landscape.left-top .title-row { justify-content: center; }
body.landscape.left-top .title-placeholder { align-self: center; }
body.landscape.left-top .wheel-title { font-size: 24px; }
body.portrait .page { display: flex; flex-direction: column; gap: 16px; }
body.portrait:not(.has-left) .left-col { display: none; }
body.portrait .stage-card { display: none; }

.center-col {
  display: grid; justify-content: center; align-content: center;
  grid-template-columns: repeat(var(--wheel-cols, 1), var(--wheel-size, 500px));
  gap: 12px; outline: 0;
}
.wheel-container { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.wheel-title-sm { font-size: 1.5rem; line-height: 2rem; font-weight: 400; color: var(--text); text-align: center; max-width: 100%; overflow-wrap: anywhere; min-height: 2rem; }
.wheel-wrap { position: relative; width: var(--wheel-size, 500px); height: var(--wheel-size, 500px); user-select: none; -webkit-user-select: none; }
.wheel-wrap canvas { display: block; width: 100%; height: 100%; cursor: pointer; border-radius: 50%; -webkit-tap-highlight-color: transparent; touch-action: none; }
.wheel-container.is-busy canvas { cursor: default; }
.wheel-wrap canvas:focus-visible { outline: 3px solid var(--primary); outline-offset: -6px; }
.wheel-overlay {
  position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none;
  font-family: sans-serif; font-weight: 800; font-size: 12px; fill: #fff;
  filter: drop-shadow(0 0 10px #000); transition: opacity .3s;
}
.wheel-overlay.is-hidden { opacity: 0; }
.wheel-overlay .ov-tap { display: none; }
@media (hover: none) and (pointer: coarse) {
  .wheel-overlay .ov-tap { display: inline; }
  .wheel-overlay .ov-click { display: none; }
}

.title-block { display: flex; flex-direction: column; gap: 6px; }
.title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.wheel-title { margin: 0; font-size: 32px; line-height: 1.25; font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
.wheel-desc { margin: 0; white-space: pre-line; overflow-wrap: anywhere; color: var(--text-body); }
.title-placeholder { align-self: flex-start; border: 1px dashed var(--border); border-radius: var(--radius); background: none; padding: 6px 12px; color: var(--text-dim); font-size: 15px; }
.title-placeholder:hover { color: var(--text); border-color: var(--primary); }
body.portrait .title-block { align-items: center; text-align: center; }
body.portrait .title-placeholder { align-self: center; }

.stage-card { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.stat-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat { display: flex; flex-direction: column; padding: 8px 12px; border-radius: var(--radius); background: var(--card-inner); min-width: 0; }
.stat b { font-size: 26px; line-height: 1.2; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--text-dim); }
.last-win { display: flex; flex-direction: column; padding: 8px 12px; border-left: 3px solid var(--primary); border-radius: 0 var(--radius) var(--radius) 0; background: var(--card-inner); }
.lw-label { font-size: 12px; color: var(--text-dim); }
.lw-label i { color: #e0a800; }
.lw-name { font-size: 20px; font-weight: 700; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn.btn-spin { min-height: 46px; font-size: 16px; }
.hint { margin: 0; display: flex; gap: 8px; font-size: 12.5px; color: var(--text-dim); line-height: 1.45; }
.hint i { margin-top: 3px; }

.round-btn {
  display: inline-grid; place-items: center; flex: none;
  width: 34px; height: 34px; border-radius: 50%; border: 0; padding: 0; font-size: 14px;
  box-shadow: var(--shadow-1);
}
.round-sm { width: 30px; height: 30px; font-size: 12px; }
.round-btn.btn-secondary { border: var(--button-border); }

.right-col { display: flex; flex-direction: column; }
.editor-toggle { position: absolute; top: 19px; left: 1px; z-index: 4; border-left: var(--button-border); }
body.portrait .editor-toggle { display: none; }
.show-editor { position: absolute; top: 16px; right: 8px; z-index: 5; display: none; }
body.landscape.editor-hidden:not(.is-fullscreen):not(.shared-view) .show-editor { display: inline-grid; }

/* ---------- Editor card ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow-1); }
.editor-card { flex: 1; min-height: 0; display: flex; flex-direction: column; }
body.portrait .editor-card { min-height: 520px; }
.tabs { display: flex; flex: none; overflow-x: auto; scrollbar-width: none; }
.tab {
  position: relative; flex: 1 1 auto; min-width: 72px;
  height: 40px; padding: 0 10px; border: 0; background: none;
  font-weight: 500; color: var(--text-body); opacity: .85; white-space: nowrap;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.tab:hover:not(:disabled) { background: var(--hover); }
.tab.is-active { opacity: 1; color: var(--accent-text); }
.tab.is-active::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: currentColor; }
.badge { display: inline-block; padding: 2px 6px; border-radius: 12px; font-size: 12px; line-height: 12px; font-weight: 400; background: var(--badge); color: #fff; }
.tab.is-active .badge { background: var(--primary); }
.tab-panels { flex: 1; min-height: 312px; display: flex; flex-direction: column; box-shadow: var(--shadow-1); border-radius: var(--radius); }
.tab-panel { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 16px; padding: 16px; }
.tool-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 36px; padding: 4px 16px; border: 0; border-radius: var(--radius);
  font-weight: 500; white-space: nowrap; background: transparent; line-height: 1.2; text-decoration: none;
  transition: filter .15s, background .15s;
}
.btn:disabled { opacity: .45; }
.btn .fas, .btn .fa, .btn .far, .btn .fa-solid { font-size: 1rem; }
.btn-xs { min-height: 29px; padding: 4px 8px; font-size: 12px; border-radius: 6px; gap: 8px; }
.btn-xs .fas, .btn-xs .fa, .btn-xs .far { font-size: 1.1em; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-secondary { background: var(--secondary-bg); color: var(--secondary-fg); }
.btn-grey { background: var(--grey-bg); color: var(--grey-fg); }
.btn-positive { background: var(--positive); color: #fff; }
.btn-negative { background: var(--negative); color: #fff; }
.btn-unel { background: var(--hover); min-width: 44px; }
.btn-primary:hover:not(:disabled), .btn-secondary:hover:not(:disabled), .btn-grey:hover:not(:disabled), .btn-positive:hover:not(:disabled), .btn-negative:hover:not(:disabled) { filter: brightness(1.08); }
:root[data-theme="dark"] .btn-secondary:hover:not(:disabled) { filter: brightness(1.2); }
.btn-flat { color: var(--text); font-weight: 700; }
.btn-flat:hover:not(:disabled), .btn-unel:hover:not(:disabled) { background: var(--hover); }
.btn-200 { width: 200px; justify-content: space-between; }
.split { display: inline-flex; }
.split > .btn:first-child { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.split > .split-caret { border-top-left-radius: 0; border-bottom-left-radius: 0; padding: 4px 10px; }
.tool-row .split > .split-caret { padding: 4px 8px 4px 2px; }
.multi-controls .split > .split-caret { border-left: 1px solid rgba(200, 55, 45, .25); }
.link { border: 0; background: none; padding: 0; color: var(--link); text-decoration: underline; }
.link-plain { border: 0; background: none; padding: 0; color: inherit; display: inline-flex; gap: 8px; align-items: center; text-decoration: none; }
.link-plain:hover { text-decoration: underline; }
.push-left { margin-right: auto; }
.push-left-sm { margin-right: auto; }
.push-right { margin-left: auto; }

.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; min-height: 36px; color: var(--text-body); }
.check input, .radio input { width: 18px; height: 18px; margin: 0; accent-color: var(--primary); cursor: pointer; flex: none; }
.check-xs { font-size: 12px; font-weight: 500; gap: 8px; min-height: 29px; }
.check-xs input { width: 15px; height: 15px; }
.check input:disabled + span { opacity: .45; }
.radio { display: flex; align-items: center; gap: 10px; min-height: 40px; cursor: pointer; }
.radio-row { display: flex; flex-wrap: wrap; gap: 4px 28px; }
.radio-icon i { width: 18px; text-align: center; opacity: .8; }

.basic-editor {
  flex: 1; min-height: 160px; overflow-y: auto;
  padding: 9.6px;
  border: 1px solid var(--border); border-radius: var(--radius);
  font: 14px/21px var(--font);
  color: var(--text-body); white-space: pre-wrap; overflow-wrap: anywhere; outline: 0;
}
.basic-editor:focus { border-color: var(--primary); }
.basic-editor:empty::before { content: attr(data-placeholder); color: var(--text-dim); }
.basic-editor.is-locked { opacity: .7; }
.basic-editor div, .basic-editor p { margin: 0; min-height: 21px; }
.basic-editor img { display: inline-block; height: 25px; width: auto; vertical-align: middle; margin: 0 4px 1px 0; border-radius: 2px; }

.adv-editor { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; }
.adv-list { list-style: none; margin: 0; padding: 0 4px 0 0; overflow-y: auto; flex: 1; min-height: 200px; }
.adv-row { display: flex; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--sep); }
.adv-edit { flex: none; }
.adv-row.is-faded .adv-main { opacity: .45; }
.adv-move, .adv-side { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: none; }
.rb { width: 26px; height: 26px; border: 0; border-radius: 50%; background: none; color: var(--text-dim); display: inline-grid; place-items: center; padding: 0; font-size: 14px; flex: none; }
.rb:hover:not(:disabled) { background: var(--hover); color: var(--text); }
.rb:disabled { visibility: hidden; }
.rb-round { width: 36px; height: 36px; background: var(--secondary-bg); color: var(--secondary-fg); }
.rb-round:hover:not(:disabled) { background: var(--secondary-bg); filter: brightness(1.08); color: var(--secondary-fg); }
.rb-primary, .rb-primary:hover:not(:disabled) { background: var(--secondary-bg); color: var(--secondary-fg); border: var(--button-border); }
.rb-flat { width: 36px; height: 36px; font-size: 16px; }
.adv-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.adv-text { width: 100%; height: 40px; padding: 0 12px; border: 0; border-bottom: 1px solid var(--field-line); border-radius: 4px 4px 0 0; background: var(--field-bg); outline: 0; }
.adv-text:focus { border-bottom: 2px solid var(--primary); }
.adv-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.adv-color { position: relative; width: 48px; height: 36px; border-radius: 3px; display: inline-grid; place-items: center; cursor: pointer; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1); }
.adv-color input, .color-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; border: 0; padding: 0; }
.adv-thumb { position: relative; display: inline-block; }
.adv-thumb img { max-height: 40px; max-width: 70px; border-radius: 4px; display: block; }
.thumb-x { position: absolute; top: -6px; right: -6px; width: 18px; height: 18px; border-radius: 50%; border: 0; padding: 0; background: #616161; color: #fff; font-size: 10px; display: grid; place-items: center; }
.adv-weight-field { display: inline-flex; align-items: center; gap: 4px; height: 36px; padding: 0 2px 0 8px; border-radius: 4px; background: var(--field-bg); }
.adv-weight-field input { width: 54px; height: 32px; border: 0; background: none; outline: 0; text-align: center; -moz-appearance: textfield; }
.adv-weight-field input::-webkit-inner-spin-button { display: none; }
.adv-weight-field button { width: 26px; height: 26px; border: 0; border-radius: 50%; background: none; color: var(--text-dim); font-size: 11px; }
.adv-weight-field button:hover { background: var(--hover); }
.adv-prob { font-size: 12px; color: var(--text-dim); min-width: 32px; }
.adv-side input { width: 15px; height: 15px; margin: 0; accent-color: var(--primary); cursor: pointer; }
.adv-foot { display: flex; gap: 8px; }

.multi-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.multi-controls > .btn, .multi-controls .split .btn { min-height: 40px; padding: 4px 16px; }
.wheel-actions { display: contents; }
.app-info { display: flex; justify-content: space-between; align-items: center; padding: 8px; font-size: 13px; color: var(--text-dim); }

/* results */
.results-summary { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12px; color: var(--text-dim); }
.results-summary:empty { display: none; }
.chip { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; padding: 2px 10px; border-radius: 12px; background: var(--secondary-bg); color: var(--secondary-fg); }
.result-list { list-style: none; margin: 0; padding: 0; flex: 1; min-height: 160px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.result-list li { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-bottom: 1px solid var(--sep); }
.result-list li:last-child { border-bottom: 0; }
.r-idx { flex: none; min-width: 24px; font-size: 12px; color: var(--text-dim); text-align: right; font-variant-numeric: tabular-nums; }
.r-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; box-shadow: 0 0 0 1px rgba(0, 0, 0, .15); }
.r-name { flex: 1; min-width: 0; color: var(--text); overflow-wrap: anywhere; }
.r-name img { height: 22px; width: auto; vertical-align: middle; margin-right: 6px; border-radius: 2px; }
.r-time { flex: none; font-size: 12px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.result-empty { padding: 24px 12px; text-align: center; color: var(--text-dim); }

/* ---------- Shared view ---------- */
.shared-info { display: none; flex-direction: column; gap: 16px; }
body.shared-view .shared-info { display: flex; }
body.shared-view .topbar, body.shared-view .right-col, body.shared-view .below, body.shared-view .title-block, body.shared-view .stage-card { display: none; }
body.shared-view .page { min-height: 100vh; height: 100vh; }
body.shared-view.portrait .page { height: auto; }
.shared-card { padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.shared-card:first-child:has(.shared-title[hidden]):has(.wheel-desc[hidden]) { display: none; }
.shared-title { margin: 0; font-size: 2.125rem; line-height: 2.5rem; font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
.shared-controls { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 16px; }
.mute-toggle { display: inline-flex; align-items: center; gap: 8px; color: #9e9e9e; font-size: 150%; cursor: pointer; }
.shared-spin-all { position: fixed; right: 16px; bottom: 16px; z-index: 20; transition: transform .3s; }
body.is-busy .shared-spin-all { transform: translateY(150%); }

/* ---------- Below the fold ---------- */
.below { border-top: 1px solid var(--sep); }
.section { max-width: 1160px; margin: 0 auto; padding: 40px 16px 8px; }
.section-head { max-width: 720px; margin: 0 auto 24px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.section-head h2 { margin: 0; font-size: 1.75rem; line-height: 1.25; font-weight: 700; color: var(--text); }
.section-head p { margin: 0; color: var(--text-dim); font-size: 15px; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.feature { padding: 16px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow-1); }
.feature h3 { margin: 12px 0 4px; font-size: 16px; font-weight: 600; color: var(--text); }
.feature p { margin: 0; color: var(--text-dim); }
.f-icon { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--secondary-bg); color: var(--secondary-fg); font-size: 17px; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.steps li { padding: 16px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow-1); }
.steps h3 { margin: 10px 0 4px; font-size: 16px; font-weight: 600; color: var(--text); }
.steps p { margin: 0; color: var(--text-dim); }
.step-n { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: #fff; font-weight: 700; }
.faq-list { max-width: 820px; margin: 0 auto; display: flex; flex-direction: column; gap: 8px; }
.faq details { padding: 0 16px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow-1); }
.faq summary { cursor: pointer; padding: 14px 0; font-weight: 600; font-size: 15px; color: var(--text); }
.faq details p { margin: 0 0 14px; }
.footer { max-width: 1160px; margin: 40px auto 0; padding: 24px 16px 32px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 32px; border-top: 1px solid var(--sep); }
.footer-brand { display: flex; align-items: center; gap: 10px; }
.footer-brand img { border-radius: 8px; }
.footer-brand div { display: flex; flex-direction: column; }
.footer-brand b { color: var(--text); font-size: 16px; }
.footer-brand span { font-size: 12px; color: var(--text-dim); }
.footer-links { display: flex; flex-wrap: wrap; gap: 12px 28px; }

/* ---------- Dialogs ---------- */
.dlg {
  width: min(560px, calc(100vw - 32px)); max-width: 800px; max-height: calc(100dvh - 48px);
  padding: 0; border: 0; border-radius: var(--radius);
  background: var(--card); color: var(--text-body); box-shadow: var(--shadow-dlg);
}
.dlg[open] { display: flex; flex-direction: column; animation: dlg-in .2s ease-out; }
.dlg:focus { outline: none; }
.dlg::backdrop { background: var(--backdrop); }
@keyframes dlg-in { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }
.dlg form { display: contents; }
.dlg-400 { width: min(400px, calc(100vw - 32px)); }
.dlg-640 { width: min(640px, calc(100vw - 32px)); }
.dlg-700 { width: min(700px, 90vw); }
.dlg-800 { width: min(800px, calc(100vw - 32px)); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; background: var(--dlg-head); }
.dlg-head h2 { margin: 0; font-size: 1.2rem; line-height: 2rem; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 10px; min-width: 0; }
.dlg-head h2.h5 { font-size: 1.4rem; }
.h6 { margin: 8px 0 0; font-size: 1.15rem; font-weight: 600; color: var(--text); }
.dlg-body { padding: 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.dlg-body > * { flex-shrink: 0; }
.dlg-body p { margin: 0; }
.dlg-actions { display: flex; justify-content: flex-end; align-items: center; gap: 8px; padding: 8px; flex-wrap: wrap; }
.icon-btn { width: 36px; height: 36px; border: 0; border-radius: 50%; background: none; display: inline-grid; place-items: center; color: var(--text); font-size: 18px; flex: none; }
.icon-btn:hover { background: var(--hover); }
.prose p + p { margin-top: 12px; }
.row-gap { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.cl-h { margin: 0; font-size: 1rem; font-weight: 700; color: var(--text); }
.cl-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }

/* customize */
.tabs-center { justify-content: center; padding: 16px 16px 0; flex: none; }
.tabs-center .tab { flex: none; height: 48px; padding: 0 16px; }
.dlg-scroll { overflow-y: auto; max-height: 74vh; margin: 0 16px; padding: 16px; background: var(--card-inner); }
.ctab { display: block; }
.low-hr { border: 0; border-top: 1px solid var(--sep); margin: 18px 0; opacity: .8; }
.banner-warn { background: var(--warning); color: #000; padding: 10px 14px; border-radius: 4px; margin-bottom: 16px; }
.cfg-row { display: flex; align-items: center; gap: 12px; min-height: 40px; margin-bottom: 10px; }
.cfg-row.wrap { flex-wrap: wrap; }
.cfg-row.cfg-indent { padding-left: 24px; gap: 4px 24px; }
.cfg-label { font-weight: 500; color: var(--text); display: inline-flex; align-items: center; gap: 8px; }
.col-2 { flex: 0 0 120px; }
.col-3 { flex: 0 0 25%; min-width: 120px; }
.cfg-strong { font-weight: 700; }
.cfg-small { display: block; font-size: 12px; color: var(--text-dim); margin: 2px 0 6px; }
.cfg-mt { margin-top: 18px; display: flex; }
.check-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0 22px; }
.check-row .help { margin-left: -14px; }
.help { display: inline-grid; place-items: center; width: 22px; height: 22px; color: inherit; opacity: .67; cursor: help; position: relative; flex: none; font-size: 15px; }
.help:hover::after, .help:focus::after {
  content: attr(data-tip); position: absolute; left: 50%; top: calc(100% + 6px); transform: translateX(-50%);
  width: max-content; max-width: 320px; padding: 6px 10px; border-radius: 4px; background: #757575; color: #fff;
  font-size: 12px; font-weight: 400; line-height: 1.4; z-index: 5; text-align: left; white-space: normal;
}
.field-select, .field-input {
  height: 40px; padding: 0 12px; border: 0; border-bottom: 1px solid var(--field-line);
  border-radius: 4px 4px 0 0; background: var(--field-bg); outline: 0; min-width: 0;
}
.field-select { flex: 1; cursor: pointer; }
.field-select.narrow { flex: 0 0 110px; }
.narrow-200 { flex: 0 0 auto; max-width: 260px; }
.field-select option, .field-select optgroup { background: var(--menu-bg); color: var(--text-body); }
.field-input:focus, .field-select:focus { border-bottom: 2px solid var(--primary); }
.field-input:disabled { opacity: .5; }
.field-filled { background: var(--field-bg); }
textarea.field-input { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.field-error { color: var(--negative); font-size: 12px; margin-top: -8px !important; }
.standout { background: var(--card); box-shadow: var(--shadow-1); border: 0; border-radius: 4px; min-width: 0; }

input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 26px; background: transparent; margin: 0; cursor: pointer; }
input[type="range"]:disabled { opacity: .45; cursor: not-allowed; }
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(var(--primary), var(--primary)) 0 / var(--fill, 50%) 100% no-repeat, var(--track); }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 2px; background: var(--track); }
input[type="range"]::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--primary); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; margin-top: -5px; border-radius: 50%; background: var(--primary); border: 0; transition: transform .15s; }
input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--primary); border: 0; }
input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.3); }
.slider-wrap { position: relative; flex: 1; min-width: 0; }
.slider-wrap.labeled { padding-top: 4px; }
.slider-marks { position: relative; height: 18px; margin: 2px 7px 0; font-size: 12px; font-weight: 500; color: var(--text); }
.slider-marks span { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; }
.slider-label { position: absolute; top: -28px; transform: translateX(-50%); padding: 2px 8px; border-radius: 4px; background: var(--primary); color: #fff; font-size: 12px; pointer-events: none; opacity: 0; transition: opacity .15s; }
.slider-wrap:has(input:active) .slider-label, .slider-wrap:has(input:focus-visible) .slider-label { opacity: 1; }

.mode-switch { display: flex; align-items: flex-start; justify-content: center; gap: 22px; }
.mode-opt { display: flex; flex-direction: column; align-items: center; gap: 10px; font-weight: 500; color: var(--text); text-align: center; }
.mode-img { width: 50px; height: 50px; border-radius: 50%; border: 0; padding: 0; box-shadow: var(--shadow-1); background-size: cover; background-position: center; }
.mode-colors { background: radial-gradient(circle, #fff 0 13%, transparent 14%), conic-gradient(#5dade2 0 45deg, #82e0aa 0 90deg, #f7dc6f 0 135deg, #af7ac5 0 180deg, #5dade2 0 225deg, #82e0aa 0 270deg, #f7dc6f 0 315deg, #af7ac5 0); }
.switch { position: relative; display: inline-block; width: 36px; height: 20px; flex: none; }
.switch-fancy { margin-top: 15px; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 3px 0; border-radius: 7px; background: rgba(200, 55, 45, .45); transition: background .2s; }
.switch span::after { content: ''; position: absolute; left: -2px; top: -3px; width: 20px; height: 20px; border-radius: 50%; background: var(--primary); box-shadow: 0 1px 3px rgba(0, 0, 0, .4); transition: transform .2s; }
.switch input:checked + span::after { transform: translateX(20px); }
.mute-toggle .switch span { background: rgba(0, 0, 0, .3); }
.mute-toggle .switch input:checked + span { background: rgba(200, 55, 45, .45); }
.mute-toggle .switch span::after { background: #bdbdbd; }
.mute-toggle .switch input:checked + span::after { background: var(--primary); }
.switch input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 3px; }

.palette { display: flex; flex-wrap: wrap; gap: 14px 24px; margin-top: 14px; }
.pal-slot { display: flex; align-items: center; gap: 12px; }
.pal-slot > input[type="checkbox"] { width: 18px; height: 18px; margin: 0 0 0 8px; accent-color: var(--primary); cursor: pointer; }
.color-btn { position: relative; display: inline-grid; place-items: center; width: 48px; height: 28px; border-radius: 3px; background: #fff; color: #000; cursor: pointer; box-shadow: var(--shadow-1); flex: none; }
.color-btn.is-disabled { opacity: .5; cursor: not-allowed; }
.btn-img { padding: 4px 10px 4px 4px; min-height: 56px; gap: 12px; }
.avatar { width: 48px; height: 48px; display: inline-grid; place-items: center; border-radius: 3px; overflow: hidden; font-size: 18px; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.appearance-grid { display: flex; flex-wrap: wrap; column-gap: 24px; row-gap: 8px; }
.col-flex { display: flex; flex-direction: column; gap: 8px; }
.appearance-grid .field-select { max-width: 290px; flex: none; }
.appearance-grid .cfg-row { margin: 0; }

/* winner */
.dlg-winner { width: min(640px, calc(100vw - 32px)); }
.winner-head { padding: 16px; background: var(--primary); color: #fff; font-size: 1.25rem; line-height: 2rem; font-weight: 500; letter-spacing: .0125em; overflow-wrap: anywhere; }
.winner-body { padding: 16px; display: flex; flex-direction: column; gap: 16px; max-height: 60vh; overflow-y: auto; }
.winner-row { display: flex; gap: 16px; align-items: center; justify-content: center; flex-wrap: wrap; }
.winner-name { font-size: 3rem; line-height: 3.125rem; font-weight: 500; color: var(--text); text-align: center; overflow-wrap: anywhere; }
.winner-name a { color: var(--link); }
.winner-img { max-height: 200px; max-width: 100%; }

.winner-anim { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; background: rgba(0, 0, 0, .55); cursor: pointer; }
.wa-content { max-width: 92vw; text-align: center; }
.wa-text { margin: 0; color: #fff; font-family: Quicksand, sans-serif; font-weight: 400; font-size: clamp(48px, 11vw, 160px); line-height: 1.1; overflow-wrap: anywhere; text-shadow: 0 0 18px rgba(0, 0, 0, .6), 0 0 40px rgba(255, 255, 255, .25); }
.winner-anim.run { animation: wa-bg 6s ease forwards; }
.winner-anim.run .wa-text { animation: wa-in 1s cubic-bezier(.2, 1.6, .4, 1) both, wa-pulse 1.2s ease-in-out 1s 4 alternate, wa-out .6s ease 5.4s forwards; }
@keyframes wa-bg { 0% { background: rgba(0, 0, 0, 0); } 10%, 90% { background: rgba(0, 0, 0, .55); } 100% { background: rgba(0, 0, 0, 0); } }
@keyframes wa-in { from { transform: scale(.1) rotate(-12deg); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes wa-pulse { from { transform: scale(1); } to { transform: scale(1.08); } }
@keyframes wa-out { to { transform: scale(1.4); opacity: 0; } }

/* open / save */
.big-choice { display: flex; align-items: center; justify-content: center; gap: 18px; width: 100%; border: 0; border-radius: var(--radius); color: #fff; font-weight: 700; padding: 24px; text-align: center; }
.big-primary { flex-direction: column; background: var(--primary); }
.big-primary i { font-size: 8em; line-height: 1; }
.big-muted { background: var(--muted-choice); }
.big-muted i { font-size: 4em; }
.big-choice:hover { filter: brightness(1.08); }
.big-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.big-pair .big-primary i { font-size: 5em; }
.link-help { align-self: flex-start; display: inline-flex; align-items: center; gap: 8px; }
.saved-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; max-height: 60vh; overflow-y: auto; }
.saved-item { display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--sep); }
.saved-open { flex: 1; min-width: 0; display: flex; align-items: center; gap: 14px; padding: 8px 4px; border: 0; background: none; text-align: left; }
.saved-open:hover { background: var(--hover); }
.saved-open canvas { width: 50px; height: 50px; flex: none; border-radius: 50%; }
.saved-open .info { min-width: 0; display: flex; flex-direction: column; }
.saved-open b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.saved-open small { color: var(--text-dim); }
.empty-note { color: var(--text-dim); text-align: center; padding: 24px 0; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.input-suffix { display: flex; align-items: center; background: var(--field-bg); border-radius: 4px 4px 0 0; }
.input-suffix .field-input { flex: 1; background: none; }
.input-suffix span { padding: 0 12px; color: var(--text-dim); }

/* share */
.stepper { display: flex; align-items: center; gap: 12px; padding: 24px 24px 8px; }
.step { display: flex; align-items: center; gap: 8px; color: var(--text-dim); white-space: nowrap; }
.step-dot { width: 24px; height: 24px; border-radius: 50%; display: inline-grid; place-items: center; background: #9e9e9e; color: #fff; font-size: 11px; }
.step.is-active { color: var(--accent-text); }
.step.is-active .step-dot, .step.is-done .step-dot { background: var(--primary); }
.step-line { flex: 1; height: 1px; background: var(--sep); min-width: 12px; }
.share-body { padding: 16px 24px; }
.share-h { margin: 6px 0 0; font-size: 1.1rem; font-weight: 600; color: var(--text); }
.theme-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.theme-card { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px; border: 2px solid transparent; border-radius: 6px; background: var(--hover); }
.theme-card canvas { width: 50%; height: auto; aspect-ratio: 1; }
.theme-card.is-selected { border-color: var(--primary); }
.copy-row { display: flex; gap: 8px; flex-wrap: wrap; }
.copy-row .field-input { flex: 1; min-width: 220px; }
.share-extra { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.share-side { flex: 1; min-width: 200px; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.qr-box { flex: none; width: 176px; height: 176px; padding: 8px; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-1); }
.qr-box svg, .qr-box img { display: block; width: 100%; height: 100%; }

/* confirm */
.confirm-body { flex-direction: row; align-items: center; gap: 16px; }
.confirm-icon { font-size: 60px; color: var(--warning); flex: none; }

/* advanced dialog */
.adv-nav { display: flex; align-items: center; gap: 12px; }
.form-grid { display: grid; grid-template-columns: minmax(90px, 25%) 1fr; gap: 14px 12px; align-items: center; margin-top: 14px; }
.adv-color-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.adv-img-box { display: flex; align-items: center; }
.adv-img-preview { position: relative; display: inline-block; }
.adv-img-preview img { max-height: 10em; max-width: 160px; border-radius: 4px; display: block; }
.btn-negative-flat { color: var(--negative); background: none; box-shadow: none; }
.input-steps { display: inline-flex; align-items: center; background: var(--field-bg); border-radius: 4px; }
.input-steps input { width: 90px; text-align: center; background: none; -moz-appearance: textfield; }
.input-steps input::-webkit-inner-spin-button { display: none; }
.input-steps button { width: 32px; height: 32px; border: 0; border-radius: 50%; background: none; color: var(--text-dim); }
.input-steps button:hover { background: var(--hover); }

/* pictures, gallery, language */
.picture-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
.picture-card, .gallery-card { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 10px; border: 1px solid var(--sep); border-radius: 6px; background: none; text-align: center; cursor: pointer; }
.picture-card img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 50%; }
.picture-card:hover, .gallery-card:hover { border-color: var(--primary); background: var(--hover); }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.gallery-card b { color: var(--text); font-weight: 500; }
.gallery-card small { color: var(--text-dim); font-size: 12px; }
.gallery-card canvas { width: 140px; height: 140px; border-radius: 50%; }
.gallery-card .btn { margin-top: auto; }
.lang-row { display: flex; flex-wrap: wrap; gap: 8px; }
.lang-list { display: flex; flex-direction: column; max-height: 40vh; overflow-y: auto; }
.language { border: 0; background: none; padding: 8px 12px; border-radius: 4px; text-align: left; color: var(--text-body); }
.lang-row .language { background: var(--secondary-bg); color: var(--secondary-fg); }
.language:hover { background: var(--hover); }
.language.is-current { font-weight: 700; }

/* fairness */
.fair-summary { padding: 10px 12px; border-radius: 4px; font-weight: 500; }
.fair-summary.pass { background: rgba(65, 132, 74, .15); color: #3d8b47; }
.fair-summary.warn { background: rgba(247, 220, 111, .3); color: #8a6d00; }
:root[data-theme="dark"] .fair-summary.pass { color: #7fd18a; }
:root[data-theme="dark"] .fair-summary.warn { color: var(--warning); }
.table-wrap { overflow-x: auto; max-height: 50vh; }
.fair-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.fair-table th, .fair-table td { text-align: left; padding: 5px 8px; border-bottom: 1px solid var(--sep); white-space: nowrap; }
.fair-table th:not(:first-child), .fair-table td:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; vertical-align: 0; }

/* teams */
.team-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.seg-opt { position: relative; cursor: pointer; }
.seg-opt input { position: absolute; opacity: 0; pointer-events: none; }
.seg-opt span { display: block; padding: 7px 14px; font-weight: 500; white-space: nowrap; }
.seg-opt + .seg-opt span { border-left: 1px solid var(--border); }
.seg-opt input:checked + span { background: var(--primary); color: #fff; }
.seg-opt input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: -2px; }
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.team-card { border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow-1); overflow: hidden; }
.team-card header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; background: var(--c, #ccc); color: var(--fg, #000); }
.team-card header span { font-size: 12px; opacity: .85; }
.team-card ul { margin: 0; padding: 8px 12px 10px 30px; }
.team-card li { color: var(--text); overflow-wrap: anywhere; }
.team-card li img { height: 20px; width: auto; vertical-align: middle; margin-right: 4px; border-radius: 2px; }

/* shortcuts */
.keys { display: grid; grid-template-columns: max-content 1fr; gap: 10px 18px; margin: 0; align-items: center; }
.keys dt { white-space: nowrap; }
.keys dd { margin: 0; }

/* toasts */
.toasts { position: fixed; inset: auto 0 12px 0; width: auto; height: auto; margin: 0; border: 0; background: transparent; overflow: visible; z-index: 2147483000; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 12px; }
.toasts:popover-open { display: flex; }
.toasts.top { inset: 12px 0 auto 0; flex-direction: column-reverse; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 8px; max-width: min(100%, 640px);
  min-height: 48px; padding: 6px 8px 6px 16px; border-radius: var(--radius); background: #323232; color: #fff; box-shadow: var(--shadow-menu);
  opacity: 0; transform: translateY(12px); transition: opacity .2s, transform .2s;
}
.toasts.top .toast { transform: translateY(-12px); }
.toast.show { opacity: 1; transform: none; }
.toast-msg { flex: 1; padding: 6px 0; }
.toast-act { border: 0; background: none; color: #fff; font-weight: 700; padding: 6px 10px; border-radius: 4px; }
.toast-act.is-primary { background: var(--primary); }
.toast-act:hover { filter: brightness(1.15); }
.toast-x { border: 0; background: none; color: #fff; width: 32px; height: 32px; border-radius: 50%; }
.toast-x:hover { background: rgba(255, 255, 255, .12); }
.fx-layer { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 100; }

/* fullscreen keeps only Open, Fullscreen and the menu */
body.is-fullscreen .js-hide-fs { display: none !important; }
body.is-fullscreen .below, body.is-fullscreen .left-col, body.is-fullscreen .editor-toggle { display: none !important; }
body.multi .js-single { display: none !important; }
body.is-busy .center-col canvas { cursor: default; }

/* ---------- Responsive ---------- */
@media (max-width: 1400px) {
  .brand-tag { display: none; }
}
@media (max-width: 1260px) {
  .tb-nav { display: none; }
  .topbar .tb-burger-wrap { display: flex; }
}
@media (max-width: 900px) {
  .steps { grid-template-columns: 1fr; }
}
@media (max-width: 599px) {
  .brand-name { font-size: 1.35em; }
  .cfg-row { flex-wrap: wrap; }
  .col-2, .col-3 { flex-basis: 100%; }
  .dlg-scroll { margin: 0; padding: 12px; }
  .tabs-center .tab { padding: 0 10px; font-size: 13px; }
  .stepper { padding: 16px 16px 4px; gap: 6px; }
  .stepper .step span:last-child { display: none; }
  .big-pair { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .theme-cards { grid-template-columns: 1fr 1fr; }
  .toasts { bottom: auto; top: 8px; }
  .footer { flex-direction: column; align-items: flex-start; }
  .qr-box { width: 150px; height: 150px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .dlg[open] { animation: none; }
  .topbar { transition: none; }
}
