:root {
  --bg-body: #0f172a;
  --bg-card: #020617;
  --bg-card-alt: #020617;
  --accent: #f97316;
  --accent-soft: rgba(249, 115, 22, 0.18);
  --text-main: #e5e7eb;
  --text-muted: #9ca3af;
  --border-subtle: #1f2937;
  --error: #f87171;
  --radius-lg: 18px;
  --radius-full: 999px;
  --shadow-soft: 0 18px 40px rgba(15, 23, 42, 0.85);
  --font-main: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-main);
  background: radial-gradient(circle at top, #1f2937 0, #020617 55%, #000 100%);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

.container {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* Header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(16px);
  background: linear-gradient(to bottom, rgba(15, 23, 42, 0.96), rgba(15, 23, 42, 0.4), transparent);
  border-bottom: 1px solid rgba(31, 41, 55, 0.7);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0.25rem;
}

.logo {
  font-weight: 700;
  font-size: 1.25rem;
  color: #fefce8;
  text-decoration: none;
  letter-spacing: 0.02em;
}

.main-nav a {
  color: var(--text-muted);
  text-decoration: none;
  margin-left: 1rem;
  font-size: 0.9rem;
}

.main-nav a:hover {
  color: #e5e7eb;
}

/* Hero */

.hero {
  padding: 3.5rem 0 1.5rem;
}

.hero-inner {
  text-align: center;
}

.hero h1 {
  font-size: clamp(2.1rem, 5vw, 2.8rem);
  margin: 0 0 0.75rem;
}

.hero-subtitle {
  max-width: 520px;
  margin: 0 auto 1.5rem;
  color: var(--text-muted);
  font-size: 0.98rem;
}

.hero-helper {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.hero-helper-accent {
  color: var(--accent);
}

/* Buttons */

.btn {
  border: none;
  border-radius: var(--radius-full);
  padding: 0.6rem 1.4rem;
  font-size: 0.95rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, #fb923c, #f97316);
  color: #111827;
  box-shadow: 0 10px 24px rgba(248, 113, 113, 0.35);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 32px rgba(248, 113, 113, 0.45);
}

.btn-secondary {
  background: rgba(15, 23, 42, 0.9);
  border-radius: var(--radius-full);
  border: 1px solid rgba(148, 163, 184, 0.35);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: rgba(15, 23, 42, 0.98);
}

.btn-outline {
  background: transparent;
  border-radius: var(--radius-full);
  border: 1px solid rgba(148, 163, 184, 0.5);
  color: var(--text-main);
}

.btn-outline:hover {
  background: rgba(15, 23, 42, 0.9);
}

.btn:disabled {
  opacity: 0.5;
  cursor: default;
  box-shadow: none;
}

/* App / cards */

.app-section {
  padding: 1rem 0 2rem;
}

.app-grid {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.card {
  background: radial-gradient(circle at top left, rgba(15, 23, 42, 0.8), var(--bg-card));
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-soft);
  padding: 1.25rem 1.25rem 1.5rem;
}

.app-card h2,
.result-card h2,
.options-card h2,
.info-section h2,
.info-section h3 {
  margin-top: 0;
}

/* Fields / inputs */

.field {
  margin-bottom: 0.9rem;
}

.field label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
}

.field input[type="text"] {
  width: 100%;
  padding: 0.45rem 0.7rem;
  border-radius: 10px;
  border: 1px solid rgba(55, 65, 81, 0.9);
  background: rgba(15, 23, 42, 0.9);
  color: var(--text-main);
  font-size: 0.92rem;
}

.field input[type="text"]::placeholder {
  color: #6b7280;
}

.field input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(248, 113, 22, 0.5);
}

.slot-count-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.3rem;
}

.slot-count-btn {
  min-width: 2.1rem;
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(15, 23, 42, 0.95);
  color: var(--text-main);
  cursor: pointer;
  font-size: 0.85rem;
}

.slot-count-btn.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: #fed7aa;
}

.helper-text {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.helper-text.small {
  font-size: 0.78rem;
}

.slot-inputs {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.65rem;
  margin: 0.75rem 0 0.25rem;
}

.slot-inputs .field label {
  font-size: 0.82rem;
}

.slot-inputs input[type="text"] {
  width: 100%;
}

/* Result text */

.result-main {
  font-size: 1.15rem;
  margin-top: 0.25rem;
}

.result-main.rolling {
  opacity: 0.7;
  animation: pulse 0.6s infinite alternate;
}

.result-subtext,
.roll-count-message {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.roll-count-message {
  margin-top: 0.35rem;
  font-style: italic;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.9rem;
}

.status-message {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.status-message.error {
  color: var(--error);
}

/* Info */

.info-section {
  padding: 1.5rem 0 2.5rem;
}

.info-section p {
  color: var(--text-muted);
  font-size: 0.94rem;
  line-height: 1.5;
}

.info-section ul {
  padding-left: 1.1rem;
  color: var(--text-muted);
  font-size: 0.94rem;
}

/* Dice page layout */

.dice-page {
  padding: 2rem 0 2.5rem;
}

.dice-grid {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Options list */

.options-list {
  list-style: decimal;
  padding-left: 1.25rem;
  margin-top: 0.75rem;
  color: var(--text-main);
  font-size: 0.95rem;
}

.options-list li span.label {
  color: var(--text-muted);
  font-size: 0.82rem;
  margin-left: 0.25rem;
}

/* Ads */

.ad-slot {
  border-radius: 14px;
  border: 1px dashed rgba(148, 163, 184, 0.4);
  padding: 0.75rem;
  margin: 0.9rem 0;
  text-align: center;
  font-size: 0.8rem;
  color: rgba(148, 163, 184, 0.8);
  background: radial-gradient(circle at top, rgba(15, 23, 42, 0.8), rgba(15, 23, 42, 0.4));
}

.ad-slot-top {
  margin-top: 0.5rem;
}

.ad-slot-middle {
  min-height: 80px;
}

.ad-slot-bottom {
  min-height: 90px;
}

/* Footer */

.site-footer {
  border-top: 1px solid rgba(31, 41, 55, 0.9);
  background: #020617;
  padding: 0.85rem 0;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.footer-nav a {
  color: var(--text-muted);
  text-decoration: none;
  margin: 0 0.5rem;
}

.footer-nav a:hover {
  color: var(--text-main);
}

/* Animations */

@keyframes pulse {
  from {
    transform: scale(1);
  }
  to {
    transform: scale(1.02);
  }
}

/* Responsive */

@media (min-width: 768px) {
  .hero-inner {
    text-align: left;
    padding-top: 0.5rem;
  }

  .hero-subtitle {
    margin-left: 0;
  }

  .app-grid {
    flex-direction: row;
  }

  .app-card,
  .result-card,
  .options-card {
    flex: 1;
  }

  .slot-inputs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dice-grid {
    flex-direction: row;
  }

  .footer-inner {
    flex-direction: row;
    justify-content: space-between;
  }
}
