*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: system-ui, -apple-system, sans-serif;
    background: #f5f7fa;
    color: #1a1a2e;
    line-height: 1.6;
}

/* Nav */
nav { background: #16213e; padding: 0.75rem 0; }
.nav-inner {
    max-width: 900px; margin: auto; padding: 0 1.5rem;
    display: flex; justify-content: space-between; align-items: center;
}
.nav-brand { color: white; font-weight: 700; font-size: 1.1rem; text-decoration: none; }
.nav-links a { color: #a8c7fa; text-decoration: none; margin-left: 1.5rem; font-size: 0.95rem; }
.nav-links a:hover { color: white; }

/* Main */
main { max-width: 900px; margin: 2rem auto; padding: 0 1.5rem; }

/* Footer */
footer { text-align: center; padding: 2rem; color: #666; font-size: 0.85rem; margin-top: 2rem; }
footer a { color: #4a90e2; }

/* Cards */
.card {
    background: white; border-radius: 8px; padding: 1.5rem;
    margin-bottom: 1.5rem; box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.card h2 { margin-bottom: 0.75rem; font-size: 1.05rem; color: #16213e; }

/* Hero */
.hero { margin-bottom: 2rem; }
.hero h1 { font-size: 2rem; color: #16213e; margin-bottom: 0.5rem; }
.subtitle { font-size: 1.05rem; margin-bottom: 1rem; color: #444; }
.subtitle a { color: #4a90e2; }
.algo-summary {
    background: #e8f0fe; border-left: 4px solid #4a90e2;
    padding: 0.75rem 1rem; border-radius: 4px; font-size: 0.93rem; color: #333;
}

/* Hint */
.hint { color: #666; font-size: 0.85rem; margin-bottom: 0.75rem; display: block; }

/* Errors */
.errors {
    background: #fef3cd; border: 1px solid #f5a623;
    border-radius: 6px; padding: 1rem; margin-bottom: 1.5rem;
}
.errors p { color: #7a4f00; font-size: 0.9rem; }

/* Form elements */
textarea,
input[type=text],
input[type=number],
input[type=password] {
    width: 100%; border: 1px solid #d0d7de; border-radius: 6px;
    padding: 0.5rem 0.75rem; font-size: 0.95rem; font-family: inherit;
    transition: border-color 0.2s;
}
textarea:focus, input:focus {
    outline: none; border-color: #4a90e2;
    box-shadow: 0 0 0 3px rgba(74,144,226,0.1);
}
label { display: block; font-size: 0.9rem; font-weight: 600; margin-bottom: 0.3rem; }

/* Agents */
.random-fill {
    display: flex; align-items: center; gap: 0.75rem;
    margin-bottom: 1rem; flex-wrap: wrap;
}
.random-fill label { margin: 0; font-weight: normal; font-size: 0.9rem; }
.random-fill input[type=number] { width: 70px; }
.agent-row {
    display: flex; gap: 0.75rem; align-items: flex-start;
    margin-bottom: 0.75rem;
}
.agent-fields {
    flex: 1; display: grid;
    grid-template-columns: 180px 1fr; gap: 0.5rem;
}
.btn-remove {
    background: white; border: 1px solid #d0d7de; border-radius: 6px;
    width: 32px; height: 34px; cursor: pointer; color: #888;
    font-size: 0.85rem; flex-shrink: 0;
}
.btn-remove:hover { background: #fff0f0; border-color: #e55; color: #e55; }

/* Advanced */
.advanced summary {
    cursor: pointer; font-weight: 600; color: #444; font-size: 0.95rem;
    padding: 0.25rem 0;
}
.advanced-grid {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 1rem; margin-top: 1rem;
}

/* Buttons */
button, .btn {
    display: inline-block; padding: 0.5rem 1rem; border-radius: 6px;
    font-size: 0.9rem; cursor: pointer; border: 1px solid #d0d7de;
    background: white; text-decoration: none; color: #1a1a2e;
    transition: background 0.15s; font-family: inherit;
}
button:hover, .btn:hover { background: #f0f0f0; }
#btn-add-agent { margin-top: 0.5rem; }
#btn-random { background: #e8f0fe; border-color: #4a90e2; color: #2557a7; }
#btn-random:hover { background: #d2e3fc; }
.btn-submit {
    background: #16213e; color: white; border-color: #16213e;
    font-size: 1rem; padding: 0.75rem 2rem; width: 100%; margin-top: 0.5rem;
}
.btn-submit:hover { background: #0f3460; }
.btn-secondary { background: #f0f4ff; border-color: #4a90e2; color: #2557a7; }
.btn-secondary:hover { background: #e0ecff; }

/* Result */
h1 { font-size: 1.8rem; color: #16213e; margin-bottom: 1.5rem; }
.result-highlight { border-left: 4px solid #22c55e; }
.result-highlight blockquote {
    font-size: 1.2rem; font-style: italic; color: #16213e;
    margin: 0.75rem 0; padding: 0.5rem 1rem;
    border-left: 3px solid #22c55e; background: #f0fdf4; border-radius: 4px;
}
.badge-ok { color: #16a34a; font-weight: 700; }

/* Table */
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; margin-top: 1rem; }
th {
    background: #f0f4ff; padding: 0.6rem 0.75rem;
    text-align: left; border-bottom: 2px solid #d0d7de; font-size: 0.85rem;
}
td { padding: 0.6rem 0.75rem; border-bottom: 1px solid #f0f0f0; }
.row-yes { background: #f0fdf4; }
.row-no { color: #888; }

/* Actions */
.actions { display: flex; gap: 1rem; margin-top: 1.5rem; }

/* Logs */
.log-box {
    background: #1a1a2e; color: #a8c7fa; padding: 1.5rem; border-radius: 8px;
    font-size: 0.8rem; white-space: pre-wrap; word-break: break-all;
    max-height: 600px; overflow-y: auto; margin-top: 1rem; line-height: 1.5;
}
