:root {
  color-scheme: dark;
  --bg: #030303;
  --paper: #0b0b0b;
  --ink: #f7f7f0;
  --muted: #a7a7a0;
  --line: #383833;
  --rule: #5a5a50;
  --accent: #d8d8cc;
  --danger: #ffb4a2;
  --ok: #c6f6d5;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 50% -20%, rgba(255, 255, 255, 0.08), transparent 28rem),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 4px),
    var(--bg);
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
}

button,
input,
textarea {
  font: inherit;
}

.page-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 56px;
}

.hero {
  border-block: 4px double var(--rule);
  padding: clamp(28px, 7vw, 72px) 0;
}

.kicker,
.section-label {
  color: var(--muted);
  font-family: "Courier New", monospace;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 18px;
  color: #ffffff;
  font-size: clamp(3.25rem, 12vw, 8.75rem);
  line-height: 0.9;
  letter-spacing: 0;
  text-transform: uppercase;
}

h2 {
  margin-bottom: 16px;
  color: #ffffff;
  font-size: clamp(1.7rem, 4vw, 3rem);
  line-height: 1;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 0;
  color: #ffffff;
  font-family: "Courier New", monospace;
  font-size: 1rem;
  letter-spacing: 0;
  text-transform: uppercase;
}

.definition {
  display: grid;
  max-width: 900px;
  gap: 8px;
  margin-bottom: 0;
  font-size: clamp(1.15rem, 2.8vw, 2rem);
  line-height: 1.25;
}

.definition strong {
  color: #ffffff;
  font-size: clamp(1.6rem, 4vw, 3rem);
  font-weight: 900;
}

.pronunciation,
.part {
  color: var(--muted);
  font-family: "Courier New", monospace;
  font-size: 0.9rem;
}

.meaning {
  color: var(--ink);
  font-weight: 700;
}

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

.layout-grid {
  margin-top: 24px;
}

.panel {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.015));
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: clamp(18px, 3vw, 28px);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.025);
}

.explainer p {
  color: var(--accent);
  font-size: 1.04rem;
  line-height: 1.55;
}

.explainer p:last-child {
  margin-bottom: 0;
}

.video-frame {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border: 1px dashed var(--rule);
  background:
    linear-gradient(45deg, transparent 48%, rgba(255, 255, 255, 0.08) 49% 51%, transparent 52%),
    #050505;
}

.video-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.video-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-family: "Courier New", monospace;
  font-size: 0.85rem;
  line-height: 1.35;
}

.video-note a {
  color: #ffffff;
}

.tool {
  margin-top: 18px;
}

.tool-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
}

.key-field {
  display: grid;
  min-width: min(100%, 260px);
  gap: 8px;
  color: var(--muted);
  font-family: "Courier New", monospace;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
}

input,
textarea,
.output-box {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #050505;
  color: #ffffff;
  font-family: "Courier New", monospace;
  letter-spacing: 0;
}

input,
textarea {
  outline: none;
}

input:focus,
textarea:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.12);
}

input {
  padding: 14px 16px;
  font-size: 1.35rem;
  font-weight: 900;
}

.message {
  min-height: 28px;
  margin: 18px 0;
  color: var(--muted);
  font-family: "Courier New", monospace;
  font-size: 0.9rem;
}

.message.good {
  color: var(--ok);
}

.message.bad {
  color: var(--danger);
}

.square-wrap {
  display: grid;
  grid-template-columns: repeat(6, minmax(34px, 1fr));
  gap: 6px;
  max-width: 560px;
  margin-bottom: 22px;
}

.axis,
.cell {
  display: grid;
  min-height: 52px;
  place-items: center;
  border: 1px solid var(--line);
  font-family: "Courier New", monospace;
  font-weight: 900;
}

.axis {
  color: var(--muted);
  background: #080808;
}

.cell {
  color: #ffffff;
  background: #10100f;
  font-size: 1.35rem;
}

.cell.ij {
  outline: 2px solid var(--ink);
  outline-offset: -4px;
}

.workspace-grid {
  align-items: stretch;
}

.workspace {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.workspace-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

textarea {
  resize: vertical;
  min-height: 144px;
  padding: 14px;
  line-height: 1.5;
}

.output-box {
  display: block;
  min-height: 86px;
  overflow-wrap: anywhere;
  padding: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.copy-button {
  min-width: 74px;
  border: 1px solid var(--ink);
  border-radius: 4px;
  background: var(--ink);
  color: #050505;
  cursor: pointer;
  font-family: "Courier New", monospace;
  font-size: 0.82rem;
  font-weight: 900;
  padding: 9px 12px;
  text-transform: uppercase;
}

.copy-button:hover,
.copy-button:focus-visible {
  background: #ffffff;
}

.note {
  min-height: 22px;
  margin-bottom: 0;
  color: var(--muted);
  font-family: "Courier New", monospace;
  font-size: 0.85rem;
  line-height: 1.35;
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
  color: var(--muted);
  font-family: "Courier New", monospace;
  font-size: 0.82rem;
  line-height: 1.45;
}

.footer strong {
  flex: 0 0 auto;
  color: #ffffff;
}

@media (max-width: 760px) {
  .page-shell {
    width: min(100% - 20px, 1120px);
    padding-top: 18px;
  }

  .layout-grid,
  .workspace-grid {
    grid-template-columns: 1fr;
  }

  .tool-header {
    align-items: stretch;
    flex-direction: column;
  }

  .square-wrap {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 4px;
  }

  .axis,
  .cell {
    min-height: 44px;
  }

  .cell {
    font-size: 1.05rem;
  }

  .footer {
    display: grid;
  }
}
