:root {
  --ink: #20242a;
  --muted: #5f6875;
  --line: #d8dee7;
  --paper: #ffffff;
  --mist: #f4f8fb;
  --green: #157347;
  --teal: #087990;
  --red: #bd2f2f;
  --gold: #946200;
  --focus: #0b66c3;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.5;
}

a {
  color: inherit;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
.primary-action,
.secondary-action,
#new-tab-link {
  border-radius: 6px;
  border: 1px solid var(--ink);
  cursor: pointer;
  min-height: 42px;
  padding: 10px 14px;
  text-decoration: none;
}

button,
.primary-action {
  background: var(--green);
  border-color: var(--green);
  color: #ffffff;
}

button:hover,
.primary-action:hover {
  background: #0f5b38;
}

.secondary-action,
#new-tab-link,
.auth-link {
  background: #ffffff;
  color: var(--ink);
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.site-header {
  align-items: center;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 18px;
  justify-content: space-between;
  min-height: 68px;
  padding: 10px clamp(16px, 4vw, 48px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  align-items: center;
  display: inline-flex;
  font-weight: 700;
  gap: 10px;
  text-decoration: none;
}

.brand-mark {
  align-items: center;
  background: var(--ink);
  border-radius: 6px;
  color: #ffffff;
  display: inline-flex;
  height: 36px;
  justify-content: center;
  width: 44px;
}

.main-menu {
  align-items: center;
  display: flex;
  gap: 6px;
}

.main-menu a,
.menu-button {
  background: transparent;
  border: 0;
  color: var(--ink);
  min-height: 40px;
  padding: 9px 12px;
  text-decoration: none;
}

.main-menu a:hover,
.menu-button:hover {
  background: var(--mist);
}

.menu-group {
  position: relative;
}

.submenu {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 14px 30px rgba(32, 36, 42, 0.12);
  display: none;
  min-width: 230px;
  padding: 8px;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
}

.menu-group:hover .submenu,
.menu-group.open .submenu {
  display: grid;
}

.menu-toggle {
  display: none;
}

.route {
  display: none;
}

.hero.active-route {
  align-items: center;
  display: grid;
  gap: clamp(24px, 5vw, 64px);
  grid-template-columns: minmax(0, 1fr) minmax(280px, 48%);
  min-height: calc(100vh - 150px);
  padding: clamp(32px, 7vw, 84px) clamp(16px, 5vw, 72px);
}

.hero-copy {
  max-width: 720px;
}

.eyebrow {
  color: var(--teal);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0;
  margin: 0 0 8px;
  text-transform: uppercase;
}

h1,
h2 {
  line-height: 1.1;
  margin: 0 0 16px;
}

h1 {
  font-size: clamp(2rem, 3.7rem, 4.2rem);
}

h2 {
  font-size: clamp(1.7rem, 2.4rem, 3rem);
}

.hero p,
.section-heading p,
.auth-layout p {
  color: var(--muted);
  max-width: 760px;
}

.hero-actions,
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.hero-image {
  aspect-ratio: 4 / 3;
  border-radius: 8px;
  height: auto;
  object-fit: cover;
  width: 100%;
}

.feature-strip {
  background: var(--ink);
  color: #ffffff;
  display: grid;
  gap: 1px;
  grid-template-columns: repeat(4, 1fr);
}

.feature-strip a {
  background: rgba(255, 255, 255, 0.07);
  min-height: 92px;
  padding: 20px;
  text-decoration: none;
}

.feature-strip a:hover {
  background: rgba(255, 255, 255, 0.14);
}

.content-band {
  padding: clamp(32px, 6vw, 72px) clamp(16px, 5vw, 72px);
}

.active-route {
  display: grid;
}

.alt-band {
  background: var(--mist);
}

.section-heading {
  margin-bottom: 24px;
}

.practice-form,
.auth-form,
.upload-form {
  display: grid;
  gap: 18px;
  max-width: 980px;
}

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

label,
fieldset {
  display: grid;
  gap: 8px;
}

fieldset {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

input,
select,
textarea {
  border: 1px solid var(--line);
  border-radius: 6px;
  min-height: 42px;
  padding: 10px 12px;
  width: 100%;
}

textarea {
  resize: vertical;
}

.inline-control {
  align-items: center;
  display: inline-flex;
  gap: 8px;
  margin-right: 18px;
}

.inline-control input {
  min-height: auto;
  width: auto;
}

.range-label,
.wide-field,
.status-message {
  grid-column: 1 / -1;
}

.status-message {
  color: var(--muted);
  margin: 4px 0 0;
  min-height: 28px;
}

.status-message.success {
  color: var(--green);
  font-weight: 700;
}

.status-message.error {
  color: var(--red);
  font-weight: 700;
}

.drag-layout {
  display: grid;
  gap: 20px;
  grid-template-columns: 280px minmax(280px, 1fr);
}

.drag-palette {
  display: grid;
  gap: 12px;
}

.drag-item {
  background: #ffffff;
  border: 1px solid var(--line);
  border-left: 6px solid var(--gold);
  border-radius: 6px;
  cursor: grab;
  padding: 16px;
}

.drop-zone {
  align-items: center;
  background: #ffffff;
  border: 2px dashed var(--teal);
  border-radius: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  min-height: 180px;
  padding: 20px;
}

.drop-zone.drag-over {
  background: #e9f8fb;
}

.tabs {
  display: grid;
  gap: 0;
  max-width: 860px;
}

.tab-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tab {
  background: #ffffff;
  border-color: var(--line);
  color: var(--ink);
}

.active-tab {
  background: var(--teal);
  border-color: var(--teal);
  color: #ffffff;
}

.tab-panel {
  border: 1px solid var(--line);
  border-radius: 0 6px 6px 6px;
  display: none;
  min-height: 120px;
  padding: 20px;
}

.active-panel {
  display: block;
}

.auth-layout {
  align-items: start;
  display: grid;
  gap: 28px;
  grid-template-columns: minmax(260px, 0.7fr) minmax(280px, 1fr);
  max-width: 980px;
}

.auth-form {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
}

.upload-drop {
  min-height: 150px;
}

.frame-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(280px, 1fr) minmax(280px, 1fr);
}

iframe {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 260px;
  width: 100%;
}

.nested-frame-wrap {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, 1fr);
}

.nested-frame-wrap iframe {
  min-height: 260px;
}

dialog {
  border: 0;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(32, 36, 42, 0.28);
  max-width: 460px;
  width: calc(100% - 32px);
}

dialog::backdrop {
  background: rgba(32, 36, 42, 0.5);
}

.modal-content {
  display: grid;
  gap: 14px;
  padding: 8px;
}

.site-footer {
  border-top: 1px solid var(--line);
  color: var(--muted);
  padding: 24px clamp(16px, 5vw, 72px);
}

.child-window {
  background: var(--mist);
}

.child-content {
  display: block;
  margin: 8vh auto;
  max-width: 720px;
}

@media (max-width: 860px) {
  .site-header {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .menu-toggle {
    display: inline-flex;
  }

  .main-menu {
    align-items: stretch;
    display: none;
    flex-basis: 100%;
    flex-direction: column;
  }

  .main-menu.open {
    display: flex;
  }

  .submenu {
    box-shadow: none;
    position: static;
  }

  .hero,
  .practice-form,
  .drag-layout,
  .auth-layout,
  .frame-grid {
    grid-template-columns: 1fr;
  }

  .feature-strip {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 540px) {
  h1 {
    font-size: 2rem;
  }

  .feature-strip {
    grid-template-columns: 1fr;
  }

  .nested-frame-wrap {
    grid-template-columns: 1fr;
  }
}
