:root {
  --bg-deep: #0c0614;
  --bg-panel: #160d24;
  --bg-elevated: #1f1233;
  --border: rgba(233, 30, 140, 0.22);
  --text: #f4ecff;
  --text-muted: #a898c4;
  --roll20-magenta: #e91e8c;
  --roll20-pink: #ff4da6;
  --roll20-purple: #7c3aed;
  --accent-gold: #d4af37;
  --accent-gold-dim: #9a7b2c;
  --success: #34d399;
  --danger: #f87171;
  --radius: 12px;
  --font-sans: "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-display: "Georgia", "Times New Roman", serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  background: var(--bg-deep);
  color: var(--text);
  line-height: 1.5;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(124, 58, 237, 0.25), transparent),
    radial-gradient(ellipse 60% 40% at 100% 50%, rgba(233, 30, 140, 0.08), transparent),
    radial-gradient(ellipse 50% 30% at 0% 80%, rgba(255, 77, 166, 0.06), transparent);
  pointer-events: none;
  z-index: -1;
}

a {
  color: var(--roll20-pink);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(12, 6, 20, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: 0.02em;
  color: var(--text);
  text-decoration: none;
}

.logo:hover {
  text-decoration: none;
  color: var(--roll20-pink);
}

.logo-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--roll20-magenta), var(--roll20-purple));
  display: grid;
  place-items: center;
  font-size: 1.1rem;
}

.main-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.main-nav button {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font: inherit;
  padding: 0.5rem 0.85rem;
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.main-nav button:hover,
.main-nav button.active {
  color: var(--text);
  background: rgba(233, 30, 140, 0.12);
}

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 4rem;
}

.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
}

.panel h2 {
  margin: 0 0 0.75rem;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--accent-gold);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}

.hidden {
  display: none !important;
}

.hero {
  text-align: center;
  padding: 2.5rem 1rem 3rem;
  margin-bottom: 2rem;
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 2.75rem);
  margin: 0 0 0.75rem;
  background: linear-gradient(90deg, var(--text), var(--roll20-pink));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero .tagline {
  color: var(--text-muted);
  font-size: 1.1rem;
  max-width: 640px;
  margin: 0 auto 1.5rem;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 1.25rem;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.95rem;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.12s, box-shadow 0.12s;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: linear-gradient(135deg, var(--roll20-magenta), var(--roll20-purple));
  color: #fff;
  box-shadow: 0 4px 20px rgba(233, 30, 140, 0.35);
}

.btn-primary:hover {
  box-shadow: 0 6px 28px rgba(233, 30, 140, 0.45);
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--roll20-magenta);
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.feature-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  transition: border-color 0.2s;
}

.feature-card:hover {
  border-color: rgba(233, 30, 140, 0.45);
}

.feature-card h3 {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
  color: var(--roll20-pink);
}

.feature-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.form-grid {
  display: grid;
  gap: 0.75rem;
  max-width: 520px;
}

label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

input,
textarea,
select {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-deep);
  color: var(--text);
  font: inherit;
}

textarea {
  min-height: 100px;
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--roll20-magenta);
  box-shadow: 0 0 0 2px rgba(233, 30, 140, 0.2);
}

.dice-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.dice-bar .btn {
  min-width: 3.25rem;
}

.dice-options {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
  margin-bottom: 1rem;
}

.dice-options .field {
  width: auto;
  min-width: 100px;
}

.dice-result {
  font-size: 2.5rem;
  font-weight: 700;
  text-align: center;
  padding: 1.5rem;
  background: var(--bg-deep);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 1rem;
  min-height: 5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 0.25rem;
}

.dice-result .detail {
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--text-muted);
}

.roll-log {
  max-height: 200px;
  overflow-y: auto;
  font-size: 0.88rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  padding-top: 0.75rem;
}

.roll-log li {
  margin-bottom: 0.35rem;
}

.char-list {
  display: grid;
  gap: 0.75rem;
}

.char-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  display: grid;
  gap: 0.5rem;
}

.char-card header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
}

.char-card h3 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--accent-gold);
}

.char-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.char-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.btn-small {
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
}

.btn-danger {
  background: rgba(248, 113, 113, 0.15);
  color: var(--danger);
  border: 1px solid rgba(248, 113, 113, 0.4);
}

.init-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.init-table th,
.init-table td {
  text-align: left;
  padding: 0.5rem 0.65rem;
  border-bottom: 1px solid var(--border);
}

.init-table th {
  color: var(--text-muted);
  font-weight: 600;
}

.init-add {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: flex-end;
  margin-bottom: 1rem;
}

.init-add .field {
  flex: 1;
  min-width: 120px;
}

.notes-area {
  min-height: 220px;
}

.footer-note {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 2rem 1rem;
  border-top: 1px solid var(--border);
  margin-top: 2rem;
}

@media (max-width: 600px) {
  .header-inner {
    flex-direction: column;
    align-items: stretch;
  }

  .main-nav {
    justify-content: center;
  }
}
