:root {
  color-scheme: light;
  --ink: #07182e;
  --ink-soft: #233953;
  --paper: #fffdf6;
  --paper-deep: #f7f0da;
  --signal: #ffd43b;
  --signal-dark: #dcae00;
  --red: #e54949;
  --blue: #3b82f6;
  --green: #25845f;
  --purple: #815ac0;
  --line: #c9c0a5;
  --white: #ffffff;
  --shadow: 0 24px 60px rgba(7, 24, 46, 0.16);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.08) 1px, transparent 1.5px) 0 0 / 24px 24px,
    var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.6;
}

button,
textarea {
  font: inherit;
}

button,
summary,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

a {
  color: inherit;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 100;
  padding: 10px 14px;
  border-radius: 8px;
  color: var(--ink);
  background: var(--signal);
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  color: var(--white);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.header-inner,
.site-footer {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}

.header-inner {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-size: 1.08rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border: 2px solid currentColor;
  border-radius: 50%;
  color: var(--signal);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}

.brand-dot {
  color: var(--signal);
}

nav {
  display: flex;
  gap: 28px;
  font-size: 0.92rem;
  font-weight: 650;
}

nav a,
.footer-links a {
  color: inherit;
  text-decoration: none;
}

nav a:hover,
.footer-links a:hover {
  text-decoration: underline;
  text-underline-offset: 5px;
}

main {
  background: var(--paper);
}

.maker-shell {
  position: relative;
  padding: 72px 20px 88px;
  background:
    linear-gradient(112deg, rgba(255, 212, 59, 0.14), transparent 38%),
    linear-gradient(180deg, var(--ink) 0, #102844 100%);
  overflow: hidden;
}

.maker-shell::before {
  content: "A1  B7  C4  D9  E2  F6";
  position: absolute;
  top: 34px;
  right: -90px;
  color: rgba(255, 255, 255, 0.035);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: clamp(3rem, 8vw, 8rem);
  font-weight: 900;
  letter-spacing: 0.14em;
  white-space: nowrap;
  transform: rotate(-7deg);
  pointer-events: none;
}

.intro,
.maker-card,
.content-section {
  width: min(1080px, 100%);
  margin-inline: auto;
}

.intro {
  position: relative;
  margin-bottom: 30px;
  color: var(--white);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--signal-dark);
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.intro .eyebrow {
  color: var(--signal);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2 {
  letter-spacing: -0.045em;
  line-height: 1.06;
}

h1 {
  max-width: 720px;
  margin-bottom: 14px;
  font-size: clamp(2.6rem, 7vw, 5.4rem);
}

.intro > p:last-child {
  max-width: 650px;
  margin-bottom: 0;
  color: #c9d5e4;
  font-size: 1.12rem;
}

.maker-card {
  position: relative;
  padding: clamp(22px, 4vw, 42px);
  border: 1px solid rgba(7, 24, 46, 0.08);
  border-radius: var(--radius);
  background:
    linear-gradient(rgba(7, 24, 46, 0.035) 1px, transparent 1px) 0 0 / 100% 32px,
    var(--paper);
  box-shadow: var(--shadow);
}

.maker-card::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 54px;
  height: 54px;
  border-bottom-left-radius: 12px;
  background: linear-gradient(225deg, var(--signal) 50%, transparent 51%);
}

.mode-row,
.field-label-row,
.action-row,
.site-footer {
  display: flex;
  align-items: center;
}

.mode-row {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 26px;
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.segmented-control {
  display: inline-flex;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper-deep);
}

.mode-button {
  min-width: 104px;
  padding: 10px 18px;
  border: 0;
  border-radius: 8px;
  color: var(--ink-soft);
  background: transparent;
  font-weight: 800;
}

.mode-button.is-active {
  color: var(--white);
  background: var(--ink);
  box-shadow: 0 5px 12px rgba(7, 24, 46, 0.16);
}

.text-button {
  padding: 8px 4px;
  border: 0;
  color: var(--ink);
  background: transparent;
  font-weight: 750;
  text-decoration: underline;
  text-decoration-color: var(--signal-dark);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

.cipher-picker > legend {
  margin-bottom: 10px;
  font-weight: 820;
}

.cipher-options {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 30px;
}

.cipher-button {
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.72);
  font-weight: 780;
  transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.cipher-button:hover {
  transform: translateY(-2px);
  border-color: var(--ink-soft);
}

.cipher-button.is-active {
  border: 2px solid var(--ink);
  color: var(--ink);
  background: var(--white);
  box-shadow: 4px 4px 0 var(--signal);
}

.cipher-symbol {
  font-size: 1.35rem;
  line-height: 1;
}

.cipher-symbol.classic { color: var(--ink); }
.cipher-symbol.heart { color: var(--red); }
.cipher-symbol.star { color: var(--signal-dark); }
.cipher-symbol.clover { color: var(--green); }
.cipher-symbol.flower { color: var(--purple); }

.message-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
}

.field-label-row {
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 8px;
}

.field-label-row label {
  font-weight: 820;
}

.field-label-row span {
  color: #657287;
  font-size: 0.8rem;
  white-space: nowrap;
}

textarea {
  width: 100%;
  min-height: 220px;
  resize: vertical;
  padding: 18px;
  border: 1px solid #aeb4bc;
  border-radius: 12px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.9);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1rem;
  line-height: 1.55;
}

textarea[readonly] {
  background: #edf2f7;
}

textarea:focus,
button:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}

.swap-button {
  width: 42px;
  height: 42px;
  align-self: center;
  margin-top: 28px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ink);
  background: var(--white);
  font-size: 1.25rem;
  font-weight: 900;
}

.swap-button:hover {
  color: var(--white);
  background: var(--ink);
}

.action-row {
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
}

.primary-button,
.secondary-button {
  min-height: 46px;
  padding: 11px 18px;
  border-radius: 10px;
  font-weight: 820;
}

.primary-button {
  border: 2px solid var(--ink);
  color: var(--ink);
  background: var(--signal);
  box-shadow: 3px 3px 0 var(--ink);
}

.primary-button:not(:disabled):hover {
  transform: translate(1px, 1px);
  box-shadow: 2px 2px 0 var(--ink);
}

.primary-button.is-success {
  color: var(--white);
  background: var(--green);
}

.secondary-button {
  border: 1px solid var(--ink);
  color: var(--ink);
  background: var(--white);
}

.action-status {
  min-height: 24px;
  margin: 0 0 0 auto;
  color: var(--green);
  font-size: 0.88rem;
  font-weight: 750;
}

.cipher-key {
  margin-top: 28px;
  border-top: 1px solid var(--line);
}

.cipher-key summary {
  padding: 18px 0 6px;
  font-weight: 800;
  cursor: pointer;
}

.key-table-wrap {
  overflow-x: auto;
  padding: 12px 0 8px;
}

table {
  min-width: 890px;
  border-collapse: collapse;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8rem;
}

caption {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

th,
td {
  min-width: 31px;
  padding: 7px;
  border: 1px solid var(--line);
  text-align: center;
}

th {
  position: sticky;
  left: 0;
  color: var(--white);
  background: var(--ink);
}

.privacy-note {
  margin: 20px 0 0;
  padding: 12px 14px;
  border-left: 4px solid var(--green);
  color: #405065;
  background: rgba(37, 132, 95, 0.08);
  font-size: 0.9rem;
}

.content-section {
  padding: 96px 20px;
}

.section-heading {
  max-width: 720px;
  margin-bottom: 34px;
}

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

h2 {
  margin-bottom: 18px;
  font-size: clamp(2rem, 4.8vw, 3.6rem);
}

h3 {
  margin-bottom: 8px;
  font-size: 1.14rem;
}

.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.steps li {
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--white);
  box-shadow: 0 10px 30px rgba(7, 24, 46, 0.06);
}

.steps p {
  margin-bottom: 0;
  color: var(--ink-soft);
}

.step-number {
  display: block;
  margin-bottom: 30px;
  color: var(--red);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8rem;
  font-weight: 900;
}

.split-section {
  display: grid;
  grid-template-columns: 1.35fr 0.8fr;
  align-items: center;
  gap: clamp(50px, 8vw, 110px);
  border-top: 1px solid #e5dcc2;
}

.split-section > div:first-child > p:not(.eyebrow),
.text-columns p {
  color: var(--ink-soft);
}

.example-note {
  position: relative;
  min-height: 280px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 34px;
  border: 1px solid #d2c69f;
  color: var(--ink);
  background:
    linear-gradient(rgba(7, 24, 46, 0.055) 1px, transparent 1px) 0 0 / 100% 28px,
    #fff8d9;
  box-shadow: 10px 12px 0 var(--signal), 0 20px 40px rgba(7, 24, 46, 0.12);
  transform: rotate(2deg);
}

.example-note::before {
  content: "TOP SECRET";
  position: absolute;
  top: -20px;
  right: 18px;
  padding: 7px 13px;
  border: 3px solid var(--red);
  color: var(--red);
  font-size: 0.78rem;
  font-weight: 950;
  letter-spacing: 0.1em;
  transform: rotate(-6deg);
}

.note-label {
  color: #6b5f40;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.note-code {
  margin: 18px 0 38px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  font-weight: 850;
}

.note-answer {
  margin: 0;
  color: #6b5f40;
  font-size: 0.86rem;
}

.explainer-section {
  border-block: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--white);
  background: var(--ink);
}

.explainer-section .eyebrow {
  color: var(--signal);
}

.text-columns {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 50px;
}

.text-columns p {
  margin: 0;
  color: #c9d5e4;
}

.faq-list {
  border-top: 1px solid var(--line);
}

.faq-list details {
  border-bottom: 1px solid var(--line);
}

.faq-list summary {
  padding: 22px 42px 22px 0;
  font-size: 1.05rem;
  font-weight: 820;
  cursor: pointer;
}

.faq-list p {
  max-width: 780px;
  padding: 0 0 24px;
  color: var(--ink-soft);
}

.site-footer {
  justify-content: space-between;
  gap: 32px;
  padding-block: 48px;
  color: #c9d5e4;
}

.footer-brand {
  margin-bottom: 8px;
  color: var(--white);
}

.site-footer p {
  margin: 0;
  font-size: 0.9rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 20px;
  font-size: 0.88rem;
}

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

.noscript-message {
  position: fixed;
  inset: auto 16px 16px;
  z-index: 20;
  padding: 14px 18px;
  border-radius: 10px;
  color: var(--ink);
  background: var(--signal);
  box-shadow: var(--shadow);
  font-weight: 750;
}

@media (max-width: 820px) {
  .maker-shell {
    padding-top: 52px;
  }

  .cipher-options {
    grid-template-columns: repeat(3, 1fr);
  }

  .message-grid {
    grid-template-columns: 1fr;
  }

  .swap-button {
    margin: 0 auto;
    transform: rotate(90deg);
  }

  .steps,
  .split-section,
  .text-columns {
    grid-template-columns: 1fr;
  }

  .split-section {
    gap: 54px;
  }
}

@media (max-width: 620px) {
  .header-inner,
  .site-footer {
    width: min(100% - 28px, 1180px);
  }

  .header-inner {
    min-height: 68px;
  }

  nav {
    display: none;
  }

  .maker-shell {
    padding-inline: 14px;
  }

  .maker-card {
    padding: 20px 15px 24px;
  }

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

  .segmented-control {
    width: 100%;
  }

  .mode-button {
    flex: 1;
  }

  .cipher-options {
    grid-template-columns: repeat(2, 1fr);
  }

  .cipher-button {
    min-height: 62px;
  }

  textarea {
    min-height: 180px;
  }

  .action-status {
    width: 100%;
    margin-left: 0;
  }

  .content-section {
    padding: 72px 20px;
  }

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .footer-links {
    justify-content: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }
}

@media print {
  body {
    color: #000;
    background: #fff;
  }

  .site-header,
  .intro,
  .mode-row,
  .cipher-picker,
  .field-group:first-child,
  .swap-button,
  .action-row,
  .privacy-note,
  .content-section,
  .site-footer,
  .maker-card::after {
    display: none !important;
  }

  main,
  .maker-shell,
  .maker-card {
    padding: 0;
    color: #000;
    background: #fff;
    box-shadow: none;
  }

  .maker-card::before {
    content: "SecretCode.me • " attr(data-print-title);
    display: block;
    margin-bottom: 24px;
    font-size: 22pt;
    font-weight: 850;
  }

  .message-grid {
    display: block;
  }

  .field-group:last-child {
    display: block;
  }

  textarea[readonly] {
    min-height: 240px;
    border: 2px solid #000;
    color: #000;
    background: #fff;
  }

  .cipher-key {
    display: block;
    border-top: 0;
  }

  .cipher-key summary {
    display: none;
  }

  .cipher-key > div {
    display: block;
  }
}
