:root {
  --bg: #0a0a12;
  --bg-image: none;
  --text: #f0f0f5;
  --text-muted: rgba(240, 240, 245, 0.65);
  --tile-bg: rgba(30, 30, 30, 0.65);
  --tile-border: rgba(255, 255, 255, 0.08);
  --accent: #6b8cff;
  --overlay: rgba(0, 0, 0, 0.55);
  --input-bg: rgba(255, 255, 255, 0.08);
  --bar-bg: rgba(20, 20, 28, 0.92);
}

:root[data-theme="white"] {
  --bg: #ffffff;
  --text: #1a1a1a;
  --text-muted: rgba(26, 26, 26, 0.6);
  --tile-bg: rgba(240, 240, 245, 0.95);
  --tile-border: rgba(0, 0, 0, 0.08);
  --accent: #3b5bdb;
  --overlay: rgba(0, 0, 0, 0.35);
  --input-bg: rgba(0, 0, 0, 0.06);
  --bar-bg: rgba(255, 255, 255, 0.95);
}

:root[data-theme="black"] {
  --bg: #000000;
  --text: #f5f5f5;
  --text-muted: rgba(245, 245, 245, 0.6);
  --tile-bg: rgba(30, 30, 30, 0.8);
  --tile-border: rgba(255, 255, 255, 0.1);
  --accent: #6b8cff;
  --overlay: rgba(0, 0, 0, 0.7);
  --input-bg: rgba(255, 255, 255, 0.08);
  --bar-bg: rgba(10, 10, 10, 0.95);
}

:root[data-theme="space"] {
  --bg: #050510;
  --text: #e8e8f5;
  --text-muted: rgba(232, 232, 245, 0.65);
  --tile-bg: rgba(30, 30, 45, 0.7);
  --tile-border: rgba(107, 140, 255, 0.15);
  --accent: #6b8cff;
  --overlay: rgba(5, 5, 16, 0.75);
  --input-bg: rgba(255, 255, 255, 0.08);
  --bar-bg: rgba(10, 10, 24, 0.92);
}

:root[data-theme="custom"] {
  --text: #f0f0f5;
  --text-muted: rgba(240, 240, 245, 0.65);
  --tile-bg: rgba(30, 30, 30, 0.65);
  --tile-border: rgba(255, 255, 255, 0.08);
  --overlay: rgba(0, 0, 0, 0.55);
  --input-bg: rgba(255, 255, 255, 0.08);
  --bar-bg: rgba(20, 20, 28, 0.92);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background-color: var(--bg);
  background-image: var(--bg-image);
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  -webkit-tap-highlight-color: transparent;
}

body[data-theme="space"]::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(1px 1px at 10% 20%, rgba(255, 255, 255, 0.8), transparent),
    radial-gradient(1px 1px at 30% 65%, rgba(255, 255, 255, 0.6), transparent),
    radial-gradient(1.5px 1.5px at 55% 15%, rgba(255, 255, 255, 0.7), transparent),
    radial-gradient(1px 1px at 72% 42%, rgba(255, 255, 255, 0.5), transparent),
    radial-gradient(1px 1px at 88% 78%, rgba(255, 255, 255, 0.6), transparent),
    radial-gradient(1px 1px at 15% 88%, rgba(255, 255, 255, 0.4), transparent),
    radial-gradient(ellipse at 50% 0%, rgba(107, 140, 255, 0.15), transparent 60%),
    linear-gradient(180deg, #0a0a18 0%, #050510 50%, #0a0820 100%);
  z-index: -1;
}

.hidden {
  display: none !important;
}

button {
  font: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input,
textarea {
  font: inherit;
  color: var(--text);
  background: var(--input-bg);
  border: 1px solid var(--tile-border);
  border-radius: 8px;
  padding: 10px 12px;
  width: 100%;
}

input:focus,
textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--tile-bg);
  border: 1px solid var(--tile-border);
}

.icon-btn:active {
  transform: scale(0.96);
}

.primary-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 10px 18px;
  font-weight: 600;
}

.secondary-btn {
  background: var(--tile-bg);
  border: 1px solid var(--tile-border);
  border-radius: 10px;
  padding: 10px 18px;
}

.overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}

.dialog {
  background: var(--bar-bg);
  border: 1px solid var(--tile-border);
  border-radius: 16px;
  padding: 20px;
  width: min(420px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  backdrop-filter: blur(12px);
}

.dialog h2 {
  margin: 0 0 16px;
  font-size: 1.15rem;
}

.form-row {
  margin-bottom: 12px;
}

.form-row label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 16px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.checkbox-row input {
  width: auto;
}
