@import url("https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap");

:root {
  color-scheme: light;
  font-family:
    Geist, Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  --ink: #18181b;
  --muted-ink: #52525b;
  --paper: #fff8d6;
  --paper-strong: #fff2b8;
  --panel: #fefefe;
  --sky: #9ad1ff;
  --mint: #b9f8cf;
  --rose: #ffb4c5;
  --gold: #ffd84d;
  --body-top: #fffbeb;
  --body-bottom: #ffe8f1;
  --grid-line: rgb(24 24 27 / 0.08);
  --from-panel: #fffef7;
  --result-panel: #fff7fb;
  --input: #fffdf4;
  --readonly: #fff;
  --input-outline: #fff;
  --shadow: 6px 6px 0 var(--ink);
  --shadow-sm: 4px 4px 0 var(--ink);
  --border: 3px solid var(--ink);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #f4f4f5;
  --muted-ink: #d4d4d8;
  --paper: #18181b;
  --paper-strong: #27272a;
  --panel: #232326;
  --sky: #254c73;
  --mint: #24473c;
  --rose: #5f3143;
  --gold: #d6a625;
  --body-top: #09090b;
  --body-bottom: #1f1020;
  --grid-line: rgb(244 244 245 / 0.08);
  --from-panel: #1a1a1d;
  --result-panel: #24161d;
  --input: #111114;
  --readonly: #16161a;
  --input-outline: #2a2a31;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(0deg, var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px),
    linear-gradient(180deg, var(--body-top) 0%, var(--body-bottom) 100%);
  background-size: 24px 24px, 24px 24px, auto;
  color: var(--ink);
  transition:
    background-color 180ms ease,
    color 180ms ease;
}

main {
  width: min(90vw, 1728px);
  max-width: 100%;
  margin: 0 auto;
  padding: 16px 12px 24px;
}

.frame {
  position: relative;
  border: var(--border);
  background: var(--paper);
  box-shadow: var(--shadow);
  padding: 16px;
}

.hero {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: var(--border);
  background: var(--gold);
  box-shadow: var(--shadow-sm);
  font-family: "Press Start 2P", system-ui, sans-serif;
  font-size: 10px;
  text-transform: uppercase;
}

.badge::before {
  content: "";
  width: 12px;
  height: 12px;
  background: var(--ink);
}

.theme-toggle {
  position: fixed;
  top: 18px;
  left: 18px;
  border: var(--border);
  border-radius: 0;
  padding: 7px 10px;
  background: var(--paper-strong);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  z-index: 10;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--ink);
  outline: none;
}

.intro {
  max-width: 1800px;
}

h1 {
  margin: 0;
  font-size: clamp(22px, 2.4vw, 32px);
  line-height: 1.4;
}

h1, h2, h3, h4, h5, h6 {
  font-family: "Press Start 2P", system-ui, sans-serif;
}

.subtitle {
  font-family: "Press Start 2P", system-ui, sans-serif;
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.hero-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 8px 12px;
  border: var(--border);
  background: var(--mint);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  font-family: "Press Start 2P", system-ui, sans-serif;
  font-size: 10px;
  line-height: 1.4;
  text-decoration: none;
  text-transform: uppercase;
}

.hero-link--subtle {
  background: var(--paper-strong);
}

.hero-link:hover,
.hero-link:focus-visible {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--ink);
  outline: none;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 16px 18px;
  border: var(--border);
  background: var(--mint);
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}

.toolbar-copy {
  margin: 0;
  font-family: "Press Start 2P", system-ui, sans-serif;
  font-size: 11px;
  line-height: 1.8;
}

.toolbar-note {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-areas:
    "to to"
    "from result";
  gap: 18px;
  align-items: stretch;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  padding: 18px;
  border: var(--border);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
}

.field--from {
  grid-area: from;
  background: var(--from-panel);
}

.field--to {
  grid-area: to;
  background: var(--sky);
  padding: 12px 14px;
}

.field--result {
  grid-area: result;
  background: var(--result-panel);
}

label {
  font-family: "Press Start 2P", system-ui, sans-serif;
  font-size: 11px;
  line-height: 1.6;
  text-transform: uppercase;
}

.field-note {
  margin: -2px 0 0;
  font-size: 13px;
  font-weight: 700;
}

textarea,
select {
  width: 100%;
  border: var(--border);
  border-radius: 0;
  padding: 16px;
  background: var(--input);
  color: var(--ink);
  font: inherit;
  box-shadow: inset 0 0 0 2px var(--input-outline);
  outline: none;
}

textarea {
  min-height: 50vh;
  resize: vertical;
  font-family:
    "Geist Mono", ui-monospace, "Cascadia Mono", "Segoe UI Mono", "SF Mono", SFMono-Regular,
    Menlo, Monaco,
    Consolas, "Liberation Mono", "DejaVu Sans Mono", monospace;
  line-height: 1.65;
}

select {
  min-height: 50px;
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--ink) 50%),
    linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position:
    calc(100% - 24px) calc(50% - 4px),
    calc(100% - 16px) calc(50% - 4px);
  background-size: 8px 8px, 8px 8px;
  background-repeat: no-repeat;
  padding-right: 48px;
}

textarea:focus,
select:focus {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--ink), inset 0 0 0 2px var(--input-outline);
}

textarea[readonly] {
  background: var(--readonly);
}

::placeholder {
  color: var(--muted-ink);
  opacity: 1;
}

@media (min-width: 2800px) {
  main {
    width: min(75vw, 2580px);
  }
}

@media (max-width: 980px) {
  .grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "to"
      "from"
      "result";
  }

  textarea {
    min-height: 28vh;
  }
}

@media (max-width: 640px) {
  main {
    padding-inline: 16px;
  }

  .frame,
  .field,
  .toolbar {
    padding: 16px;
  }

  .badge,
  .toolbar-copy,
  label {
    font-size: 9px;
  }

  .theme-toggle {
    top: 14px;
    left: 14px;
    padding: 6px 9px;
    font-size: 12px;
  }
}

select, optgroup, option {
  font-family: "Press Start 2P", system-ui, sans-serif;
}
