:root {
  /* Color Palette - Premium SaaS (Deep Indigo/Violet theme) */
  --color-bg-body: #0f111a;
  --color-bg-card: #1a1d2d;
  --color-bg-nav: rgba(15, 17, 26, 0.85);

  --color-text-main: #e2e8f0;
  --color-text-muted: #94a3b8;

  --color-primary: #6366f1;
  /* Indigo 500 */
  --color-primary-hover: #4f46e5;
  --color-accent: #8b5cf6;
  /* Violet 500 */

  --color-border: #2d3748;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-glow: 0 0 15px rgba(99, 102, 241, 0.3);

  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;

  --container-width: 1200px;
  --header-height: 70px;
}

/* Reset & Base */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--color-bg-body);
  color: var(--color-text-main);
  font-family: var(--font-sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  text-decoration: none;
  color: inherit;
  transition: color 0.2s;
}

ul {
  list-style: none;
}

/* Layout Utilities */
.container {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.main-content {
  min-height: calc(100vh - var(--header-height));
  padding-top: var(--header-height);
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
  line-height: 1.2;
  margin-bottom: 1rem;
  font-weight: 700;
}

h1 {
  font-size: 3.5rem;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 2.5rem;
  letter-spacing: -0.01em;
}

h3 {
  font-size: 1.75rem;
}

p {
  margin-bottom: 1.5rem;
  color: var(--color-text-main);
}

/* Components */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.95rem;
}

#new-fn,
#new-tok {
  padding: 0.75rem 1.5rem;
}

#new-fn {
  width: 60%;
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  color: white;
  box-shadow: var(--shadow-glow);
  border: 1px solid transparent;
}

a.btn {
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.5);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text-main);
}

.btn-outline:hover {
  border-color: var(--color-primary);
  background: rgba(99, 102, 241, 0.1);
}

/* Header */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--color-bg-nav);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-border);
  z-index: 1000;
}

.navbar {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-size: 1.25rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo-icon {
  width: 24px;
  height: 24px;
  background: var(--color-primary);
  border-radius: 6px;
  display: flex;
  /* Temporary placeholder for icon */
  font-size: 0;
}

.nav-links {
  display: flex;
  gap: 2rem;
  align-items: center;
}

.nav-item {
  font-size: 0.95rem;
  color: var(--color-text-muted);
  font-weight: 500;
}

.nav-item:hover {
  color: var(--color-text-main);
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--color-border);
  padding: 4rem 0 2rem;
  background: var(--color-bg-body);
  margin-top: 4rem;
}

.footer-content {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 4rem;
  margin-bottom: 3rem;
}

.footer-col h3 {
  font-size: 1.25rem;
  margin-bottom: 1rem;
}

.footer-col h4 {
  font-size: 1rem;
  color: var(--color-text-main);
  margin-bottom: 1rem;
}

.footer-col a {
  display: block;
  margin-bottom: 0.75rem;
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.footer-col a:hover {
  color: var(--color-primary);
}

.footer-bottom {
  text-align: center;
  padding-top: 2rem;
  border-top: 1px solid var(--color-border);
  font-size: 0.85rem;
  color: var(--color-border);
}

/* Utility Animations */
.fade-in {
  animation: fadeIn 0.8s ease-out forwards;
  opacity: 0;
  transform: translateY(20px);
}

@keyframes fadeIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- Auth layout --- */

.auth-container {
  max-width: 960px;
  margin: 3rem auto;
  padding: 0 1rem;
}

.auth-title {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

@media (max-width: 768px) {
  .auth-grid {
    grid-template-columns: 1fr;
  }
}

/* --- Cards --- */

.auth-card {
  background: radial-gradient(circle at 50% 0%, rgba(99, 102, 241, 0.15), transparent 90%);
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.04);
  border: 1px solid var(--color-border);
}

.auth-card-title {
  margin-bottom: 1.25rem;
  font-size: 1.1rem;
  font-weight: 600;
}

/* --- Buttons --- */

.auth-btn {
  width: 100%;
  margin-top: 1rem;
}

.btn-github {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  background: #111827;
  color: white;
  border: none;
}

.btn-github:hover {
  background: #000000;
}

.github-icon {
  width: 18px;
  height: 18px;
  filter: invert(1);
}

.auth-note {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: #6b7280;
  text-align: center;
}

input,
button {
  border-radius: 0.5em;
  border: solid 1px var(--color-border);
  padding: 0.5em;
}

.material-symbols-outlined {
  vertical-align: -0.2em;
}

.row {
  line-height: 3em;
}

.card {
  /*border-bottom: solid 2px var(--color-border);*/
  padding-bottom: 1em;
  margin-bottom: 2em;
}

h2 {
  padding-top: 1em;
}

.CodeMirror {
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  border: 1px solid #2a2b36 !important;
}

.toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  inset: 0;
  background-color: #ccc;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.slider::before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  top: 3px;
  background-color: white;
  border-radius: 50%;
  transition: transform 0.2s;
}

input:checked+.slider {
  background-color: #4f46e5;
  /* modern indigo */
}

input:checked+.slider::before {
  transform: translateX(20px);
}



.fn-card {
  margin-bottom: 1.25rem;
}

.fn-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.fn-title {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.fn-name {
  font-weight: 700;
  font-size: 1.05rem;
}

.fn-meta {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.version-block {
  margin-top: 1rem;
}

.version-grid {
  display: grid;
  grid-template-columns: 90px 170px 1fr 90px 90px 90px 120px;
  gap: .75rem;
  align-items: center;
  font-size: 80%;
}

.version-grid-head {
  font-size: .85rem;
  color: #6b7280;
  padding: .35rem 0 .5rem 0;
  border-bottom: solid 1px var(--color-border);
}

.version-grid-row {
  padding: .55rem 0;
}

.ver-badge {
  font-weight: 700;
}

.tog {
  display: flex;
  justify-content: center;
}

.actions {
  display: flex;
  gap: .5rem;
  justify-content: flex-end;
  flex-wrap: wrap;
}


/* --- Editor toolbar --- */

.editor-toolbar {
  display: flex;
  /*justify-content: space-between;*/
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0;

  background: #1e1f29;
  /* matches dracula vibe */
  border: 1px solid #2a2b36;
  border-radius: 8px 8px 0 0;
}

/* --- Toolbar buttons --- */

.tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;

  padding: 0.35rem 0.6rem;
  font-size: 0.85rem;

  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;

  color: #9ca3af;
  cursor: not-allowed;
}

.tool-btn .material-symbols-outlined {
  font-size: 20px;
}

.tool-label {
  font-size: 0.8rem;
}

/* Disabled but still visually interactive */
.tool-btn:disabled {
  opacity: 0.65;
}

.tool-btn:hover {
  border-color: #3b3d4a;
  background: #2a2b36;
}

/* Optional: hide labels on very small screens */
@media (max-width: 640px) {
  .tool-label {
    display: none;
  }
}

.examples,
.examples ul {
  background: #62677e;
  cursor: pointer;
}

.examples>li>details>ul {
  position: absolute;
  z-index: 100;
  border-radius: 2px;
  filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 40%));
}

.examples li {
  padding: 0.2em 0.5em
}

.examples ul ul {
  padding-left: 2em;
}

.examples {
  display: inline-block;
  border-radius: 2px;
  margin: 1em 0;
}

/* Modal styling */
.modal::backdrop {
  background: rgba(0, 0, 0, 0.55);
}

.modal {
  border: none;
  padding: 0;
  border-radius: 12px;
  max-width: 640px;
  width: calc(100% - 2rem);
  margin: auto;
}

.modal-card {
  padding: 1.25rem 1.25rem 1rem 1.25rem;
  background: #ffffff;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
}

#token-list {
  border: solid 1px var(--color-border);
  background-color: var(--color-bg-card);
  padding: 2em;
}

.muted {
  color: var(--color-text-muted);
  font-size: 80%;
}

#token-list input {
  background: var(--color-text-muted);
  color: var(--color-text-main);
}

#token-list .row {
  line-height: 0.9rem;
}

.copyable {
  border-bottom-right-radius: 0;
  border-top-right-radius: 0;
}

.copy-btn {
  padding: 2px;
  margin-left: -10px;
  border-bottom-left-radius: 0;
  border-top-left-radius: 0;
}

.token-row {
  margin-bottom: 0 !important;
  padding-bottom: 0 !important;
}

/* --- Mobile Responsive Overrides --- */
@media (max-width: 768px) {

  /* Navbar compacting */
  .logo-text {
    display: none;
    /* Hide text, keep icon */
  }

  .nav-links {
    gap: 0.75rem;
    /* Reduce gap */
  }

  .nav-item {
    font-size: 0.85rem;
    /* Slightly smaller text */
  }

  .btn {
    padding: 0.5rem 1rem;
    /* Compact buttons */
    font-size: 0.85rem;
  }

  /* Ensure container has some breathing room but not too much */
  .container {
    padding: 0 1rem;
  }
}