:root {
  --paper: #f6efe6;
  --paper-deep: #eadfce;
  --ink: #18212c;
  --muted: #5d6772;
  --panel: rgba(255, 249, 241, 0.76);
  --panel-strong: rgba(255, 249, 241, 0.9);
  --panel-border: rgba(24, 33, 44, 0.1);
  --shadow: 0 24px 60px rgba(24, 33, 44, 0.1);
  --shadow-deep: 0 30px 80px rgba(17, 25, 34, 0.18);
  --code-bg: #111922;
  --code-bg-soft: #17222e;
  --code-ink: #f5efe7;
  --o-accent: #ee6b39;
  --go-accent: #1d9ca4;
  --comment: #7c8fa3;
  --keyword: #ff8f61;
  --type: #73d3d7;
  --string: #ffd481;
  --number: #e7c06a;
  --operator: #f5efe7;
  --call: #c6e78a;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Avenir Next Condensed", "DIN Condensed", "Franklin Gothic Medium", "Trebuchet MS", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 0%, rgba(238, 107, 57, 0.22), transparent 28%),
    radial-gradient(circle at 90% 12%, rgba(29, 156, 164, 0.18), transparent 24%),
    linear-gradient(180deg, var(--paper) 0%, var(--paper-deep) 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(24, 33, 44, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(24, 33, 44, 0.035) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.45), transparent 88%);
  pointer-events: none;
}

.page-shell {
  position: relative;
  max-width: 1440px;
  margin: 0 auto;
  padding: 28px clamp(16px, 4vw, 44px) 48px;
}

.hero {
  position: relative;
  overflow: hidden;
  padding: clamp(24px, 5vw, 42px);
  border-radius: 32px;
  background: linear-gradient(135deg, #142130 0%, #20384a 55%, #2b4b60 100%);
  color: #f7f0e7;
  box-shadow: 0 26px 80px rgba(20, 33, 48, 0.24);
}

.hero::before,
.hero::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  pointer-events: none;
}

.hero::before {
  width: 20rem;
  height: 20rem;
  top: -10rem;
  right: -5rem;
  background: radial-gradient(circle, rgba(238, 107, 57, 0.3), transparent 70%);
}

.hero::after {
  width: 16rem;
  height: 16rem;
  bottom: -9rem;
  left: -4rem;
  background: radial-gradient(circle, rgba(29, 156, 164, 0.22), transparent 70%);
}

.hero-row {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.eyebrow {
  margin: 0;
  font-size: 0.9rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(247, 240, 231, 0.78);
}

h1 {
  margin: 0;
  max-width: 10ch;
  font-size: clamp(2.6rem, 5vw, 4.6rem);
  line-height: 0.92;
  letter-spacing: -0.04em;
}

.workspace {
  margin-top: 18px;
}

.tab-dock {
  position: relative;
}

.tab-rail {
  position: relative;
  z-index: 1;
  margin-left: auto;
}

.tab-bar {
  display: inline-grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 8px;
  border-radius: 999px;
  background: rgba(250, 244, 237, 0.82);
  border: 1px solid rgba(24, 33, 44, 0.08);
  box-shadow: 0 22px 44px rgba(24, 33, 44, 0.12);
  backdrop-filter: blur(18px);
}

.tab-button {
  min-width: 7.5rem;
  padding: 12px 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.15;
  text-align: center;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color 180ms ease, color 180ms ease, transform 180ms ease;
}

.tab-button:hover,
.tab-button:focus-visible {
  color: var(--ink);
  outline: none;
}

.tab-button.is-active {
  background: linear-gradient(135deg, #fff6ea 0%, #f2ede7 100%);
  color: var(--ink);
  transform: translateY(-1px);
}

.tab-panel {
  display: none;
}

.tab-panel.is-active {
  display: block;
}

.tab-panel[hidden] {
  display: none;
}

.panel-surface {
  padding: clamp(18px, 3vw, 28px);
  border-radius: 34px;
  background: var(--panel-strong);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow);
}

.selector-strip,
.translate-toolbar {
  display: grid;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.selector-strip {
  grid-template-columns: auto minmax(0, 1fr) auto;
  width: 100%;
  max-width: 34rem;
  margin-inline: auto;
}

.translate-toolbar {
  grid-template-columns: auto auto;
  justify-content: start;
}

.toolbar-label {
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.nav-button,
.style-button {
  border: 0;
  font: inherit;
  cursor: pointer;
}

.nav-button {
  width: 3.4rem;
  height: 3.4rem;
  border-radius: 18px;
  background: #fff8ee;
  color: var(--ink);
  box-shadow: inset 0 0 0 1px rgba(24, 33, 44, 0.08), 0 12px 24px rgba(24, 33, 44, 0.08);
  font-size: 1.36rem;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.nav-button:hover,
.nav-button:focus-visible,
.style-button:hover,
.style-button:focus-visible {
  transform: translateY(-1px);
  outline: none;
}

.example-select {
  width: 100%;
  min-height: 3.4rem;
  padding: 0 16px;
  border-radius: 18px;
  border: 1px solid rgba(24, 33, 44, 0.12);
  background: #fffaf3;
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5);
}

.style-toggle {
  display: inline-grid;
  grid-auto-flow: column;
  gap: 8px;
  padding: 8px;
  border-radius: 999px;
  background: rgba(24, 33, 44, 0.06);
  border: 1px solid rgba(24, 33, 44, 0.08);
}

.style-button {
  padding: 10px 16px;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.style-button.is-active {
  background: linear-gradient(135deg, #fff6ea 0%, #f2ede7 100%);
  color: var(--ink);
}

.code-stage {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.viewer-card {
  overflow: hidden;
  border-radius: 28px;
  background: linear-gradient(180deg, var(--code-bg) 0%, var(--code-bg-soft) 100%);
  color: var(--code-ink);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow-deep);
}

.viewer-card[data-tone="o"] {
  box-shadow: inset 0 4px 0 var(--o-accent), var(--shadow-deep);
}

.viewer-card[data-tone="go"] {
  box-shadow: inset 0 4px 0 var(--go-accent), var(--shadow-deep);
}

.viewer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(10, 16, 24, 0.28);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.viewer-head span {
  color: rgba(245, 239, 231, 0.68);
  font-size: 0.78rem;
}

.viewer-head strong {
  color: #fff7ea;
  font-size: 0.85rem;
}

.viewer-card pre {
  margin: 0;
  min-height: 14rem;
  padding: 18px;
  overflow-x: auto;
  font-family: "Iosevka", "IBM Plex Mono", "JetBrains Mono", "Fira Code", monospace;
  font-size: 0.95rem;
  line-height: 1.58;
  letter-spacing: -0.01em;
}

.viewer-card code {
  display: block;
}

.translate-stage {
  align-items: stretch;
}

.code-input {
  width: 100%;
  min-height: 14rem;
  padding: 18px;
  border: 0;
  background: transparent;
  color: var(--code-ink);
  resize: vertical;
  font-family: "Iosevka", "IBM Plex Mono", "JetBrains Mono", "Fira Code", monospace;
  font-size: 0.95rem;
  line-height: 1.58;
  letter-spacing: -0.01em;
}

.code-input::placeholder {
  color: rgba(245, 239, 231, 0.42);
}

.code-input:focus {
  outline: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.token.comment {
  color: var(--comment);
  font-style: italic;
}

.token.keyword {
  color: var(--keyword);
  font-weight: 700;
}

.token.type {
  color: var(--type);
}

.token.string {
  color: var(--string);
}

.token.number {
  color: var(--number);
}

.token.operator {
  color: var(--operator);
  opacity: 0.88;
}

.token.call {
  color: var(--call);
}

::-webkit-scrollbar {
  height: 12px;
  width: 12px;
}

::-webkit-scrollbar-thumb {
  background: rgba(24, 33, 44, 0.26);
  border-radius: 999px;
}

::-webkit-scrollbar-track {
  background: rgba(24, 33, 44, 0.08);
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(18px);
  }

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

@media (prefers-reduced-motion: no-preference) {
  .hero,
  .panel-surface {
    animation: rise-in 680ms ease both;
  }
}

@media (max-width: 980px) {
  .page-shell {
    padding: 18px 16px 28px;
  }

  .hero,
  .panel-surface {
    border-radius: 26px;
  }

  .hero-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .code-stage {
    grid-template-columns: 1fr;
  }

  .translate-toolbar {
    grid-template-columns: 1fr;
  }

  .style-toggle {
    justify-self: start;
  }

  .viewer-card pre,
  .code-input {
    min-height: 12rem;
    font-size: 0.89rem;
  }
}

@media (max-width: 640px) {
  .tab-bar {
    display: grid;
    width: 100%;
  }

  .tab-rail {
    width: 100%;
    margin-left: 0;
  }

  .tab-button {
    min-width: 0;
    font-size: 0.82rem;
    padding: 10px 8px;
  }

  .selector-strip {
    max-width: none;
  }

  .style-toggle {
    grid-auto-flow: row;
    width: 100%;
  }
}
