:root {
  color-scheme: light;
  --ink: #17212b;
  --muted: #647383;
  --line: #d9e1e7;
  --brand: #0d7c66;
  --bg: #f2f5f7;
  font-family: Tahoma, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
}

.page {
  width: min(100% - 28px, 820px);
  margin: 0 auto;
  padding: 20px 0 36px;
}

.topbar, .section-heading, .info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topbar { margin-bottom: 18px; }
.brand { color: var(--brand); font-weight: 800; }
.back-link { color: var(--brand); font-weight: 700; text-decoration: none; }

.intro { padding: 14px 2px 22px; }
.eyebrow { margin: 0 0 6px; color: var(--brand); font-size: 13px; font-weight: 800; }
h1, h2, p { margin-top: 0; }
.intro h1 { margin-bottom: 8px; font-size: clamp(25px, 6vw, 34px); }
.intro p:last-child, .panel > p, .section-heading p { margin-bottom: 0; color: var(--muted); line-height: 1.8; }

.panel {
  margin: 0 0 14px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 4px 18px #162b3a0b;
}

.panel h2 { margin-bottom: 7px; font-size: 20px; }
.section-heading { margin-bottom: 14px; }
.section-heading p { font-size: 13px; }

.info-grid { display: grid; gap: 0; margin: 10px 0 0; }
.info-row { min-height: 44px; padding: 8px 0; border-top: 1px solid #edf0f2; }
.info-row dt { color: var(--muted); }
.info-row dd { max-width: 60%; margin: 0; overflow-wrap: anywhere; text-align: left; font-weight: 700; direction: ltr; }
.state-ok { color: #087757; }
.state-warn { color: #9b6500; }
.state-bad { color: #ad2734; }

.button {
  min-height: 46px;
  padding: 0 18px;
  border: 0;
  border-radius: 10px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}
.button:disabled { cursor: wait; opacity: .65; }
.primary { margin-top: 16px; color: #fff; background: var(--brand); }
.secondary { color: var(--brand); border: 1px solid #acd1c8; background: #fff; }
.result { margin-top: 14px; padding: 12px 14px; border-radius: 10px; background: #f2f5f7; line-height: 1.7; }
.result[data-state="ok"] { color: #075f46; background: #e9f6ef; }
.result[data-state="warn"] { color: #7a5000; background: #fff6dd; }
.result[data-state="bad"] { color: #982331; background: #fff0f1; }
.steps { padding-right: 22px; color: var(--muted); line-height: 2; }
.steps strong { color: var(--ink); }
.note { margin-top: 14px; padding: 13px; border-right: 4px solid #e7b640; border-radius: 8px; background: #fff8e7; line-height: 1.8; }
footer { padding: 14px 4px; color: var(--muted); text-align: center; font-size: 13px; }
.test-sheet { display: none; }

@media (max-width: 520px) {
  .panel { padding: 16px; border-radius: 13px; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .section-heading .button { min-height: 40px; }
}

@media print {
  @page { size: 58mm auto; margin: 0; }
  body { min-height: 0; background: #fff; }
  .page { display: none !important; }
  .test-sheet {
    display: block !important;
    width: 48mm;
    min-height: 55mm;
    margin: 0 auto;
    padding: 2mm;
    color: #000;
    background: #fff;
    font-family: Arial, sans-serif;
    text-align: center;
  }
  .sheet-top { display: flex; justify-content: space-between; border-bottom: .35mm solid #000; padding-bottom: 1mm; font-size: 8pt; font-weight: 700; }
  .test-sheet h1 { margin: 2mm 0 1mm; font-size: 15pt; }
  .sheet-id { margin: 0 0 2mm; font: bold 9pt monospace; }
  .line-samples { display: grid; gap: 1mm; margin: 2mm 0; }
  .line-samples i { display: block; height: .25mm; background: #000; }
  .line-samples i:nth-child(2) { height: .5mm; }
  .line-samples i:nth-child(3) { height: 1mm; }
  .line-samples i:nth-child(4) { height: .5mm; width: 70%; margin: auto; }
  .line-samples i:nth-child(5) { height: .25mm; width: 40%; margin: auto; }
  .shade-row { display: flex; gap: 1mm; margin: 2mm 0; }
  .shade-row i { flex: 1; height: 5mm; border: .2mm solid #000; }
  .shade-row i:nth-child(2) { background: #aaa; }
  .shade-row i:nth-child(3) { background: #666; }
  .shade-row i:nth-child(4) { background: #333; }
  .shade-row i:nth-child(5) { background: #000; }
  .code-sample { width: 24mm; height: 11mm; margin: 2mm auto; background: repeating-conic-gradient(#000 0 25%, #fff 0 50%) 0 / 2mm 2mm; border: .4mm solid #000; }
  .sheet-arabic { margin: 2mm 0 1mm; font-size: 9pt; font-weight: 700; }
  .sheet-english { margin: 1mm 0 2mm; font: 8pt monospace; }
  .sheet-footer { border-top: .3mm dashed #000; padding-top: 1mm; font-size: 7pt; }
}
