:root {
    --bg: #0f1419;
    --surface: #1a2332;
    --surface-2: #243044;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --border: rgba(148, 163, 184, 0.15);
    --danger: #ef4444;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100dvh;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    padding:
        calc(12px + var(--safe-top))
        16px
        calc(24px + var(--safe-bottom));
}

.shell {
    max-width: 520px;
    margin: 0 auto;
}

.top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 12px;
}

.top a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.875rem;
}

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

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.15);
    color: #93c5fd;
    font-size: 0.75rem;
    font-weight: 600;
}

.hint {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin: 0 0 16px;
    line-height: 1.5;
}

.layout-editor {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 24px;
}

.slot {
    aspect-ratio: 1;
    border: 2px dashed var(--border);
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px;
    position: relative;
    background: rgba(26, 35, 50, 0.5);
}

.slot.filled {
    border-style: solid;
    background: var(--surface);
}

.slot .pos {
    position: absolute;
    top: 6px;
    left: 8px;
    font-size: 0.65rem;
    color: var(--text-muted);
}

.slot .icon {
    font-size: 1.75rem;
}

.slot .name {
    font-size: 0.65rem;
    text-align: center;
    font-weight: 600;
}

.slot select {
    width: 100%;
    margin-top: 4px;
    padding: 6px 4px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    font-size: 0.7rem;
}

.actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

button {
    padding: 14px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:active { background: var(--accent-hover); }

.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
}

.toast {
    margin-top: 16px;
    padding: 12px;
    border-radius: 10px;
    font-size: 0.875rem;
    display: none;
}

.toast.ok {
    display: block;
    background: rgba(34, 197, 94, 0.15);
    color: #86efac;
}

.toast.err {
    display: block;
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
}

.future-note {
    margin-top: 28px;
    padding: 14px;
    border-radius: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.future-note strong {
    color: var(--text);
}
