.settings-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    padding: 1.5rem 2rem;
    z-index: 1;
}

.settings-header {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.back-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI Variable", "Segoe UI", sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    -webkit-app-region: no-drag;
}

.back-btn:hover {
    color: white;
    background: rgba(255, 255, 255, 0.12);
}

.header-content {
    flex: 1;
}

.page-title {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 0.35rem;
    background: linear-gradient(135deg, #06b6d4 0%, #8b5cf6 50%, #ec4899 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-subtitle {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.65);
}

.settings-main {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.settings-block {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    padding: 1rem;
}

.settings-block h2 {
    margin: 0 0 0.75rem 0;
    font-size: 1rem;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.95);
}

.block-hint {
    margin: 0 0 0.8rem 0;
    font-size: 0.83rem;
    color: rgba(255, 255, 255, 0.62);
}

.mode-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(220px, 1fr));
    gap: 0.75rem;
}

.mode-btn {
    text-align: left;
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    transition: all 0.25s ease;
    -webkit-app-region: no-drag;
}

.mode-btn:hover {
    border-color: rgba(139, 92, 246, 0.8);
    background: rgba(139, 92, 246, 0.18);
}

.mode-btn.active {
    border-color: #8b5cf6;
    background: rgba(139, 92, 246, 0.22);
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.25);
}

.mode-btn.unavailable,
.mode-btn:disabled {
    cursor: not-allowed;
    opacity: 0.44;
    filter: grayscale(0.85);
}

.mode-btn.unavailable:hover,
.mode-btn:disabled:hover {
    border-color: rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.05);
}

.create-mode-btn {
    width: 100%;
    margin-top: 0.75rem;
    text-align: left;
    padding: 1rem;
    border-radius: 12px;
    border: 1px dashed rgba(6, 182, 212, 0.55);
    background: rgba(6, 182, 212, 0.08);
    color: rgba(255, 255, 255, 0.9);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI Variable", "Segoe UI", sans-serif;
    cursor: pointer;
    transition: all 0.25s ease;
    -webkit-app-region: no-drag;
}

.create-mode-btn:hover,
.create-mode-btn.active {
    border-color: rgba(6, 182, 212, 0.9);
    background: rgba(6, 182, 212, 0.18);
    box-shadow: 0 0 18px rgba(6, 182, 212, 0.18);
}

.mode-title {
    display: block;
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.mode-desc {
    display: block;
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.75);
}

.saved-mode-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.7rem;
}

.saved-mode-btn {
    min-height: 74px;
    text-align: left;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.13);
    background: rgba(255, 255, 255, 0.045);
    color: rgba(255, 255, 255, 0.9);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI Variable", "Segoe UI", sans-serif;
    padding: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-app-region: no-drag;
}

.saved-mode-btn:hover {
    border-color: rgba(6, 182, 212, 0.8);
    background: rgba(6, 182, 212, 0.13);
}

.saved-mode-btn.active {
    border-color: #06b6d4;
    background: rgba(6, 182, 212, 0.18);
    box-shadow: 0 0 16px rgba(6, 182, 212, 0.22);
}

.saved-mode-name,
.saved-mode-meta {
    display: block;
}

.saved-mode-name {
    margin-bottom: 0.24rem;
    font-size: 0.95rem;
    font-weight: 800;
}

.saved-mode-meta {
    color: rgba(255, 255, 255, 0.64);
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.35;
}

.saved-mode-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.65rem;
    margin-bottom: 0.9rem;
}

.saved-mode-summary > div {
    min-width: 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.045);
    padding: 0.65rem 0.75rem;
}

.saved-mode-summary .summary-label {
    display: block;
    margin-bottom: 0.18rem;
    color: rgba(255, 255, 255, 0.54);
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.saved-mode-summary strong {
    display: block;
    overflow: hidden;
    color: rgba(255, 255, 255, 0.92);
    font-size: 0.78rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.custom-create-fields {
    margin-bottom: 0.2rem;
}

.mode-management {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.9rem;
    padding: 0.75rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.035);
}

.mode-management .field-row {
    flex: 1;
    margin-bottom: 0;
}

.mode-action-row {
    display: flex;
    gap: 0.55rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.toggle-options {
    display: flex;
    gap: 0.75rem;
}

.field-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.field-row label {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.88);
    font-weight: 600;
}

.field-row input[type="number"],
.field-row input[type="text"],
.field-row select {
    width: 96px;
    border-radius: 10px;
    border: 1px solid var(--sc-select-border);
    background-color: var(--sc-select-option-bg);
    color: var(--sc-select-text);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI Variable", "Segoe UI", sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    padding: 0.5rem 0.65rem;
}

.field-row input[type="text"] {
    width: 180px;
    font-weight: 600;
}

.field-row select {
    width: 220px;
    font-weight: 700;
    cursor: pointer;
}

.field-row input[type="number"]:focus,
.field-row input[type="text"]:focus,
.field-row select:focus {
    outline: none;
    border-color: #06b6d4;
    box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.22);
}

.small-action-btn {
    border-radius: 10px;
    border: 1px solid rgba(6, 182, 212, 0.65);
    background: rgba(6, 182, 212, 0.15);
    color: white;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI Variable", "Segoe UI", sans-serif;
    font-weight: 700;
    padding: 0.55rem 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-app-region: no-drag;
}

.small-action-btn:hover {
    background: rgba(6, 182, 212, 0.25);
}

.danger-action {
    border-color: rgba(248, 113, 113, 0.65);
    background: rgba(248, 113, 113, 0.13);
    color: #fecaca;
}

.danger-action:hover {
    background: rgba(248, 113, 113, 0.23);
}

.subheading {
    margin: 0.9rem 0 0.55rem 0;
    font-size: 0.9rem;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.92);
}

.toggle-btn {
    min-width: 120px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.9);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI Variable", "Segoe UI", sans-serif;
    font-weight: 700;
    padding: 0.7rem 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-app-region: no-drag;
}

.toggle-btn:hover {
    border-color: rgba(6, 182, 212, 0.8);
}

.toggle-btn.active {
    border-color: #06b6d4;
    background: rgba(6, 182, 212, 0.2);
    box-shadow: 0 0 14px rgba(6, 182, 212, 0.25);
}

.settings-footer {
    flex-shrink: 0;
    padding-top: 0.75rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
}

.status-text {
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.65);
    margin: 0;
}

.continue-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 240px;
    padding: 0.9rem 1.6rem;
    border: none;
    border-radius: 50px;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI Variable", "Segoe UI", sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #8b5cf6 0%, #ec4899 50%, #f59e0b 100%);
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 8px 20px rgba(139, 92, 246, 0.35);
    -webkit-app-region: no-drag;
}

.continue-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    box-shadow: none;
}

.continue-btn:hover:not(:disabled) {
    transform: translateY(-1px);
}

.hidden {
    display: none;
}

@media (max-width: 800px) {
    .mode-options {
        grid-template-columns: 1fr;
    }

    .saved-mode-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .mode-management {
        align-items: stretch;
        flex-direction: column;
    }
}

@media (max-width: 540px) {
    .saved-mode-list,
    .saved-mode-summary {
        grid-template-columns: 1fr;
    }
}
