:root {
  color-scheme: light;
  --paper: #f5f2e9;
  --surface: #fffcf6;
  --ink: #132642;
  --muted: #526075;
  --line: #d4d4ce;
  --ocean: #142b4b;
  --light-blue: #c2d3e9;
  --accent: #355f94;
  --serif: Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono: "SFMono-Regular", Consolas, monospace;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--paper); font: 16px/1.5 var(--sans); }
button, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .54; }
a { color: inherit; }
:focus-visible { outline: 2px solid #3461a0; outline-offset: 4px; }
[hidden] { display: none !important; }
.visually-hidden, .skip:not(:focus) {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}
.skip:focus { position: absolute; z-index: 5; top: 10px; left: 10px; background: white; padding: .65rem; }
.frame { width: min(1120px, calc(100% - 72px)); margin-inline: auto; }
.header { border-bottom: 1px solid var(--line); }
.header-inner { display: flex; min-height: 70px; justify-content: space-between; align-items: center; gap: 1rem; }
.brand { display: flex; gap: .65rem; align-items: center; text-decoration: none; font-weight: 760; letter-spacing: -.035em; }
.brand-mark {
  font: 24px/1 var(--serif); width: 34px; height: 34px; display: grid; place-items: center;
  border-radius: 9px; background: var(--ink); color: white; padding-bottom: 2px;
}
.brand-tool { margin-left: .5rem; border-left: 1px solid #b7bec7; padding-left: .55rem; color: var(--muted); font-weight: 520; }
.nav-link, .footer a { text-decoration: none; font-weight: 650; }
.nav-link:hover, .footer a:hover { text-decoration: underline; }
.nav-link span { margin-left: .28rem; }
.intro { display: flex; align-items: end; justify-content: space-between; gap: 1rem; min-height: 236px; padding: 45px 0 33px; }
.intro-heading { min-width: 0; }
.kicker { margin: 0 0 12px; font: 650 .73rem/1.4 var(--sans); text-transform: uppercase; letter-spacing: .12em; color: var(--accent); }
h1 { margin: 0; font: 400 clamp(2.4rem, 6.5vw, 5.55rem)/1.02 var(--serif); letter-spacing: -.07em; }
.intro-copy { margin: 14px 0 0; color: var(--muted); }
.type-example {
  flex: none; align-self: center; display: grid; text-decoration: none; padding: 9px 0 6px 20px;
  border-left: 1px solid #9eabc0; transition: border-color .2s;
}
.type-example:hover { border-color: var(--ink); }
.type-example > [lang] { font: italic 400 clamp(1.8rem, 4vw, 3.35rem)/1.15 var(--serif); color: #365478; }
.type-meta { text-align: right; margin-top: .25rem; font: .79rem/1.6 var(--mono); color: var(--muted); }
.type-meta span { color: var(--accent); margin-right: .4rem; }
.editor { min-width: 0; }
.toolbar {
  display: flex; justify-content: space-between; align-items: center; gap: .75rem;
  border-top: 1px solid var(--line); padding: .85rem 0;
}
.mode-control, .language-control { display: flex; align-items: center; gap: .3rem; }
.mode-control { border: 1px solid #c9cbd0; border-radius: 9px; padding: .22rem; background: #eeece5; }
.mode-control button, .swap {
  border: 1px solid transparent; border-radius: 6px; padding: .42rem .78rem; white-space: nowrap; background: transparent; font-weight: 650;
}
.mode-control button[aria-pressed=true] { color: white; background: var(--ink); }
.mode-control button[aria-pressed=false]:hover { background: #dfe5ec; }
.language-control { gap: .6rem; font-size: .9rem; }
.language-control label { color: var(--muted); }
.language-control select, .swap {
  min-height: 40px; border: 1px solid #bbbfc8; background: var(--surface); border-radius: 8px; padding-inline: .55rem;
}
.swap { flex: none; width: 42px; font-size: 1.2rem; padding: .16rem .55rem; }
.swap:not(:disabled):hover { background: #e7edf6; }
.pad-grid { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.pad { display: flex; flex-direction: column; min-width: 0; min-height: 300px; border: 1px solid transparent; border-radius: 14px; }
.source-pad {
  position: relative; isolation: isolate; overflow: hidden;
  background: linear-gradient(var(--surface), var(--surface)) padding-box,
    linear-gradient(125deg, #a9b4c4, #d3d8df 55%, #bdc8d8) border-box;
  transition: box-shadow .25s;
}
.source-pad[data-has-draft=true] {
  background: linear-gradient(var(--surface), var(--surface)) padding-box,
    linear-gradient(125deg, #476f9c, #bfcbd9 62%, #879fb8) border-box;
}
.source-pad:focus-within, .editor[aria-busy=true] .source-pad {
  box-shadow: 0 0 0 2px #426e9e26, 0 9px 28px #294b7b1c;
}
.source-pad::after {
  position: absolute; content: ""; top: 0; left: 0; width: 40%; height: 2px; pointer-events: none;
  background: linear-gradient(90deg, transparent, #3b80d2, #74b3b7, transparent);
  opacity: 0; transform: translateX(-32%); filter: drop-shadow(0 1px 4px #4b88c0);
}
.editor[aria-busy=true] .source-pad::after {
  opacity: .7; animation: form-sweep 2.65s ease-in-out infinite alternate;
}
@keyframes form-sweep {
  from { opacity: .33; transform: translateX(-32%); }
  to { opacity: .92; transform: translateX(170%); }
}
.result-pad { background: var(--ocean); color: #f7f3e7; border-color: #223e61; }
.pad-head, .pad-foot {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap;
  min-height: 56px; gap: .35rem .5rem; margin-inline: 16px;
}
.pad-head { border-bottom: 1px solid #d6dbe1; }
.pad-head label { font-weight: 720; font-size: .92rem; }
.pad-actions { display: flex; align-items: center; gap: .48rem; }
.text-action {
  border: 0; padding: .45rem .25rem; background: transparent; color: var(--accent); font-size: .83rem; font-weight: 630;
}
.text-action:not(:disabled):hover { text-decoration: underline; }
.result-pad .text-action, .result-pad textarea::placeholder, .result-pad .pad-foot { color: var(--light-blue); }
.result-pad .pad-head, .result-pad .pad-foot { border-color: #ffffff3b; }
.result-pad :focus-visible { outline-color: #a9d1ff; }
.pad textarea {
  display: block; width: calc(100% - 32px); margin: 0 16px; flex: 1; min-height: 180px; resize: vertical;
  padding: 14px 1px; border: 0; outline: 0; background: transparent; line-height: 1.62; font-size: 1.05rem;
}
.pad textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.result-pad textarea:focus-visible { outline-color: #a9d1ff; }
.pad textarea::placeholder { color: #5c697a; opacity: 1; }
.pad-foot { border-top: 1px solid #d6dbe1; color: var(--muted); font: .75rem/1.4 var(--mono); }
.copy {
  border: 1px solid #adc2dc; border-radius: 7px; padding: .42rem .7rem;
  color: #142b4b; background: #e5ecf5; font: 670 .84rem/1.45 var(--sans);
}
.copy:not(:disabled):hover { background: white; }
.copy span { padding-right: .1rem; }
.form-foot {
  display: flex; align-items: baseline; justify-content: space-between; gap: .75rem;
  padding-top: .75rem;
}
.mode-note { margin: 0; color: var(--muted); font-size: .86rem; }
.server-action {
  border: 0; padding: .33rem 0 .33rem .25rem; background: transparent;
  color: var(--accent); font-size: .83rem; font-weight: 670; text-align: right;
}
.server-action:not(:disabled):hover { text-decoration: underline; }
.challenge { margin: .7rem 0; padding: .8rem 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; }
.challenge p { margin: 0 0 .4rem; font-size: .85rem; }
#widget { max-width: 100%; min-height: 1px; }
.status { min-height: 1.4rem; margin: .25rem 0 .35rem; color: var(--muted); font-size: .88rem; }
.status[data-error=true] { color: #852c22; }
.rules { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.rules summary {
  display: flex; justify-content: space-between; align-items: center; min-height: 50px; gap: 1rem;
  list-style: none; cursor: pointer; font-weight: 680;
}
.rules summary::-webkit-details-marker { display: none; }
.rules summary span { font: 1.5rem var(--serif); }
.rules[open] summary span { transform: rotate(45deg); }
.rules p { margin: 0 0 .7rem; font-size: .9rem; color: var(--muted); }
.rules table { width: min(100%, 410px); margin-bottom: 1rem; border-collapse: collapse; text-align: left; }
.rules th, .rules td { padding: .22rem .6rem; border-bottom: 1px solid var(--line); }
.rules td { font-family: var(--mono); overflow-wrap: anywhere; }
.footer { display: flex; justify-content: space-between; gap: .5rem; padding-block: 22px; color: var(--muted); font-size: .82rem; }
@media (max-width: 760px) {
  .frame { width: calc(100% - 36px); }
  .intro { min-height: 0; padding-block: 34px 23px; }
  .pad { min-height: 240px; }
  .pad textarea { min-height: 124px; }
}
@media (max-width: 560px) {
  .header-inner { min-height: 60px; }
  .type-example { display: none; }
  .intro-copy { font-size: .93rem; }
  .pad-grid { grid-template-columns: minmax(0, 1fr); }
  .toolbar { align-items: flex-start; flex-wrap: wrap; }
  .pad { min-height: 210px; }
  .pad-head, .pad-foot { min-height: 47px; margin-inline: 12px; }
  .pad textarea { width: calc(100% - 24px); margin-inline: 12px; }
  .challenge { padding-inline: .3rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .editor[aria-busy=true] .source-pad::after { transform: translateX(85%); }
}
