@layer base, layout, components, themes;

@layer base {
  :root { --canvas:color-mix(in srgb, var(--hp-background) 98%, var(--hp-foreground)); --surface:var(--hp-card); --ink:var(--hp-foreground); --muted-foreground:var(--hp-muted-foreground); --border:var(--hp-border); --accent:var(--hp-primary); --accent-hover:color-mix(in srgb,var(--hp-primary) 85%,var(--hp-background)); --accent-soft:var(--hp-muted); --focus:var(--hp-ring); --success:#31755d; --danger:var(--hp-destructive); --inspector:#171717; --inspector-ink:#fafafa; --inspector-muted:#a3a3a3; --radius:var(--hp-radius); --font:ui-sans-serif,system-ui,sans-serif; --mono:"SFMono-Regular",Consolas,"Liberation Mono",monospace; --hp-font-family:var(--font); }
  * { box-sizing:border-box; }
  html { scroll-behavior:smooth; scroll-padding-top:28px; }
  body { margin:0; background:var(--canvas); color:var(--ink); font:15px/1.55 var(--font); -webkit-font-smoothing:antialiased; }
  button,input,select { font:inherit; }
  button,a,input,select { -webkit-tap-highlight-color:transparent; }
  button { cursor:pointer; }
  button:disabled { cursor:not-allowed; }
  a { color:inherit; text-decoration:none; }
  a:hover { text-decoration:underline; text-underline-offset:4px; }
  :focus-visible { outline:3px solid var(--focus); outline-offset:3px; }
  h1,h2,p { margin:0; }
  code,pre { font-family:var(--mono); }
  [hidden] { display:none !important; }
  .visually-hidden,.skip-link:not(:focus) { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; border:0; }
  .skip-link:focus { position:fixed; z-index:10; top:12px; left:12px; padding:10px 16px; border-radius:6px; background:var(--accent); color:var(--hp-primary-foreground); }
}

@layer layout {
  .masthead { max-width:1280px; margin:auto; min-height:100px; padding:20px 48px; display:flex; align-items:center; flex-wrap:wrap; gap:20px; }
  .masthead-actions { display:flex; flex-wrap:wrap; align-items:center; gap:20px; margin-left:auto; }
  main { max-width:1280px; margin:auto; padding:35px 48px 0; }
  .intro { display:flex; align-items:flex-start; justify-content:space-between; gap:24px; margin-bottom:35px; }
  .intro h1 { font-size:clamp(30px,3.3vw,43px); font-weight:650; letter-spacing:-1.7px; line-height:1.17; margin-bottom:12px; }
  .intro p { max-width:620px; color:var(--muted-foreground); font-size:15px; }
  .playground-grid { display:grid; grid-template-columns:minmax(0,1.2fr) minmax(0,1fr); gap:32px; align-items:start; }
  .form-pane { min-width:0; background:var(--surface); border:1px solid var(--border); border-radius:16px; padding:26px 28px 0; }
  .pane-heading { display:flex; align-items:center; justify-content:space-between; gap:20px; margin-bottom:27px; }
  .pane-heading h2,.inspector h2 { font-size:16px; font-weight:650; letter-spacing:-.25px; }
  fieldset { border:0; padding:0; margin:0; min-width:0; }
  .field { min-width:0; margin-bottom:26px; }
  .paired-fields { display:grid; grid-template-columns:1fr 1fr; gap:20px; }
  .field-heading { display:flex; align-items:baseline; justify-content:space-between; flex-wrap:wrap; gap:3px 10px; margin-bottom:9px; }
  .switch-field { display:flex; justify-content:space-between; align-items:center; gap:20px; padding-top:1px; padding-bottom:25px; }
  .switch-control { display:flex; flex-direction:column; align-items:flex-end; gap:9px; }
  .form-actions { display:flex; gap:10px; border-top:1px solid var(--border); padding-top:22px; }
  .inspector-column { min-width:0; position:sticky; top:24px; }
  .explanation { display:grid; grid-template-columns:minmax(0,1.2fr) minmax(0,1fr); gap:60px; border-top:1px solid var(--border); margin-top:62px; padding:38px 0 42px; }
  .explanation-copy { max-width:490px; }
  footer { max-width:1280px; padding:24px 48px 34px; margin:auto; border-top:1px solid var(--border); display:flex; justify-content:space-between; gap:20px; font-size:12px; color:var(--muted-foreground); }
}

@layer components {
  .wordmark { position:relative; display:inline-flex; align-items:baseline; font-size:31px; font-weight:750; line-height:1; letter-spacing:-2px; }
  .wordmark:hover { text-decoration:none; }
  .wordmark span { color:var(--accent); }
  .masthead-label { border-left:1px solid var(--border); padding-left:25px; color:var(--muted-foreground); font-size:13px; }
  .theme-picker { display:flex; align-items:center; gap:10px; font-size:12px; color:var(--muted-foreground); }
  .theme-picker select { border:1px solid var(--border); border-radius:6px; background:var(--surface); color:var(--ink); padding:6px 23px 6px 9px; font-size:12px; }
  .text-link { display:inline-flex; align-items:center; gap:4px; font-size:13px; line-height:20px; font-weight:500; }
  .preview-label { display:inline-flex; align-items:center; gap:7px; flex-shrink:0; margin-top:8px; border:1px solid var(--border); border-radius:99px; padding:5px 10px; color:var(--muted-foreground); font-size:11px; }
  .preview-label>span { width:5px; height:5px; border-radius:50%; background:var(--accent); }
  .quiet-button { display:inline-flex; align-items:center; gap:6px; line-height:20px; border:0; background:transparent; padding:5px 0 5px 5px; color:var(--muted-foreground); font-size:13px; }
  .quiet-button:hover { color:var(--accent); }
  .field label,.switch-field label { font-size:14px; line-height:20px; font-weight:500; cursor:pointer; }
  .field-heading code,.switch-control code { color:var(--muted-foreground); font-size:11px; line-height:16px; font-weight:400; }
  h6-iban,h6-bic,h6-otp { display:block; }
  .was-validated h6-iban:invalid::part(input),.was-validated h6-bic:invalid::part(input),.was-validated h6-otp:invalid::part(input) { border-color:var(--danger); }
  .feedback { font-size:12px; line-height:18px; color:var(--muted-foreground); margin-top:7px; min-height:17px; }
  .feedback[data-state=valid] { color:var(--success); }
  .feedback[data-state=invalid] { color:var(--danger); }
  .paired-fields .feedback { min-height:34px; }
  .tags-field { margin-bottom:24px; }
  .switch-field .feedback { margin-top:3px; }
  .submission-status { color:var(--muted-foreground); margin-top:10px; margin-bottom:21px; font-size:11px; min-height:18px; }
  .experiment-bar { display:flex; align-items:center; justify-content:space-between; gap:12px; background:var(--canvas); padding:14px 28px; margin:0 -28px; border-top:1px solid var(--border); border-radius:0 0 16px 16px; font-size:11px; color:var(--muted-foreground); }
  .experiment-bar label { display:flex; align-items:center; gap:7px; cursor:pointer; color:var(--ink); }
  .experiment-bar input { width:13px; height:13px; accent-color:var(--accent); margin:0; }
  .inspector { background:var(--inspector); color:var(--inspector-ink); border:1px solid #ffffff10; border-radius:16px; overflow:hidden; }
  .inspector-heading { display:flex; align-items:center; justify-content:space-between; gap:10px; padding:26px 24px 20px; }
  .data-title { display:flex; align-items:center; gap:10px; }
  .live-light { width:6px; height:6px; border-radius:50%; background:#d4d4d4; box-shadow:0 0 0 4px #ffffff12; }
  .entry-count { font-size:10px; color:#d4d4d4; background:#ffffff0b; border:1px solid #ffffff13; padding:3px 8px; border-radius:5px; white-space:nowrap; }
  .inspector-toolbar { display:flex; align-items:center; justify-content:space-between; gap:12px; border-bottom:1px solid #ffffff0d; padding:0 24px 16px; }
  .view-switch { display:flex; gap:3px; }
  .view-switch button { padding:5px 10px; background:transparent; border:1px solid transparent; border-radius:5px; color:var(--inspector-muted); font-size:11px; }
  .view-switch button[aria-pressed=true] { border-color:#ffffff15; color:var(--inspector-ink); background:#ffffff0a; }
  .reading-label { color:var(--inspector-muted); font-family:var(--mono); font-size:9px; white-space:nowrap; }
  .data-view { padding:10px 24px 20px; min-height:302px; max-height:min(58vh,560px); overflow:auto; }
  .data-view table { border-collapse:collapse; text-align:left; width:100%; font-family:var(--mono); font-size:11px; }
  .data-view th { font:10px var(--font); font-weight:500; color:var(--inspector-muted); padding:10px 0; }
  .data-view td { padding:13px 0; border-top:1px solid #ffffff0a; vertical-align:top; }
  .data-view td:first-child { color:#d4d4d4; padding-right:18px; width:26%; }
  .data-view td:last-child { color:#fafafa; word-break:break-all; }
  .inspector-status { display:flex; justify-content:space-between; gap:12px; padding:15px 24px; font-size:10px; color:var(--inspector-muted); border-top:1px solid #ffffff12; }
  #validity-status { display:inline-flex; align-items:center; gap:7px; color:#b8dcca; }
  #validity-status[data-state=invalid] { color:#f0b7a9; }
  #validity-status[data-state=disabled] { color:var(--inspector-muted); }
  .status-dot { display:inline-block; width:5px; height:5px; border-radius:50%; background:currentColor; }
  #last-event { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .json-code { margin:13px 0 0; font-size:11px; line-height:2; color:#a3a3a3; white-space:pre-wrap; overflow-wrap:anywhere; }
  .json-key { color:#d4d4d4; }
  .json-string { color:#c4e3ce; }
  .json-number { color:#ecd5a2; }
  .json-note { color:var(--inspector-muted); font-size:10px; margin-top:14px; }
  .empty-data { font-size:12px; line-height:1.8; color:var(--inspector-muted); max-width:260px; margin:55px auto; text-align:center; }
  .inspector-note { display:flex; align-items:flex-start; gap:11px; padding:18px 6px; color:var(--muted-foreground); font-size:11px; }
  .inspector-note svg { width:20px; height:20px; flex-shrink:0; color:var(--accent); }
  .inspector-note p { max-width:330px; }
  .last-submission { border-top:1px solid var(--border); padding:15px 6px; color:var(--muted-foreground); font-size:12px; }
  .last-submission summary { cursor:pointer; }
  .last-submission pre { white-space:pre-wrap; overflow-wrap:anywhere; font-size:10px; }
  .explanation h2 { font-size:22px; line-height:1.35; letter-spacing:-.6px; font-weight:600; max-width:360px; margin-bottom:13px; }
  .explanation p { font-size:13px; color:var(--muted-foreground); max-width:440px; }
  .explanation .scope-note { margin-top:16px; font-size:11px; }
  .markup-example { background:var(--hp-muted); border-radius:10px; padding:19px 22px; min-width:0; align-self:start; }
  .markup-title { color:var(--foreground); font-size:10px; margin-bottom:12px; }
  .markup-example pre { margin:0; font-size:11px; line-height:1.85; white-space:pre-wrap; overflow-wrap:anywhere; color:var(--ink); }
  .noscript-note { padding:20px; color:var(--danger); }
}

@layer themes {
  html[data-theme=dark] { --success:#86c7a8; --inspector:#111111; }
  html[data-palette=utility] { --font:"Segoe UI",Arial,sans-serif; }
  @media (max-width:1050px) { .masthead { padding-inline:28px; } main { padding-inline:28px; } .playground-grid { gap:22px; grid-template-columns:minmax(0,1.1fr) minmax(0,1fr); } .form-pane { padding-inline:22px; } .experiment-bar { margin-inline:-22px; padding-inline:22px; } .paired-fields { gap:14px; } .field-heading code { font-size:10px; } .reading-label { display:none; } footer { margin-inline:28px; padding-inline:0; } }
  @media (max-width:820px) { .playground-grid { grid-template-columns:1fr; } .inspector-column { position:static; } .inspector { border-radius:14px; } .data-view { min-height:0; padding-bottom:22px; } .paired-fields { gap:22px; } .explanation { gap:28px; grid-template-columns:1fr 1fr; margin-top:40px; } .intro { margin-bottom:26px; } .masthead-actions { gap:16px; } .preview-label { display:none; } }
  @media (max-width:540px) { .masthead { height:81px; padding-inline:20px; gap:17px; } .masthead-label { padding-left:17px; font-size:11px; } .masthead-actions { gap:8px; } .theme-picker { font-size:0; } .theme-picker select { font-size:11px; padding-right:18px; } .text-link:not(.recipes-link) { display:none; } .masthead-label { display:none; } main { padding:25px 20px 0; } .intro h1 { font-size:32px; letter-spacing:-1.3px; max-width:300px; } .intro p { font-size:13px; } .form-pane { padding:22px 20px 0; } .paired-fields { grid-template-columns:1fr; gap:0; } .paired-fields .feedback { min-height:17px; } .field { margin-bottom:24px; } .pane-heading { margin-bottom:25px; } .switch-control code { display:none; } .experiment-bar { margin-inline:-20px; padding:14px 20px; flex-wrap:wrap; gap:4px 12px; } .experiment-bar>span { font-size:10px; } .inspector-heading { padding:23px 20px 18px; } .inspector-toolbar { padding-inline:20px; } .data-view { padding-inline:20px; } .inspector-status { padding-inline:20px; } .explanation { grid-template-columns:1fr; margin-top:32px; padding-top:29px; padding-bottom:32px; } .explanation h2 { font-size:23px; } footer { margin-inline:20px; flex-direction:column; gap:5px; padding-top:20px; font-size:10px; } }
  @media (prefers-reduced-motion:reduce) { html { scroll-behavior:auto; } * { transition:none !important; } }
}
@layer components {
.icon { display:inline-flex; align-items:center; justify-content:center; flex:none; width:1rem; height:1rem; line-height:1; vertical-align:middle; }
.icon svg { display:block; width:100%; height:100%; }
.quiet-button .icon { width:.875rem; height:.875rem; }
.field-section { display: flex; align-items: center; gap: 10px; margin: 8px 0 22px; font: 11px var(--mono); color: var(--accent, #171717); }
.field-section span { font: 11px var(--font); letter-spacing: .05em; text-transform: uppercase; color: var(--muted-foreground, #666666); }
.field-section:not(:first-of-type) { margin-top: 26px; padding-top: 24px; border-top: 1px solid var(--border, #d4d4d4); }
}

@layer components {
  .component-label, .recipe-label { font-size: 14px; line-height: 20px; font-weight: 500; }
  .recipe-label { margin-bottom: 8px; }
  .native-field { display: grid; gap: 6px; min-width: 0; font-size: 14px; line-height: 20px; font-weight: 500; }
}

@layer components {
  .theme-source { margin: 12px 0 0; border-top: 1px solid var(--border); padding: 15px 6px; font-size: 12px; color: var(--muted-foreground); }
  .theme-source summary { color: var(--ink); cursor: pointer; }
  .theme-source p { margin-top: 12px; }
  .theme-source a { text-decoration: underline; text-underline-offset: 3px; }
  .theme-source pre { max-height: 300px; overflow: auto; padding: 16px; margin-bottom: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--ink); font-size: 11px; line-height: 1.7; }
}

@layer themes {
  @media (max-width: 1050px) {
    .masthead { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); height: auto; padding-block: 22px; gap: 18px; }
    .masthead-label { display: none; }
    .masthead-actions { display: contents; }
    .masthead .wordmark { grid-column: 1 / 3; grid-row: 1; justify-self: start; }
    .masthead .recipes-link { grid-column: 3 / 5; grid-row: 1; justify-self: end; }
    .masthead .theme-picker { grid-row: 2; flex-direction: column; align-items: stretch; gap: 6px; width: 100%; min-width: 0; font-size: 11px; }
    .masthead .theme-picker select { width: 100%; min-width: 0; font-size: 12px; }
  }
  @media (max-width: 540px) {
    .masthead { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .masthead .wordmark { grid-column: 1; }
    .masthead .recipes-link { grid-column: 2; }
    .masthead .theme-picker { grid-row: auto; }
  }
}

/* Ordinary fields and action buttons share the component surface roles. */
@layer components {
  .theme-picker select { box-shadow: var(--hp-shadow-raised, inset 0 1px 1px light-dark(rgb(255 255 255 / .14), rgb(255 255 255 / .08)), inset 0 -1px 0 light-dark(rgb(0 0 0 / .1), rgb(0 0 0 / .3)), inset 0 -6px 8px -6px light-dark(rgb(0 0 0 / .14), rgb(255 255 255 / .06)), 0 1px 2px light-dark(rgb(0 0 0 / .08), rgb(0 0 0 / .25))); }
  @media (forced-colors: active) { .native-field input, .theme-picker select { box-shadow: none; } }
}

@layer components {
  .selection-table { width:100%; border-collapse:collapse; font-size:13px; }
  .selection-table th,.selection-table td { padding:.625rem .5rem; text-align:start; border-bottom:1px solid var(--border); }
  .selection-table th:first-child,.selection-table td:first-child { width:2.5rem; }
  .selection-table thead th { color:var(--muted-foreground); font-weight:500; }
  .selection-table tbody th { font-weight:500; }
  .selection-table td:last-child { color:var(--muted-foreground); }
  .action-heading { margin-block:1.25rem .5rem; }
  .recipe-form:has(.hp-button) { display:flex; flex-wrap:wrap; gap:.5rem; align-items:center; }
  .recipe-form:has(.hp-button) .recipe-label { flex-basis:100%; }
}
