:root {
  --blue: #2563eb;
  --blue-b: #3b82f6;
  --violet: #7c3aed;
  --violet-b: #8b5cf6;
  --green: #16a34a;
  --green-b: #22c55e;
  --red: #dc2626;
  --red-b: #ef4444;
  --row-ok-bg: rgba(34, 197, 94, 0.13);
  --row-mid-bg: rgba(251, 146, 60, 0.15);
  --row-err-bg: rgba(248, 113, 113, 0.15);
  --ease-smooth: cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #ffffff;
  --bar-bg: rgba(255, 255, 255, 0.88);
  --group-bg: rgba(244, 244, 245, 0.9);
  --ctrl-bg: #f4f4f5;
  --ctrl-hover: #e4e4e7;
  --ctrl-text: #09090b;
  --surface-text: #09090b;
  --surface-muted: #52525b;
  --surface-border: #d4d4d8;
  --text: #09090b;
  --text-muted: #71717a;
  --border: #d4d4d8;
  --row-border: rgba(0, 0, 0, 0.06);
  --btn-border: #a1a1aa;
  --pop-bg: #ffffff;
  --score: #16a34a;
  --row-ok-bg: rgba(34, 197, 94, 0.12);
  --row-mid-bg: rgba(249, 115, 22, 0.13);
  --row-err-bg: rgba(239, 68, 68, 0.12);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #202124;
  --bar-bg: rgba(32, 33, 36, 0.86);
  --group-bg: rgba(41, 42, 45, 0.82);
  --ctrl-bg: #292a2d;
  --ctrl-hover: #3c4043;
  --ctrl-text: #e8eaed;
  --surface-text: #e8eaed;
  --surface-muted: #9aa0a6;
  --surface-border: #3c4043;
  --text: #e8eaed;
  --text-muted: #9aa0a6;
  --border: #3c4043;
  --row-border: rgba(255, 255, 255, 0.06);
  --btn-border: #5f6368;
  --pop-bg: #292a2d;
  --score: #4ade80;
}

[data-theme="onyx"] {
  color-scheme: dark;
  --bg: #000000;
  --bar-bg: rgba(0, 0, 0, 0.85);
  --group-bg: rgba(17, 18, 20, 0.85);
  --ctrl-bg: #111214;
  --ctrl-hover: #1e1f22;
  --ctrl-text: #ffffff;
  --surface-text: #ffffff;
  --surface-muted: #a1a1aa;
  --surface-border: #232428;
  --text: #ffffff;
  --text-muted: #80848e;
  --border: #232428;
  --row-border: rgba(255, 255, 255, 0.07);
  --btn-border: #3f4147;
  --pop-bg: #111214;
  --score: #4ade80;
}

[data-theme="pastel"] {
  color-scheme: light;
  --bg: #f6ebe6;
  --bar-bg: rgba(246, 235, 230, 0.88);
  --group-bg: rgba(238, 223, 217, 0.9);
  --ctrl-bg: #efe0da;
  --ctrl-hover: #e4cfc7;
  --ctrl-text: #1f1715;
  --surface-text: #1f1715;
  --surface-muted: #66534e;
  --surface-border: #d6bfb6;
  --text: #1f1715;
  --text-muted: #6e5b56;
  --border: #d6bfb6;
  --row-border: rgba(31, 23, 21, 0.08);
  --btn-border: #a68c83;
  --pop-bg: #faf3f0;
  --score: #15803d;
  --row-ok-bg: rgba(34, 197, 94, 0.14);
  --row-mid-bg: rgba(249, 115, 22, 0.15);
  --row-err-bg: rgba(239, 68, 68, 0.14);
}

[data-theme="midnight"] {
  color-scheme: dark;
  --bg: rgb(20, 40, 90);
  --bar-bg: rgba(20, 40, 90, 0.86);
  --group-bg: rgba(14, 29, 68, 0.85);
  --ctrl-bg: #1b3575;
  --ctrl-hover: #254696;
  --ctrl-text: #ffffff;
  --surface-text: #ffffff;
  --surface-muted: #b8c7eb;
  --surface-border: #2e4e9e;
  --text: #ffffff;
  --text-muted: #b8c7eb;
  --border: #2e4e9e;
  --row-border: rgba(255, 255, 255, 0.1);
  --btn-border: #5979c7;
  --pop-bg: #162d66;
  --score: #4ade80;
}

* { box-sizing: border-box; }

html, body {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
html::-webkit-scrollbar, body::-webkit-scrollbar {
  display: none;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  margin: 0;
  padding: 0 14px 68px;
  font-size: 14px;
  transition: color 0.25s ease, opacity 0.22s var(--ease-smooth);
  user-select: none;
  cursor: grab;
}
body.grabbing, body.grabbing * {
  cursor: grabbing !important;
}

@keyframes pageFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
body.page-enter {
  animation: pageFadeIn 0.28s var(--ease-smooth) both;
}
body.page-leave {
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
}

.wrap {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
}

.bar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bar-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 8px 0;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
  cursor: default;
  transition: padding 0.28s var(--ease-smooth), border-color 0.25s ease;
}

.bar-shell {
  width: 100%;
  display: flex;
  flex-direction: column;
}

.bar-top-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 30px;
  cursor: pointer;
}

.bar-nav-left, .bar-nav-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.hamburger-btn {
  width: 29px;
  height: 29px;
  padding: 0;
  border-radius: 7px;
  border: 1px solid var(--surface-border);
  background: var(--ctrl-bg);
  color: var(--ctrl-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.14s var(--ease-smooth);
}
.hamburger-btn:hover { background: var(--ctrl-hover); }
.hamburger-btn:active { transform: scale(0.94); }
.hb-line {
  transition: transform 0.28s var(--ease-smooth), opacity 0.2s ease;
  transform-origin: 8px 8px;
}
.bar.collapsed .hb-top { transform: translateY(0.6px) scaleX(0.85); }
.bar.collapsed .hb-bot { transform: translateY(-0.6px) scaleX(0.85); }

.collapsed-hud {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity 0.24s var(--ease-smooth), transform 0.24s var(--ease-smooth), visibility 0.24s;
}
.bar.collapsed .collapsed-hud {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.collapsed-timer-group {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 2px 6px;
  border-radius: 8px;
  background: var(--group-bg);
  border: 1px solid var(--surface-border);
}
.collapsed-timer-group.visible { display: inline-flex; }

#miniTimerDisplay {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 13.5px;
  min-width: 44px;
  text-align: center;
  color: var(--surface-text);
}
#miniTimerDisplay.ended { color: var(--red-b); }

.collapsed-score-pill {
  display: none;
  font-weight: 700;
  font-size: 13px;
  color: var(--score);
  font-variant-numeric: tabular-nums;
  padding: 4px 9px;
  border-radius: 7px;
  background: var(--group-bg);
  border: 1px solid var(--surface-border);
}
.collapsed-score-pill.visible { display: inline-flex; }

.demo-step-bar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
  padding: 8px 11px;
  border-radius: 10px;
  background: rgba(37, 99, 235, 0.13);
  border: 1px solid rgba(59, 130, 246, 0.55);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.12);
  transition: all 0.22s ease;
}

.demo-prev-btn {
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 8px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--ctrl-bg);
  border: 1px solid var(--surface-border);
  color: var(--surface-text);
}
.demo-prev-btn:disabled {
  opacity: 0.32;
  cursor: not-allowed;
  transform: none;
}

.demo-step-content {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 9px;
}

.demo-step-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 99px;
  background: #2563eb;
  color: #ffffff;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.demo-step-text {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.38;
  color: var(--surface-text);
  word-break: break-word;
}

.demo-exit-mini {
  height: 28px;
  padding: 0 10px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
  background: var(--ctrl-bg);
  border: 1px solid var(--surface-border);
  color: var(--surface-text);
}

.bar-collapsible {
  display: grid;
  grid-template-rows: 1fr;
  opacity: 1;
  margin-top: 8px;
  transition:
    grid-template-rows 0.34s var(--ease-smooth),
    opacity 0.24s var(--ease-smooth),
    margin-top 0.34s var(--ease-smooth);
}
.bar-collapsible-inner {
  overflow: hidden;
  min-height: 0;
}
.bar.collapsed .bar-collapsible {
  grid-template-rows: 0fr;
  opacity: 0;
  margin-top: 0;
  pointer-events: none;
}

.no-anim, .no-anim * {
  transition: none !important;
}

.bar-inner {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
}

.group {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
  padding: 5px 8px;
  border: 1px solid var(--surface-border);
  border-radius: 9px;
  background: var(--group-bg);
  color: var(--surface-text);
}

.group > button:not(.icon-btn),
.group > select,
.group > .field,
.group > .timer-controls,
.group > .score-box {
  flex: 1 1 auto;
  justify-content: center;
  min-width: 0;
}

.group > .score-box {
  justify-content: space-between;
}

.group-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--surface-muted);
  padding-right: 5px;
  border-right: 1px solid var(--surface-border);
  margin-right: 1px;
  flex-shrink: 0;
}

label.field {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--surface-muted);
  font-size: 12.5px;
  font-weight: 500;
  cursor: default;
}

input[type="number"], input[type="text"], input[type="email"], input[type="password"], button, select, .nav-link-btn {
  height: 29px;
  background: var(--ctrl-bg);
  color: var(--ctrl-text);
  border: 1px solid var(--surface-border);
  padding: 0 9px;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition:
    background-color 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease,
    transform 0.12s var(--ease-smooth),
    opacity 0.2s ease;
}

input[type="number"], input[type="text"], input[type="email"], input[type="password"] { cursor: text; }

select option { background: var(--ctrl-bg); color: var(--ctrl-text); }
input:focus, select:focus { outline: none; border-color: var(--blue-b); }
button, select, .nav-link-btn { cursor: pointer; font-weight: 600; }
button:hover:not(:disabled), select:hover:not(:disabled), .nav-link-btn:hover { background: var(--ctrl-hover); }
button:active:not(:disabled), .nav-link-btn:active { transform: scale(0.96); }

button.active {
  background: var(--blue) !important;
  border-color: var(--blue-b) !important;
  color: #ffffff !important;
}

button.active-violet {
  background: var(--violet) !important;
  border-color: var(--violet-b) !important;
  color: #ffffff !important;
}

button.danger-confirm {
  background: var(--red) !important;
  border-color: var(--red-b) !important;
  color: #ffffff !important;
}

.icon-btn { width: 29px; padding: 0; flex: 0 0 29px; }

.timer-check {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--surface-text);
  flex-shrink: 0;
}
.timer-check input[type="checkbox"] {
  width: 15px;
  height: 15px;
  margin: 0;
  cursor: pointer;
  accent-color: var(--blue);
}

.timer-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  transition: opacity 0.2s ease;
}
.timer-controls > button:not(.icon-btn),
.timer-controls > select {
  flex: 1 1 auto;
  justify-content: center;
}
.timer-controls.disabled {
  opacity: 0.38;
  pointer-events: none;
}

#timerDisplay {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 13.5px;
  min-width: 46px;
  text-align: center;
  color: var(--surface-text);
  flex-shrink: 0;
}
#timerDisplay.ended { color: var(--red-b); }

.score-box {
  display: none;
  align-items: center;
  gap: 5px;
  padding-left: 6px;
  border-left: 1px solid var(--surface-border);
}
.score-box.visible { display: inline-flex; }
#score {
  font-weight: 700;
  font-size: 13.5px;
  color: var(--score);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

@keyframes demoContourPulse {
  0%, 100% {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2.5px rgba(59, 130, 246, 0.55), 0 0 16px rgba(59, 130, 246, 0.28);
  }
  50% {
    border-color: var(--surface-border);
    box-shadow: 0 0 0 0px rgba(59, 130, 246, 0);
  }
}

.group.demo-contour-blink {
  animation: demoContourPulse 1.2s ease-in-out infinite !important;
}

.row.demo-row-blink {
  border-radius: 10px;
  outline: 1.5px solid #3b82f6;
  animation: demoContourPulse 1.35s ease-in-out infinite !important;
}

.demo-exit-mini.demo-btn-blink {
  animation: demoContourPulse 1.25s ease-in-out infinite !important;
}

.demo-banner {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  margin-bottom: 0;
  pointer-events: none;
  transition:
    grid-template-rows 0.36s var(--ease-smooth),
    opacity 0.26s var(--ease-smooth),
    margin-bottom 0.36s var(--ease-smooth);
}
.demo-banner.open {
  grid-template-rows: 1fr;
  opacity: 1;
  margin-bottom: 10px;
  pointer-events: auto;
}
.demo-banner-inner {
  overflow: hidden;
  min-height: 0;
  background: var(--group-bg);
  border: 1px solid var(--surface-border);
  border-radius: 11px;
  padding: 0 12px;
  transition: padding 0.36s var(--ease-smooth);
}
.demo-banner.open .demo-banner-inner { padding: 12px; }

.demo-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--surface-border);
}
.demo-title-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.demo-badge {
  background: var(--blue);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 99px;
}
.demo-subtitle {
  font-size: 12.5px;
  color: var(--surface-muted);
}
.demo-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.demo-questions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
  gap: 10px;
}
.demo-q-card {
  background: var(--ctrl-bg);
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  padding: 9px 10px;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--surface-text);
  user-select: text;
  cursor: default;
}
.demo-q-title {
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--surface-text);
}
.demo-q-items {
  color: var(--surface-muted);
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.demo-corrige-card {
  border-color: #2563eb !important;
  background: rgba(37, 99, 235, 0.08) !important;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.demo-corrige-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 8px 0 10px;
}
.demo-corrige-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 9px;
  border-radius: 7px;
  background: var(--ctrl-bg);
  border: 1px solid var(--surface-border);
  font-size: 12.5px;
  font-weight: 700;
}
.demo-corrige-letters {
  color: #22c55e;
  letter-spacing: 0.08em;
}
.demo-support-hint {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--surface-muted);
}

#grid {
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: opacity 0.3s ease, filter 0.3s ease;
}
#grid.paused {
  opacity: 0.26;
  filter: grayscale(1);
  pointer-events: none;
}

.row {
  display: flex;
  align-items: center;
  gap: clamp(5px, 1.2vw, 10px);
  padding: 5px 6px;
  border-radius: 8px;
  border-bottom: 1px solid var(--row-border);
  width: 100%;
  transition: background-color 0.22s ease, opacity 0.25s ease, filter 0.25s ease;
}

.row.bg-ok { background-color: var(--row-ok-bg); }
.row.bg-mid { background-color: var(--row-mid-bg); }
.row.bg-err { background-color: var(--row-err-bg); }
.row.ans-skipped { background-color: rgba(128, 128, 128, 0.08); }
.row.corr-dimmed { opacity: 0.26; filter: grayscale(1); }
.row.corr-perfect .btn { visibility: hidden; pointer-events: none; }
.row.corr-failed { cursor: pointer; }
.row.corr-failed .btn { pointer-events: none; }
.row.corr-focused { background-color: rgba(128, 128, 128, 0.08); }

.num {
  width: 28px;
  flex-shrink: 0;
  text-align: right;
  padding-right: 4px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 13px;
}

.btn {
  flex: 1 1 0;
  min-width: 32px;
  height: clamp(32px, 4.2vw, 38px);
  padding: 0;
  border-radius: 8px;
  border: 1.5px solid var(--btn-border);
  background: transparent;
  color: var(--text);
  font-weight: 600;
  font-size: 13.5px;
  transition:
    background-color 0.2s cubic-bezier(0.4, 0, 0.2, 1),
    border-color 0.2s ease,
    color 0.15s ease,
    transform 0.08s ease;
}

.btn:hover { border-color: var(--text-muted); background: rgba(128, 128, 128, 0.12); }
.btn:active { transform: scale(0.97); }
.btn.sel { background: var(--blue); border-color: var(--blue-b); color: #ffffff; }
.btn.sel:hover { background: #1d4ed8; }
.btn.ok { background: var(--green) !important; border-color: var(--green-b) !important; color: #ffffff !important; }
.btn.err { background: var(--red) !important; border-color: var(--red-b) !important; color: #ffffff !important; }
.btn.miss { border: 2px dashed var(--green-b); color: var(--text); }

.popover {
  position: fixed;
  top: 96px;
  right: 16px;
  z-index: 30;
  background: var(--pop-bg);
  color: var(--surface-text);
  border: 1px solid var(--surface-border);
  border-radius: 12px;
  padding: 14px;
  width: 265px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  gap: 11px;
  cursor: default;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-10px) scale(0.97);
  transform-origin: top right;
  transition:
    opacity 0.22s var(--ease-smooth),
    transform 0.24s var(--ease-smooth),
    visibility 0.22s;
}
.popover.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.pop-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pop-actions { display: inline-flex; align-items: center; gap: 6px; }
.pop-title { font-weight: 700; font-size: 13px; color: var(--surface-text); }
.pop-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--surface-text); }

input[type="color"] {
  -webkit-appearance: none;
  appearance: none;
  width: 34px;
  height: 27px;
  padding: 0;
  border: 1px solid var(--surface-border);
  border-radius: 7px;
  background: var(--ctrl-bg);
  overflow: hidden;
  cursor: pointer;
}
input[type="color"]::-webkit-color-swatch-wrapper { padding: 2px; }
input[type="color"]::-webkit-color-swatch { border: none; border-radius: 5px; }

.pop-row input[type="number"] { height: 27px; font-size: 12.5px; width: 72px; }

.compass-wrap { display: inline-flex; align-items: center; gap: 8px; }
.compass-deg {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--surface-muted);
  min-width: 34px;
  text-align: right;
}
#compassSvg {
  width: 68px;
  height: 68px;
  cursor: grab;
  touch-action: none;
  display: block;
}
#compassSvg:active { cursor: grabbing; }

.calc-pop { width: 268px; }
.calc-screen {
  background: var(--ctrl-bg);
  border: 1px solid var(--surface-border);
  border-radius: 9px;
  padding: 8px 11px;
  text-align: right;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 58px;
  overflow: hidden;
}
.calc-expr {
  font-size: 11.5px;
  color: var(--surface-muted);
  min-height: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}
.calc-val {
  font-size: 21px;
  font-weight: 700;
  color: var(--surface-text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}
.calc-val::-webkit-scrollbar { display: none; }

.calc-keys {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.calc-key {
  height: 36px;
  border-radius: 8px;
  font-size: 14.5px;
  font-weight: 600;
  background: var(--ctrl-bg);
  color: var(--ctrl-text);
  border: 1px solid var(--surface-border);
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.1s var(--ease-smooth);
}
.calc-key:hover { background: var(--ctrl-hover); }
.calc-key:active { transform: scale(0.92); }
.calc-key.calc-fn { color: var(--surface-muted); font-size: 13px; }
.calc-key.calc-op { color: var(--blue-b); font-size: 16px; }
.calc-key.calc-eq { background: var(--blue); border-color: var(--blue-b); color: #ffffff; font-size: 16px; }
.calc-key.calc-eq:hover { background: #1d4ed8; }

#notesPop {
  left: 14px;
  right: 14px;
  width: auto;
  max-height: calc(100vh - 110px);
  transform-origin: top center;
}
.note-mini-btn { height: 24px; font-size: 11.5px; padding: 0 9px; }
#notesArea {
  width: 100%;
  height: 150px;
  max-height: calc(100vh - 170px);
  resize: vertical;
  background: var(--ctrl-bg);
  color: var(--ctrl-text);
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.45;
  user-select: text;
  cursor: text;
}
#notesArea:focus { outline: none; border-color: var(--blue-b); }

.bottom-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 20;
  background: var(--bar-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  padding: 8px 14px;
  display: flex;
  justify-content: center;
  cursor: default;
  opacity: 0;
  visibility: hidden;
  transform: translateY(100%);
  transition: opacity 0.25s var(--ease-smooth), transform 0.28s var(--ease-smooth), visibility 0.25s;
}
.bottom-bar.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.bottom-inner {
  width: 100%;
  max-width: 1120px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.bottom-hint {
  font-size: 12.5px;
  color: var(--surface-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-card {
  width: 100%;
  max-width: 370px;
  background: var(--pop-bg);
  color: var(--surface-text);
  border: 1px solid var(--surface-border);
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.avatar-btn {
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--surface-border);
  background: var(--ctrl-bg);
  color: var(--surface-muted);
  font-size: 13px;
  font-weight: 800;
  flex-shrink: 0;
  overflow: hidden;
}
.avatar-btn.logged-in {
  background: #2563eb !important;
  border-color: #3b82f6 !important;
  color: #ffffff !important;
}

.short-txt { display: none; }

@media (max-width: 1060px) {
  .group-title { display: none; }
}

@media (max-width: 720px) {
  .full-txt { display: none; }
  .short-txt { display: inline; }
  .group { padding: 4px 6px; gap: 5px; }
  input[type="number"], input[type="text"], button, select, .nav-link-btn { padding: 0 7px; font-size: 12.5px; }
  .popover { top: 88px; }
  .demo-step-bar { padding: 7px 9px; gap: 8px; }
  .demo-step-text { font-size: 12.2px; }
}