body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ── Main content area ──────────────────────────────────────────────────────── */
.settings-page .main-content {
    width: 100%;
    max-width: 1100px;
    padding: 0 0 48px;
}

.settings-page .main-content h1 {
    font-family: 'Fugaz One', cursive;
    font-size: 2.6rem;
    color: #f0d060;
    margin: 0 0 32px;
    letter-spacing: 1px;
    text-shadow: 0 2px 6px rgba(0,0,0,0.6), 0 1px 0 rgba(255,255,255,0.1);
}

/* ── Settings grid ──────────────────────────────────────────────────────────── */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
    align-items: start;
}

.settings-grid .span-2 {
    grid-column: span 2;
}

/* ── Panel container ────────────────────────────────────────────────────────── */
.settings-panel {
    background:
        repeating-linear-gradient(45deg,
            rgba(0,0,0,0.02) 0px, transparent 2px, transparent 5px, rgba(0,0,0,0.02) 7px),
        linear-gradient(160deg, #f9efcc 0%, #e8dfa0 50%, #d4b860 100%);
    border-radius: 12px;
    border: 3px solid #8B6914;
    border-left: 3px solid #8B6914;
    overflow: hidden;
    box-shadow:
        0 6px 20px rgba(0,0,0,0.45),
        inset 0 2px 0 rgba(255,255,255,0.55),
        inset 0 -2px 0 rgba(0,0,0,0.18);
    transition: box-shadow 0.2s, transform 0.2s;
}

.settings-panel:hover {
    box-shadow:
        0 8px 28px rgba(0,0,0,0.5),
        inset 0 2px 0 rgba(255,255,255,0.6),
        inset 0 -2px 0 rgba(0,0,0,0.2);
}

/* ── Section header inside panel ─────────────────────────────────────────────── */
.settings-panel .section-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: linear-gradient(180deg, #3d2817 0%, #2a1810 100%);
    border-bottom: 2px solid #8B6914;
    margin: 0;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.12);
}

.settings-panel .section-head .section-icon {
    font-size: 1.15rem;
    color: #e8b84b;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.5));
}

.settings-panel .section-head h2 {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #f0d060;
    margin: 0;
    font-family: var(--default-font-family, 'Shrikhand');
    text-shadow: 0 1px 3px rgba(0,0,0,0.6);
}

/* ── Panel body ─────────────────────────────────────────────────────────────── */
.panel-body {
    padding: 4px 20px 8px;
}

/* ── Setting row ────────────────────────────────────────────────────────────── */
.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 13px 0;
    border-bottom: 1px solid rgba(139,105,20,0.25);
    gap: 16px;
}

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

.setting-item-content {
    flex: 1;
    min-width: 0;
}

.setting-item-content > label,
.setting-label {
    font-family: var(--default-font-family, 'Shrikhand');
    font-size: 0.93rem;
    font-weight: 700;
    color: #2a1810;
    display: block;
    margin: 0;
    cursor: default;
    text-shadow: 0 1px 0 rgba(255,255,255,0.4);
}

.setting-description {
    font-family: var(--default-font-family, 'Shrikhand');
    font-size: 0.78rem;
    color: #5c3d2e;
    margin: 3px 0 0;
    line-height: 1.4;
}

/* ── Notifications multi-column layout ──────────────────────────────────────── */
.notif-grid {
    padding: 0 20px 12px;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr 1fr;
    gap: 0 24px;
}

.notif-col-main {
    grid-column: span 2;
}

.notif-col .setting-item {
    padding: 9px 0;
}

/* Sub-section labels inside notifications */
.sub-section-label {
    font-family: var(--default-font-family, 'Shrikhand');
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.4px;
    color: #8B6914;
    padding: 14px 0 2px;
    border-top: 1px dashed rgba(139,105,20,0.35);
    margin-top: 4px;
    display: block;
    text-shadow: 0 1px 0 rgba(255,255,255,0.3);
}

.notif-col:first-child .sub-section-label,
.notif-col .sub-section-label:first-child {
    border-top: none;
    padding-top: 4px;
    margin-top: 0;
}

/* ── Toggle Switch ──────────────────────────────────────────────────────────── */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.switch input { opacity: 0; width: 0; height: 0; }

.slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: linear-gradient(180deg, #8a6030, #6b4820);
    transition: .3s;
    border-radius: 24px;
    border: 1px solid #5c3820;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.4), 0 1px 0 rgba(255,255,255,0.2);
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px; width: 18px;
    left: 3px; bottom: 3px;
    background: linear-gradient(145deg, #f0d090, #d4b060);
    transition: .3s;
    border-radius: 50%;
    box-shadow:
        0 2px 5px rgba(0,0,0,0.4),
        inset 0 1px 0 rgba(255,255,255,0.6),
        0 0 0 1px rgba(139,105,20,0.4);
}

input:checked + .slider {
    background: linear-gradient(180deg, #3a8040, #1d5c28);
    border-color: #1a4a20;
}

input:checked + .slider:before {
    transform: translateX(20px);
    background: linear-gradient(145deg, #a0e080, #50c040);
    box-shadow:
        0 2px 5px rgba(0,0,0,0.4),
        inset 0 1px 0 rgba(255,255,255,0.5),
        0 0 0 1px rgba(26,74,32,0.4);
}

/* ── Buttons ────────────────────────────────────────────────────────────────── */
.action-btn {
    background: linear-gradient(145deg, #d4b896, #c4a574, #b8965e);
    color: #2a1810;
    border: 2px solid #8B6914;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 0.88rem;
    font-weight: 700;
    font-family: var(--default-font-family, 'Shrikhand');
    cursor: pointer;
    box-shadow:
        0 4px 0 #6b4808,
        0 5px 12px rgba(0,0,0,0.35),
        inset 0 1px 0 rgba(255,255,255,0.45);
    text-shadow: 0 1px 0 rgba(255,255,255,0.3);
    text-decoration: none;
    display: inline-block;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 110px;
    text-align: center;
    transition: transform 0.1s, box-shadow 0.1s;
}

.action-btn:hover {
    background: linear-gradient(145deg, #e0c9a0, #d4b070, #c4a060);
    transform: translateY(-1px);
    box-shadow:
        0 5px 0 #6b4808,
        0 7px 16px rgba(0,0,0,0.4),
        inset 0 1px 0 rgba(255,255,255,0.5);
}

.action-btn:active {
    transform: translateY(2px);
    box-shadow:
        0 2px 0 #6b4808,
        0 3px 8px rgba(0,0,0,0.3),
        inset 0 2px 4px rgba(0,0,0,0.15);
}

.action-btn.action-btn-green {
    background: linear-gradient(145deg, #5dbb6e, #2d8a3e, #1a6028);
    color: #fff;
    border-color: #1a5c28;
    text-shadow: 0 1px 2px rgba(0,0,0,0.4);
    box-shadow:
        0 4px 0 #0e3a18,
        0 5px 12px rgba(0,0,0,0.35),
        inset 0 1px 0 rgba(255,255,255,0.2);
}
.action-btn.action-btn-green:hover {
    background: linear-gradient(145deg, #6dd87e, #3da050, #228038);
    box-shadow:
        0 5px 0 #0e3a18,
        0 7px 16px rgba(0,0,0,0.4),
        inset 0 1px 0 rgba(255,255,255,0.25);
}

.action-btn.action-btn-red {
    background: linear-gradient(145deg, #e06060, #c03030, #a02020);
    color: #fff;
    border-color: #801818;
    text-shadow: 0 1px 2px rgba(0,0,0,0.4);
    box-shadow:
        0 4px 0 #601010,
        0 5px 12px rgba(0,0,0,0.35),
        inset 0 1px 0 rgba(255,255,255,0.15);
}
.action-btn.action-btn-red:hover {
    background: linear-gradient(145deg, #f07070, #d04040, #b02828);
    box-shadow:
        0 5px 0 #601010,
        0 7px 16px rgba(0,0,0,0.4),
        inset 0 1px 0 rgba(255,255,255,0.2);
}

.reset-btn {
    background: linear-gradient(145deg, #c4a574, #b8965e);
    color: #2a1810;
    border: 2px solid #8B6914;
    padding: 9px 18px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.88rem;
    font-family: var(--default-font-family, 'Shrikhand');
    box-shadow:
        0 3px 0 #6b4808,
        0 4px 10px rgba(0,0,0,0.3),
        inset 0 1px 0 rgba(255,255,255,0.35);
    text-shadow: 0 1px 0 rgba(255,255,255,0.3);
    transition: transform 0.1s, box-shadow 0.1s;
    flex-shrink: 0;
}

.reset-btn:hover {
    background: linear-gradient(145deg, #e06060, #c03030);
    border-color: #801818;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.4);
    box-shadow:
        0 4px 0 #601010,
        0 6px 14px rgba(0,0,0,0.4),
        inset 0 1px 0 rgba(255,255,255,0.15);
}

/* ── Google connect ─────────────────────────────────────────────────────────── */
.google-link-status {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.82rem;
    color: #5c3d2e;
    font-family: var(--default-font-family, 'Shrikhand');
}

.google-link-status .g-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #8B6914;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.google-link-status.linked .g-dot {
    background: #2d8a3e;
    box-shadow: 0 0 6px rgba(45,138,62,0.5);
}
.google-link-status.linked { color: #1a5c28; font-weight: 700; }

/* ── Volume slider ──────────────────────────────────────────────────────────── */
.volume-control {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    min-width: 160px;
}

.volume-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 7px;
    background: linear-gradient(180deg, #5c3820, #8B6030);
    outline: none;
    border-radius: 4px;
    border: 1px solid #3d2008;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.4);
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px; height: 20px;
    background: linear-gradient(145deg, #f0d090, #d4a020);
    cursor: pointer;
    border-radius: 50%;
    border: 2px solid #8B6914;
    box-shadow:
        0 3px 6px rgba(0,0,0,0.4),
        inset 0 1px 0 rgba(255,255,255,0.5);
}

.volume-slider::-moz-range-thumb {
    width: 20px; height: 20px;
    background: linear-gradient(145deg, #f0d090, #d4a020);
    cursor: pointer;
    border-radius: 50%;
    border: 2px solid #8B6914;
    box-shadow: 0 3px 6px rgba(0,0,0,0.4);
}

#volume-percentage {
    font-weight: 700;
    color: #2a1810;
    min-width: 38px;
    text-align: right;
    font-size: 0.85rem;
    font-family: var(--default-font-family, 'Shrikhand');
    text-shadow: 0 1px 0 rgba(255,255,255,0.4);
}

/* ── Font dropdown ──────────────────────────────────────────────────────────── */
.dropdown-wrapper {
    position: relative;
    display: inline-block;
    z-index: 10001;
    flex-shrink: 0;
}

.dropdown-menu {
    position: fixed;
    background: linear-gradient(160deg, #f9efcc, #e8d8a0);
    border: 2px solid #8B6914;
    border-radius: 10px;
    min-width: 160px;
    box-shadow:
        0 8px 24px rgba(0,0,0,0.5),
        inset 0 1px 0 rgba(255,255,255,0.4);
    z-index: 99999 !important;
    display: none !important;
    overflow-y: auto;
    max-height: 360px;
    pointer-events: none;
    scrollbar-width: thin;
    scrollbar-color: #8B6914 transparent;
}

.dropdown-menu.show {
    display: block !important;
    pointer-events: auto !important;
}

.dropdown-header {
    background: linear-gradient(180deg, #3d2817, #2a1810);
    color: #e8b84b;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    padding: 10px 14px 7px;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #8B6914;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.dropdown-item {
    display: block;
    width: 100%;
    padding: 10px 16px;
    background: transparent;
    border: none;
    text-align: left;
    font-size: 1rem;
    font-weight: 500;
    color: #2a1810;
    cursor: pointer;
    transition: all 0.12s;
    border-left: 4px solid transparent;
}

.dropdown-item:hover {
    background: linear-gradient(90deg, rgba(139,105,20,0.15), transparent);
    color: #3d2008;
    border-left-color: #8B6914;
    padding-left: 20px;
}

.dropdown-item:not(:last-child) {
    border-bottom: 1px solid rgba(139,105,20,0.2);
}

/* ── Language selector ──────────────────────────────────────────────────────── */
.settings-language-selector { margin-top: 8px; }

.language-selector-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.language-btn {
    background: linear-gradient(145deg, #c4a574, #b8965e);
    border: 2px solid #8B6914;
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow:
        0 3px 0 #6b4808,
        0 4px 8px rgba(0,0,0,0.3),
        inset 0 1px 0 rgba(255,255,255,0.35);
    font-family: var(--default-font-family, 'Shrikhand');
    color: #2a1810;
    text-shadow: 0 1px 0 rgba(255,255,255,0.3);
    transition: transform 0.1s, box-shadow 0.1s;
}

.language-btn:hover {
    background: linear-gradient(145deg, #e0c9a0, #d4b070);
    transform: translateY(-1px);
    box-shadow:
        0 4px 0 #6b4808,
        0 6px 12px rgba(0,0,0,0.35),
        inset 0 1px 0 rgba(255,255,255,0.4);
}

.language-btn.active {
    background: linear-gradient(145deg, #f0d060, #d4a017);
    border-color: #c8940a;
    box-shadow:
        0 2px 0 #8B6014,
        0 3px 8px rgba(0,0,0,0.3),
        inset 0 1px 0 rgba(255,255,255,0.4);
    transform: translateY(1px);
}

.lang-badge {
    padding: 8px 16px;
    background: linear-gradient(145deg, #f0d060, #d4a017);
    border-radius: 8px;
    border: 2px solid #8B6914;
    color: #2a1810;
    font-weight: 800;
    font-size: 0.95rem;
    font-family: var(--default-font-family, 'Shrikhand');
    flex-shrink: 0;
    box-shadow:
        0 3px 8px rgba(0,0,0,0.3),
        inset 0 1px 0 rgba(255,255,255,0.4);
    text-shadow: 0 1px 0 rgba(255,255,255,0.3);
}

/* ── Tour buttons ───────────────────────────────────────────────────────────── */
.tour-btn-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 0 4px;
}

/* ── Modals ─────────────────────────────────────────────────────────────────── */
.modal {
    position: fixed;
    z-index: 10000;
    inset: 0;
    background: rgba(0,0,0,0.72);
    isolation: isolate;
    contain: layout style paint;
    transform: translateZ(0);
}

.modal-content {
    background:
        repeating-linear-gradient(45deg,
            rgba(0,0,0,0.02) 0px, transparent 2px, transparent 5px, rgba(0,0,0,0.02) 7px),
        linear-gradient(160deg, #f9efcc 0%, #e8dfa0 50%, #d4b860 100%);
    border-radius: 16px;
    border: 3px solid #8B6914;
    box-shadow:
        0 16px 48px rgba(0,0,0,0.6),
        inset 0 2px 0 rgba(255,255,255,0.5),
        inset 0 -2px 0 rgba(0,0,0,0.2);
    margin: 5% auto;
    padding: 0;
    width: 90%;
    max-width: 480px;
    position: relative;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    margin-bottom: 0;
    background: linear-gradient(180deg, #3d2817, #2a1810);
    border-bottom: 2px solid #8B6914;
    border-radius: 13px 13px 0 0;
    height: 56px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.12);
}

.modal-header h2 {
    font-family: 'Fugaz One', cursive;
    font-size: 1.2rem;
    font-weight: 700;
    color: #f0d060;
    margin: 0;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.close {
    font-size: 22px;
    font-weight: bold;
    color: #c4a060;
    cursor: pointer;
    line-height: 1;
    background: none;
    border: none;
    text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}

.close:hover { color: #f0d060; }

.modal form { padding: 20px 24px 24px; }

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

.form-group label {
    display: block;
    font-family: var(--default-font-family, 'Shrikhand');
    font-size: 0.88rem;
    font-weight: 700;
    color: #2a1810;
    margin-bottom: 7px;
    text-shadow: 0 1px 0 rgba(255,255,255,0.4);
}

.form-group input {
    width: 100%;
    padding: 11px 14px;
    border: 2px solid #8B6914;
    border-radius: 8px;
    font-family: var(--default-font-family, 'Shrikhand');
    font-size: 0.95rem;
    background: linear-gradient(180deg, #3d2817, #2a1810);
    color: #f4e4c4;
    box-sizing: border-box;
    transition: border-color 0.15s;
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.4);
}

.form-group input:focus {
    outline: none;
    border-color: #d4a017;
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.4), 0 0 0 2px rgba(212,160,23,0.3);
}

.form-group input::placeholder { color: #8B6914; }

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 22px;
}

.btn-primary {
    padding: 11px 22px;
    border: 2px solid #1a5c28;
    border-radius: 10px;
    font-family: var(--default-font-family, 'Shrikhand');
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    background: linear-gradient(145deg, #5dbb6e, #2d8a3e, #1a6028);
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.4);
    box-shadow:
        0 4px 0 #0e3a18,
        0 5px 12px rgba(0,0,0,0.35),
        inset 0 1px 0 rgba(255,255,255,0.2);
    transition: transform 0.1s, box-shadow 0.1s;
}

.btn-primary:hover {
    background: linear-gradient(145deg, #6dd87e, #3da050, #228038);
    transform: translateY(-1px);
    box-shadow:
        0 5px 0 #0e3a18,
        0 7px 16px rgba(0,0,0,0.4),
        inset 0 1px 0 rgba(255,255,255,0.25);
}

.btn-secondary {
    padding: 11px 22px;
    border: 2px solid #8B6914;
    border-radius: 10px;
    font-family: var(--default-font-family, 'Shrikhand');
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    background: linear-gradient(145deg, #c4a574, #b8965e);
    color: #2a1810;
    text-shadow: 0 1px 0 rgba(255,255,255,0.3);
    box-shadow:
        0 3px 0 #6b4808,
        0 4px 10px rgba(0,0,0,0.3),
        inset 0 1px 0 rgba(255,255,255,0.35);
    transition: transform 0.1s, box-shadow 0.1s;
}

.btn-secondary:hover {
    background: linear-gradient(145deg, #d4b896, #c4a574);
    transform: translateY(-1px);
}

/* ── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 860px) {
    .settings-grid {
        grid-template-columns: 1fr;
    }
    .settings-grid .span-2 {
        grid-column: span 1;
    }
    .notif-grid {
        grid-template-columns: 1fr 1fr;
    }
    .notif-col-main {
        grid-column: span 2;
    }
}

@media (max-width: 560px) {
    .settings-page .main-content { padding: 20px 12px 60px; }
    .settings-page .main-content h1 { font-size: 2rem; }
    .notif-grid {
        grid-template-columns: 1fr;
    }
    .notif-col-main {
        grid-column: span 1;
    }
    .volume-control { min-width: 120px; }
    .tour-btn-row { gap: 6px; }
}
