:root {
      color-scheme: light;
      --paper: #f3f5ec;
      --panel: #fffef9;
      --ink: #1d3028;
      --muted: #617067;
      --line: #cbd3c8;
      --accent: #c64f35;
      --accent-dark: #9f3825;
      --success: #256346;
      --error-bg: #fce8e1;
      font-family: "Avenir Next", Avenir, "Segoe UI", sans-serif;
    }

    * { box-sizing: border-box; }

    body {
      min-height: 100vh;
      margin: 0;
      color: var(--ink);
      background-color: var(--paper);
      background-image:
        linear-gradient(rgba(29, 48, 40, 0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(29, 48, 40, 0.045) 1px, transparent 1px);
      background-size: 28px 28px;
    }

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

    header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      min-height: 76px;
      border-bottom: 1px solid var(--line);
    }

    .brand { font-size: 14px; font-weight: 800; letter-spacing: 0.08em; }
    .brand span { color: var(--accent); }
    .local-note { color: var(--muted); font-size: 12px; font-weight: 700; }

    main { padding: 54px 0 42px; }
    .intro { max-width: 680px; margin-bottom: 28px; }
    .eyebrow { color: var(--accent-dark); font-size: 12px; font-weight: 800; text-transform: uppercase; }
    h1 { margin: 10px 0 8px; font: 400 44px/1.08 Georgia, "Times New Roman", serif; }
    .intro p { margin: 0; color: var(--muted); line-height: 1.6; }

    .workspace {
      overflow: hidden;
      border: 1px solid var(--line);
      border-radius: 6px;
      background: var(--panel);
      box-shadow: 5px 5px 0 rgba(29, 48, 40, 0.09);
    }

    .editors { display: grid; grid-template-columns: 1fr 1fr; }
    .editor { min-width: 0; padding: 18px; }
    .editor + .editor { border-left: 1px solid var(--line); }
    .editor-heading { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 12px; }
    label { font-size: 13px; font-weight: 800; }
    .state { color: var(--muted); font-size: 11px; }

    textarea {
      display: block;
      width: 100%;
      min-height: 310px;
      resize: vertical;
      padding: 14px;
      border: 1px solid var(--line);
      border-radius: 4px;
      outline: none;
      background: #fbfcf7;
      color: var(--ink);
      font: 13px/1.65 Menlo, Monaco, Consolas, monospace;
      tab-size: 2;
    }

    textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(198, 79, 53, 0.15); }
    textarea::placeholder { color: #89968d; }
    .error {
      margin: 14px 18px 0;
      padding: 14px 14px 12px;
      border-left: 4px solid var(--accent);
      border-radius: 6px;
      background: linear-gradient(180deg, #fdf2ed 0%, var(--error-bg) 100%);
      color: #762f20;
      font-size: 13px;
      box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
    }
    .error p { margin: 0; }
    .error-location { margin-top: 5px !important; font-size: 12px; }
    .error-context {
      overflow-x: auto;
      margin: 10px 0 0;
      padding: 10px 12px;
      border: 1px solid rgba(198, 79, 53, 0.14);
      border-radius: 5px;
      background: rgba(255, 255, 255, 0.72);
      font: 12px/1.6 Menlo, Monaco, Consolas, monospace;
      white-space: pre;
    }
    .error-pointer { color: var(--accent-dark); font-weight: 800; }
    .error-suggestion { margin-top: 8px !important; }
    .error .fix-button {
      min-height: 36px;
      margin-top: 12px;
      padding: 0 14px;
      border-radius: 999px;
      font-weight: 800;
      letter-spacing: 0.01em;
    }

    .notice {
      margin: 0 18px 14px;
      padding: 10px 12px;
      border: 1px solid rgba(37, 99, 70, 0.18);
      border-left: 4px solid var(--success);
      border-radius: 6px;
      background: rgba(229, 245, 236, 0.95);
      color: var(--success);
      font-size: 13px;
    }


    .repair-summary {
      margin: 0 18px 14px;
      padding: 10px 12px;
      border: 1px solid rgba(37, 99, 70, 0.18);
      border-left: 4px solid var(--success);
      border-radius: 6px;
      background: #f6fbf7;
      color: var(--success);
      font-size: 13px;
    }

    .repair-summary strong { display: inline-block; margin-bottom: 4px; }
    .repair-summary ul { margin: 6px 0 0 18px; padding: 0; }
    .repair-summary li { margin: 2px 0; }

    .error-highlight {
      outline: 2px solid rgba(198, 79, 53, 0.35);
      box-shadow: 0 0 0 3px rgba(198, 79, 53, 0.09);
    }

    .actions {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 14px 18px;
      border-top: 1px solid var(--line);
      background: #f7f8f2;
    }

    button {
      min-height: 40px;
      padding: 0 16px;
      border: 1px solid var(--ink);
      border-radius: 4px;
      background: transparent;
      color: var(--ink);
      font: inherit;
      font-size: 13px;
      font-weight: 700;
      cursor: pointer;
    }

    button.primary { border-color: var(--accent); background: var(--accent); color: white; }
    button.copy-button { min-height: 32px; padding: 0 10px; font-size: 12px; }
    button[disabled] { border-color: var(--line); background: #eef2ec; color: #8a958e; }
    button:disabled { cursor: not-allowed; opacity: 0.55; }
    button:hover { border-color: var(--accent-dark); }
    button:focus-visible { outline: 3px solid rgba(198, 79, 53, 0.3); outline-offset: 2px; }
    .hint { margin-left: auto; color: var(--muted); font-size: 12px; }
    footer { padding: 18px 0 28px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }

    @media (max-width: 700px) {
      .page { width: min(100% - 28px, 560px); }
      main { padding-top: 38px; }
      h1 { font-size: 36px; }
      .editors { grid-template-columns: 1fr; }
      .editor + .editor { border-top: 1px solid var(--line); border-left: 0; }
      textarea { min-height: 230px; }
      .actions { flex-wrap: wrap; }
      .hint { width: 100%; margin: 2px 0 0; }
    }

    @media (prefers-reduced-motion: no-preference) {
      main { animation: arrive 360ms ease-out both; }
      @keyframes arrive { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: translateY(0); } }
    }