:root {
  --bg: #0f1115;
  --panel: #171a21;
  --ink: #e6e8ec;
  --muted: #9aa4b2;
  --accent: #3b82f6;
  --ok: #22c55e;
  --bd: #262b36;
}

* {
  box-sizing: border-box
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  text-align: right;
  font: 15px/1.9 'Vazirmatn', Tahoma, 'Segoe UI', sans-serif
}

.wrap {
  max-width: 820px;
  margin: 0 auto;
  padding: 28px 20px
}

h1,
h2 {
  line-height: 1.5
}

h2 {
  margin-top: 34px;
  border-bottom: 1px solid var(--bd);
  padding-bottom: 8px
}

a {
  color: var(--accent);
  text-decoration: none
}

a:hover {
  text-decoration: underline
}

.muted {
  color: var(--muted)
}

.card {
  background: var(--panel);
  border: 1px solid var(--bd);
  border-radius: 12px;
  padding: 16px 20px;
  margin: 14px 0
}

ul,
ol {
  padding-right: 24px
}

li {
  margin: 6px 0
}

code {
  font-family: ui-monospace, Consolas, Menlo, monospace;
  background: #0b0d12;
  border: 1px solid var(--bd);
  border-radius: 6px;
  padding: 2px 7px;
  direction: ltr;
  display: inline-block;
  font-size: 13.5px;
  color: #a5d6ff
}

pre {
  font-family: ui-monospace, Consolas, Menlo, monospace;
  background: #0b0d12;
  border: 1px solid var(--bd);
  border-radius: 10px;
  padding: 14px;
  overflow: auto;
  direction: ltr;
  text-align: left;
  font-size: 13px;
  line-height: 1.7
}

pre code {
  background: none;
  border: 0;
  padding: 0;
  color: #c9d4e3
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px
}

th,
td {
  text-align: right;
  padding: 10px 12px;
  border-bottom: 1px solid var(--bd)
}

th {
  color: var(--muted);
  font-size: 13px
}

.tip {
  border-color: #14532d;
  background: #0f2a16
}

.tip strong {
  color: #a7f3d0
}

/* lesson list on the index page */
.lessons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin-top: 18px
}

.lesson {
  display: block;
  background: var(--panel);
  border: 1px solid var(--bd);
  border-radius: 12px;
  padding: 18px
}

.lesson:hover {
  text-decoration: none;
  border-color: var(--accent)
}

.lesson h3 {
  margin: 0 0 6px
}

.lesson .muted {
  font-size: 13px
}

/* regex lesson: match / non-match examples */
.match {
  color: #86efac;
  direction: ltr;
  unicode-bidi: isolate
}

.nomatch {
  color: #fca5a5;
  direction: ltr;
  unicode-bidi: isolate
}

/* three-column regex table: pattern | matches | non-matches */
table.regex-table td {
  vertical-align: top;
  white-space: normal;
  min-width: 90px;
}

table.regex-table td:first-child {
  white-space: nowrap;
}

table.regex-table code.ex {
  display: inline-block;
  margin-top: 4px;
  color: #a5d6ff;
}

table.regex-table .col-ok {
  border-left: 2px solid rgba(34, 197, 94, .35);
}

table.regex-table .col-no {
  border-left: 2px solid rgba(239, 68, 68, .35);
}

table.regex-table .match,
table.regex-table .nomatch {
  padding: 2px 4px;
  margin: 2px 0;
  display: block;
  text-align: left;
  font-size: 13.5px;
}

table.regex-table .match .muted,
table.regex-table .nomatch .muted {
  font-size: 12px;
}