:root {
    --bg: #0f1221;
    --panel: #171a2c;
    --text: #eef1ff;
    --muted: #b8c0ff;
    --accent: #5b8cff;
    --good: #5ac18e;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    font-family: system-ui, Segoe UI, Roboto, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
}

header {
    padding: 20px;
    border-bottom: 1px solid #2a2e47;
}

header h1 {
    margin: 0 0 6px;
    font-weight: 700;
    font-size: 22px;
}

header p {
    margin: 0;
    color: var(--muted);
}

.controls {
    padding: 16px 20px;
}

.controls .grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: var(--panel);
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #2a2e47;
}

input {
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid #334;
    background: #0d0f1c;
    color: var(--text);
}

.actions {
    margin-top: 12px;
    display: flex;
    gap: 8px;
}

.toggle-view {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    background: transparent;
    padding: 0;
    border: none;
}

/* Hide compute button if present */
#computeBtn {
    display: none;
}

button {
    background: var(--accent);
    border: none;
    color: white;
    padding: 10px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}

button:hover {
    filter: brightness(1.1);
}

.summary {
    padding: 8px 20px;
    color: var(--muted);
}

.stats {
    padding: 0 20px 8px;
    color: var(--muted);
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.stats .stat {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid #2a2e47;
    border-radius: 8px;
    padding: 8px 10px;
}

.results {
    padding: 12px 20px 60px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.row {
    display: grid;
    gap: 14px;
    width: 100%;
}

.group {
    background: var(--panel);
    border: 1px solid #2a2e47;
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 380px;
}

.group--placeholder {
    visibility: hidden;
}

.group-header {
    padding: 10px 12px;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    background: #121528;
    border-bottom: 1px solid #2a2e47;
}

.group-header h3 {
    margin: 0;
    font-size: 15px;
}

.group-header .prob {
    color: var(--good);
    font-weight: 700;
}

.list {
    padding: 10px 12px;
    overflow: auto;
    flex: 1 1 auto;
    min-height: 0;
}

.item {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 13px;
    padding: 4px 0;
    border-bottom: 1px dashed #2a2e47;
    white-space: nowrap;
}

.item:last-child {
    border-bottom: none;
}

.tokens {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    align-items: center;
}

.token {
    display: inline-block;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.25);
    box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.6);
}

.token-yellow {
    background: radial-gradient(circle at 35% 35%, #fff7cc, #ffd84d 60%, #c99700);
    border-color: rgba(255, 216, 77, 0.6);
}

.token-yellow-guaranteed {
    position: relative;
    box-shadow:
        0 0 0 3px rgba(255, 216, 77, 0.55),
        inset 0 0 0 2px rgba(255, 255, 255, 0.55),
        inset 0 0 4px rgba(0, 0, 0, 0.6);
}

.token-blue {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 1px;
    padding: 1px;
    border-radius: 4px;
    border: none;
    background: transparent;
    box-shadow: none;
}

.token-blue-guaranteed {
    position: relative;
}

.token-blue-guaranteed::after {
    content: "";
    position: absolute;
    inset: -3px;
    border-radius: 6px;
    border: 2px solid rgba(90, 161, 255, 0.7);
    box-shadow: 0 0 0 2px rgba(90, 161, 255, 0.25);
}

.token-blue .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #cfe7ff, #5aa1ff 60%, #1f66cc);
    border: 1px solid rgba(90, 161, 255, 0.6);
    margin: auto;
}

.token-lightning {
    width: 18px;
    height: 18px;
    border: none;
    border-radius: 0;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bolt-icon {
    width: 12px;
    height: 16px;
    display: block;
}

.bolt-icon path {
    fill: #ffd84d;
    stroke: #c99700;
    stroke-width: 0.5;
}

footer {
    padding: 16px 20px;
    color: var(--muted);
    border-top: 1px solid #2a2e47;
}