:root {
    --bg: #ffffff;
    --card: #f4eeee;
    --muted: #6b6b6b;
    --accent: #1e293b;
    --btncolor: #ffffff;
    --glass: rgba(0, 0, 0, 0.04);
    --maxw: 900px;
}

body.dark {
    --bg: #0f1720;
    --card: #1e293b;
    --muted: #94a3b8;
    --accent: #fbbf24;
    --btncolor: #000;
    --glass: rgba(255, 255, 255, 0.04);
    color: #f1f5f9;
}

* {
    box-sizing: border-box;
}

body {
    font-family: Inter, system-ui, Segoe UI, Roboto, Arial;
    line-height: 1.5;
    background: var(--bg);
    margin: 0;
    padding: 24px;
    display: flex;
    justify-content: center;
    transition: background 0.3s ease, color 0.3s ease;
}

.wrap {
    width: 100%;
    max-width: var(--maxw);
}

header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 50px;
}

h1 {
    font-size: 1.6rem;
    margin: 0;
}

p.lead {
    color: var(--muted);
    margin: 6px 0 0;
    font-size: 0.98rem;
}

nav {
    display: flex;
    gap: 10px;
    align-items: center;
}

button.btn {
    background: var(--accent);
    color: var(--btncolor);
    padding: 8px 12px;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.3s ease, color 0.3s ease;
}

main {
    background: var(--card);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 6px 18px rgba(20, 20, 50, 0.06);
    transition: background 0.3s ease;
}

section + section {
    margin-top: 18px;
}

h2 {
    font-size: 1.05rem;
    margin: 0 0 8px;
}

ol.rules {
    padding-left: 18px;
    margin: 8px 0;
}

li.rule {
    margin: 12px 0;
    padding: 12px;
    border-radius: 10px;
    background: var(--glass);
}

.meta {
    color: var(--muted);
    font-size: 0.9rem;
    margin-top: 6px;
}

.preset {
    background: #c8bcbc;
    border-radius: 8px;
    padding: 10px;
    margin: 10px 0;
    border: 1px solid rgba(0, 0, 0, 0.04);
}

body.dark .preset {
    background: #334155;
    border-color: rgba(255, 255, 255, 0.08);
}

pre {
    white-space: pre-wrap;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    background: #0f1720;
    color: #e6eef6;
    padding: 12px;
    border-radius: 8px;
    overflow: auto;
}

.note {
    font-size: 0.95rem;
    color: #222;
    background: linear-gradient(90deg, #fff6f6, transparent);
    border-left: 4px solid #ffdede;
    padding: 10px;
    border-radius: 6px;
}

body.dark .note {
    color: #f1f5f9;
    background: linear-gradient(90deg, #1e293b, transparent);
    border-left-color: #fbbf24;
}

footer {
    margin-top: 18px;
    color: var(--muted);
    font-size: 0.9rem;
    text-align: center;
}

figure {
    margin: 24px 0;
    text-align: center;
}

figcaption {
    font-size: 0.95rem;
    color: var(--muted);
    margin-top: 8px;
}

img {
    max-width: 100%;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

@media (max-width: 600px) {
  body {
    padding: 0;
  }
  header {
    padding: 16px;
    margin-bottom: 20px;
  }
  pre {
    font-size: 0.6rem;
  }
}

@media (min-width: 720px) {
    h1 {
        font-size: 1.9rem;
    }
}