:root {
      --bg: #f2f5f1;
      --fg: #18231f;
      --card: #ffffff;
      --muted: #728079;
      --acc: #27735d;
      --accfg: #ffffff;
      --line: #dde5df;
      --ok: #25805f;
      --no: #b34a43;
      color-scheme: light;
    }

    @media (prefers-color-scheme: dark) {
      :root:not([data-theme="light"]) {
        --bg: #121916;
        --fg: #edf3ef;
        --card: #1a2320;
        --muted: #9eaaa4;
        --acc: #65b89f;
        --accfg: #102019;
        --line: #2d3934;
        --ok: #78c7a6;
        --no: #ef9189;
        color-scheme: dark;
      }
    }

    :root[data-theme="dark"] {
      --bg: #121916;
      --fg: #edf3ef;
      --card: #1a2320;
      --muted: #9eaaa4;
      --acc: #65b89f;
      --accfg: #102019;
      --line: #2d3934;
      --ok: #78c7a6;
      --no: #ef9189;
      color-scheme: dark;
    }

    :root {
      box-sizing: border-box;
      padding-top: env(safe-area-inset-top, 0px);
      padding-bottom: env(safe-area-inset-bottom, 0px);
    }

    * { box-sizing: inherit; }

    body {
      margin: 0;
      min-height: 100vh;
      background:
        radial-gradient(circle at top left, rgba(39, 115, 93, 0.08), transparent 30rem),
        var(--bg);
      color: var(--fg);
      font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    }

    main {
      width: min(680px, calc(100% - 32px));
      margin: 0 auto;
      padding: 24px 0;
    }

    .app-header {
      display: flex;
      align-items: center;
      gap: 12px;
      margin-bottom: 16px;
    }

    .app-mark {
      display: grid;
      place-items: center;
      width: 44px;
      height: 44px;
      border-radius: 14px;
      background: var(--acc);
      color: var(--accfg);
      font: 700 1.55rem/1 Amiri, "Noto Naskh Arabic", serif;
      box-shadow: 0 8px 24px rgba(39, 115, 93, 0.16);
    }

    h1 {
      margin: 0;
      font-size: clamp(1.2rem, 4vw, 1.55rem);
      letter-spacing: -0.02em;
    }

    details {
      background: var(--card);
      border: 1px solid var(--line);
      border-radius: 16px;
      margin-bottom: 14px;
      overflow: hidden;
    }

    summary {
      cursor: pointer;
      font-weight: 700;
      padding: 14px 16px;
      list-style: none;
    }

    summary::-webkit-details-marker { display: none; }

    summary::after {
      content: "+";
      float: right;
      color: var(--muted);
      font-size: 1.25rem;
      line-height: 1;
    }

    details[open] summary::after { content: "−"; }

    .settings-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 4px 16px;
      padding: 0 16px 14px;
    }

    .setting { min-width: 0; }

    .lab {
      margin: 10px 0 7px;
      color: var(--muted);
      font-size: 0.78rem;
      font-weight: 700;
      letter-spacing: 0.04em;
      text-transform: uppercase;
    }

    .row {
      display: flex;
      flex-wrap: wrap;
      gap: 7px;
    }

    button {
      font: inherit;
      color: inherit;
      cursor: pointer;
    }

    button:focus-visible,
    summary:focus-visible {
      outline: 3px solid rgba(39, 115, 93, 0.24);
      outline-offset: 2px;
    }

    .chip {
      min-height: 34px;
      border: 1px solid var(--line);
      background: transparent;
      border-radius: 999px;
      padding: 6px 11px;
      transition: 150ms ease;
    }

    .chip.on {
      background: var(--acc);
      color: var(--accfg);
      border-color: var(--acc);
    }

    .bar {
      display: flex;
      justify-content: space-between;
      min-height: 24px;
      margin: 10px 4px;
      color: var(--muted);
      font-size: 0.88rem;
      font-weight: 650;
    }

    .card {
      min-height: clamp(280px, 42vh, 390px);
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 8px;
      padding: 28px 20px;
      background: var(--card);
      border: 1px solid var(--line);
      border-radius: 22px;
      box-shadow: 0 18px 50px rgba(28, 52, 43, 0.08);
      text-align: center;
    }

    .ar {
      font-family: Amiri, "Noto Naskh Arabic", "Traditional Arabic", Arial, serif;
      font-size: clamp(2.8rem, 11vw, 4.2rem);
      line-height: 1.35;
    }

    .ar.sm { font-size: clamp(2.2rem, 8vw, 3.2rem); }

    .tr {
      font-size: clamp(1.35rem, 5vw, 1.75rem);
      font-weight: 700;
    }

    .meta { color: var(--muted); font-size: 0.88rem; }
    .hint { color: var(--muted); }

    .act {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 10px;
      margin-top: 14px;
    }

    .act button {
      min-height: 52px;
      border: 1px solid var(--line);
      border-radius: 14px;
      background: var(--card);
      font-weight: 750;
      box-shadow: 0 6px 18px rgba(28, 52, 43, 0.05);
    }

    .act button:only-child {
      grid-column: 1 / -1;
    }

    .act .main {
      background: var(--acc);
      color: var(--accfg);
      border-color: var(--acc);
    }

    .act .ok { color: var(--ok); border-color: var(--ok); }
    .act .no { color: var(--no); border-color: var(--no); }

    .small {
      border: none;
      background: none;
      padding: 4px 0;
      color: var(--muted);
      text-decoration: underline;
      text-underline-offset: 3px;
    }

    @media (max-width: 560px) {
      main { width: min(100% - 24px, 680px); padding-top: 14px; }
      .settings-grid { grid-template-columns: 1fr; }
      .card { min-height: 300px; border-radius: 18px; }
      .chip { min-height: 36px; }
    }

    @media (prefers-reduced-motion: reduce) {
      .chip { transition: none; }
    }
