.button,
.chip {
    border: 1px solid var(--border-strong);
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
    border-radius: var(--radius-pill);
    padding: 9px 14px;
    cursor: pointer;
    font-weight: 700;
    min-height: 42px;
    transition: background 120ms ease, border-color 120ms ease, transform 80ms ease;
}

.button:hover,
.chip:hover,
.button:focus-visible,
.chip:focus-visible {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.28);
    outline: 2px solid rgba(255, 255, 255, 0.25);
    outline-offset: 2px;
    text-decoration: none;
}

.button:active,
.chip:active {
    transform: translateY(1px);
}

.button.primary {
    background: var(--accent);
    color: #101010;
    border-color: var(--accent);
}

.button.primary:hover,
.button.primary:focus-visible {
    background: #ffe082;
    border-color: #ffe082;
}

.button:disabled,
.chip:disabled,
.modifier-toggle:disabled,
.option-select:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
}

.card h2,
.card h3 {
    margin-top: 0;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.feature-card {
    composes: card;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: border-color 160ms ease, transform 160ms ease;
}

.feature-card:hover,
.feature-card:focus-within {
    border-color: rgba(var(--accent-rgb), 0.45);
    transform: translateY(-2px);
}

.feature-card h3 {
    margin: 0;
    font-size: 1.15rem;
}

.feature-card p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.feature-card .card-link {
    margin-top: auto;
    font-weight: 700;
}

.feature-card .card-link::after {
    content: " →";
}

.hint {
    color: var(--text-muted);
}

.field-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.field-row input,
.field-row select,
.field-row textarea {
    min-width: 0;
    flex: 1;
    background: var(--bg-input);
    color: #fff;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
}

input:focus,
select:focus,
textarea:focus {
    outline: 2px solid rgba(var(--accent-rgb), 0.5);
    outline-offset: 2px;
}

label {
    display: block;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-group {
    margin-bottom: 16px;
}

.panel {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
}

.panel:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
}

.empty-state {
    padding: 32px 20px;
    text-align: center;
    color: var(--text-muted);
    background: var(--bg-elevated);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
}

.empty-state .button {
    margin-top: 12px;
}

.error-box {
    padding: 12px 14px;
    background: rgba(255, 107, 107, 0.12);
    border: 1px solid rgba(255, 107, 107, 0.35);
    border-radius: var(--radius-sm);
    color: #ffb3b3;
}

.success-box {
    padding: 12px 14px;
    background: rgba(155, 225, 93, 0.1);
    border: 1px solid rgba(155, 225, 93, 0.35);
    border-radius: var(--radius-sm);
    color: #d6ff9e;
}

.tag {
    display: inline-block;
    padding: 3px 8px;
    border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    background: rgba(var(--accent-rgb), 0.14);
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 800;
}

kbd {
    display: inline-block;
    padding: 2px 6px;
    border: 1px solid var(--border-strong);
    border-radius: 5px;
    background: var(--bg-input);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.85em;
}

.tabs {
    display: flex;
    gap: 6px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.tab {
    padding: 10px 14px;
    background: transparent;
    border: 0;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font-weight: 700;
    cursor: pointer;
}

.tab[aria-selected="true"] {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.tab:hover,
.tab:focus-visible {
    color: var(--text);
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 30;
    padding: 24px;
    background: rgba(0, 0, 0, 0.72);
    display: grid;
    place-items: center;
}

.modal-backdrop[hidden] {
    display: none;
}

.modal {
    width: min(640px, 100%);
    max-height: min(86vh, 760px);
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-elevated);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
    padding: 18px;
    display: grid;
    gap: 14px;
}

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.modal-head h2 {
    margin: 0;
    font-size: 1.25rem;
}

.ad-safe {
    margin-top: 24px;
}

.ad-slot {
    margin: 0 auto;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.04);
    display: grid;
    place-items: center;
    overflow: hidden;
    min-height: 72px;
    width: min(728px, 100%);
}

.ad-slot.configured {
    border-style: solid;
    background: transparent;
}

.ad-slot .adsbygoogle {
    display: block;
    width: 100%;
    min-height: 72px;
}

.ad-placeholder {
    color: var(--text-muted);
    font-size: 0.85rem;
}

@media (max-width: 760px) {
    .card-grid {
        grid-template-columns: 1fr;
    }

    .field-row {
        flex-wrap: wrap;
    }

    .field-row input,
    .field-row select,
    .field-row textarea,
    .field-row .button {
        flex: 1 1 100%;
    }
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    margin: 14px 0;
}

.data-table th,
.data-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    color: var(--accent);
    font-weight: 800;
    background: var(--bg-panel);
}

.data-table tr:hover {
    background: rgba(255, 255, 255, 0.04);
}
