:root {
  color-scheme: dark;
  --bg: #08100c;
  --panel: rgba(10, 18, 14, 0.9);
  --card: rgba(16, 28, 21, 0.88);
  --text-main: #f2f8f3;
  --text-dim: #94a59a;
  --accent: #9af7c2;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.38);
  --font-ui: "Bahnschrift", "Eurostile", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top right, rgba(154, 247, 194, 0.12), transparent 25%),
    linear-gradient(165deg, #0c1712, var(--bg));
  color: var(--text-main);
  font-family: var(--font-ui);
}

body {
  padding: 24px;
}

button,
input {
  font: inherit;
}

select {
  font: inherit;
}

.page-shell {
  min-height: calc(100vh - 48px);
  display: grid;
  grid-template-columns: 408px minmax(0, 1fr);
  gap: 22px;
}

.side-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding-right: 4px;
}

.hero,
.card {
  padding: 22px;
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(18, 31, 23, 0.96), rgba(8, 15, 11, 0.96));
  border: 1px solid rgba(154, 247, 194, 0.12);
  box-shadow: var(--shadow);
}

.card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.compact-card {
  margin-top: auto;
}

.canvas-stage {
  min-height: 720px;
}

.canvas-frame {
  position: relative;
  height: 100%;
  min-height: 720px;
  border-radius: 30px;
  overflow: hidden;
  background:
    linear-gradient(rgba(154, 247, 194, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(154, 247, 194, 0.07) 1px, transparent 1px),
    linear-gradient(180deg, rgba(12, 22, 17, 0.68), rgba(6, 12, 9, 0.4));
  background-size: 28px 28px, 28px 28px, auto;
  border: 1px solid rgba(154, 247, 194, 0.18);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

.canvas-brand {
  position: absolute;
  inset: 14% 14%;
  z-index: 2;
  background: url("/livetac-logo.png") center / contain no-repeat;
  opacity: 0.1;
  filter: saturate(0.9);
  pointer-events: none;
  transition:
    inset 160ms ease,
    width 160ms ease,
    height 160ms ease,
    opacity 160ms ease,
    transform 160ms ease;
}

.canvas-frame.has-map .canvas-brand {
  inset: auto 18px 18px auto;
  width: 110px;
  height: 110px;
  opacity: 0.22;
  transform: none;
}

#drawCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  cursor: default;
}

#drawCanvas.is-panning {
  cursor: default;
}

.canvas-hud {
  position: absolute;
  top: 18px;
  left: 18px;
  right: 18px;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(9, 15, 12, 0.55);
  border: 1px solid rgba(154, 247, 194, 0.16);
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 12px;
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-dim);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 34px;
  letter-spacing: 0.05em;
}

h2 {
  font-size: 16px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.intro,
.fine-print,
.status-text {
  color: var(--text-dim);
  line-height: 1.5;
}

.card-header,
.button-row,
.inline-row,
.meta-row,
.palette-grid,
.map-row,
.tool-grid,
.brush-row {
  display: flex;
  gap: 10px;
}

.card-header {
  justify-content: space-between;
  align-items: center;
}

.button-row,
.inline-row,
.palette-grid,
.map-row,
.tool-grid,
.brush-row {
  align-items: stretch;
}

.meta-row {
  justify-content: space-between;
  flex-wrap: wrap;
}

.meta-row > div {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 120px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.field.grow {
  flex: 1;
}

.field-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field-label {
  color: var(--text-dim);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.field span,
.meta-label {
  color: var(--text-dim);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

input[type="text"],
input[type="password"] {
  width: 100%;
  border: 1px solid rgba(154, 247, 194, 0.16);
  background: rgba(8, 17, 13, 0.86);
  color: var(--text-main);
  border-radius: 12px;
  padding: 12px 14px;
  outline: none;
}

.linkcode-row {
  flex-wrap: wrap;
  gap: 12px;
}

.linkcode-row .field.grow {
  flex: 1 1 100%;
}

.linkcode-row > button {
  flex: 1 1 160px;
}

.linkcode-input {
  min-width: 12ch;
  font-family: Consolas, "Cascadia Mono", monospace;
}

.secret-input-group {
  position: relative;
  display: flex;
}

.secret-input-group input {
  padding-right: 56px;
}

.eye-toggle-button {
  position: absolute;
  right: 8px;
  bottom: 7px;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid rgba(154, 247, 194, 0.14);
  border-radius: 10px;
  background: rgba(11, 23, 17, 0.96);
  color: var(--text-dim);
  transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
}

.eye-toggle-button:hover,
.eye-toggle-button:focus-visible {
  border-color: rgba(154, 247, 194, 0.35);
  color: var(--text-main);
  background: rgba(16, 31, 23, 0.98);
}

.eye-toggle-button:focus-visible {
  outline: none;
}

.eye-icon {
  width: 18px;
  height: 18px;
}

.eye-icon-off,
.eye-toggle-button.visible .eye-icon-open {
  display: none;
}

.eye-toggle-button.visible .eye-icon-off {
  display: block;
}

input[type="text"]:focus,
input[type="password"]:focus {
  border-color: rgba(154, 247, 194, 0.48);
  box-shadow: 0 0 0 4px rgba(154, 247, 194, 0.08);
}

input[type="color"] {
  width: 100%;
  height: 46px;
  border: 1px solid rgba(154, 247, 194, 0.18);
  background: rgba(8, 17, 13, 0.86);
  border-radius: 12px;
  padding: 4px;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

select {
  width: 100%;
  border: 1px solid rgba(154, 247, 194, 0.16);
  background: rgba(8, 17, 13, 0.86);
  color: var(--text-main);
  border-radius: 12px;
  padding: 12px 14px;
  outline: none;
}

select:focus {
  border-color: rgba(154, 247, 194, 0.48);
  box-shadow: 0 0 0 4px rgba(154, 247, 194, 0.08);
}

button {
  border: 0;
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease;
}

button:hover {
  transform: translateY(-1px);
}

.primary-button {
  flex: 1;
  background: linear-gradient(135deg, var(--accent), #72c89b);
  color: #07130d;
  font-weight: 700;
}

.secondary-button {
  background: rgba(33, 59, 46, 0.86);
  color: var(--text-main);
  border: 1px solid rgba(154, 247, 194, 0.16);
}

.ghost-button,
.tool-button {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
  border: 1px solid rgba(154, 247, 194, 0.12);
}

.tool-button {
  flex: 1;
}

.tool-button.active {
  background: rgba(154, 247, 194, 0.14);
  border-color: rgba(154, 247, 194, 0.3);
}

.palette-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.marker-palette {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.icon-picker-groups {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.icon-picker {
  border-radius: 16px;
  border: 1px solid rgba(154, 247, 194, 0.12);
  background: rgba(255, 255, 255, 0.03);
  overflow: hidden;
}

.icon-picker[open] {
  border-color: rgba(154, 247, 194, 0.24);
  background: rgba(154, 247, 194, 0.04);
}

.icon-picker-summary {
  list-style: none;
  cursor: pointer;
  padding: 10px 12px;
}

.icon-picker-summary::-webkit-details-marker {
  display: none;
}

.icon-picker-summary-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.icon-picker-summary-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.icon-picker-summary-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.icon-picker-category {
  color: var(--text-dim);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.icon-picker-selected {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.icon-picker-arrow {
  color: var(--text-dim);
  font-size: 12px;
}

.icon-preview {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.icon-picker-menu {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 0 12px 12px;
}

.icon-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 92px;
  padding: 10px 8px;
  text-align: center;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
  border: 1px solid rgba(154, 247, 194, 0.12);
}

.icon-option span {
  font-size: 11px;
  line-height: 1.25;
}

.icon-option.active {
  background: rgba(154, 247, 194, 0.14);
  border-color: rgba(154, 247, 194, 0.34);
}

.color-swatch {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
  border: 1px solid rgba(154, 247, 194, 0.12);
}

.color-swatch.active {
  border-color: rgba(154, 247, 194, 0.46);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.08);
}

.tool-button.warning {
  color: #ffe4de;
  border-color: rgba(255, 108, 88, 0.24);
}

.compact {
  white-space: nowrap;
}

.status-pill,
.mode-badge {
  padding: 8px 10px;
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.status-pill.offline {
  background: rgba(255, 108, 88, 0.14);
  color: #ffc0b8;
}

.status-pill.connecting {
  background: rgba(255, 198, 92, 0.14);
  color: #ffe0a0;
}

.status-pill.online,
.mode-badge {
  background: rgba(154, 247, 194, 0.14);
  color: var(--accent);
}

.size-pill {
  min-width: 84px;
  border-radius: 18px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(154, 247, 194, 0.12);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}

.size-pill span {
  color: var(--text-dim);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

code {
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(154, 247, 194, 0.08);
  color: var(--accent);
}

@media (max-width: 1080px) {
  .page-shell {
    grid-template-columns: 1fr;
  }

  .canvas-stage,
  .canvas-frame {
    min-height: 480px;
  }
}

@media (max-width: 720px) {
  .map-row,
  .tool-grid,
  .brush-row,
  .button-row {
    flex-direction: column;
  }

  .icon-picker-menu {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  body {
    padding: 14px;
  }

  .button-row,
  .inline-row {
    flex-direction: column;
  }
}
