/* ==========================================================================
   SYNCLE — SAGA DESIGN SYSTEM (Matches Trimle / Folded Orchard Captures 1–5)
   Warm cream card (#f5f2e6), deep pine typography (#1d3d33), tactile 3D tiles,
   winding S-curve level map, botanical leaves, and smooth sheet modals.
   ========================================================================== */

:root {
    --bg-outer: #fbfbf9;
    --bg-outer-dot: #d8ddd2;
    --bg-card: #f5f2e6;
    --bg-sheet: #fbfaf5;
    --border-card: #dcd8c8;

    --pine-dark: #1d3d33;
    --pine-muted: #526b61;
    --pine-soft: #788c82;

    --green-main: #46713d;
    --green-hover: #3c6334;
    --green-lip: #2d4f26;
    --green-halo: #e2e7d7;

    --node-cleared: #7f9c6d;
    --node-cleared-lip: #5d784d;

    --node-locked: #e1e4d7;
    --node-locked-lip: #c5cab7;

    --tile-white: #ffffff;
    --tile-border: #d7dccb;
    --tile-lip: #cfd5c2;

    --tan-avatar: #ca9f68;
    --tan-flag: #e8cc8e;
    --tan-flag-lip: #a68243;

    --danger-red: #c0392b;
    --danger-lip: #922b21;

    --font-sans: 'Plus Jakarta Sans', 'Nunito', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    height: 100%;
    background-color: var(--bg-outer);
    background-image: radial-gradient(var(--bg-outer-dot) 1.25px, transparent 1.25px);
    background-size: 16px 16px;
    color: var(--pine-dark);
    font-family: var(--font-sans);
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
    user-select: none;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
}

/* ==========================================================================
   OUTER STAGE & DEVICE CARD
   ========================================================================== */
.saga-outer-stage {
    width: 100%;
    height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
}

.saga-device-card {
    position: relative;
    width: 100%;
    max-width: 420px;
    height: 100%;
    max-height: 860px;
    background: var(--bg-card);
    border: 1.5px solid var(--border-card);
    border-radius: 32px;
    box-shadow: 0 18px 48px rgba(29, 61, 51, 0.08);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

@media (max-width: 480px) {
    .saga-outer-stage {
        padding: 0;
    }
    .saga-device-card {
        max-width: 100%;
        max-height: 100%;
        border-radius: 0;
        border: none;
    }
}

.saga-screen {
    display: none;
    flex-direction: column;
    width: 100%;
    height: 100%;
    padding: 18px 18px calc(16px + env(safe-area-inset-bottom, 0px));
    animation: screenFadeIn 0.26s cubic-bezier(0.22, 1, 0.36, 1);
}

.saga-screen.active {
    display: flex;
}

@keyframes screenFadeIn {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.99);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ==========================================================================
   SCREEN 1: TOP HUD BAR & BRAND TITLE (Capture 1)
   ========================================================================== */
.saga-top-hud {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
    flex-shrink: 0;
}

.saga-avatar-btn {
    width: 46px;
    height: 46px;
    border-radius: 15px;
    background: var(--tan-avatar);
    border: 2.5px solid #ffffff;
    box-shadow: 0 3px 0 #cfcab8;
    color: var(--pine-dark);
    font-size: 1.25rem;
    font-weight: 900;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.1s ease;
    flex-shrink: 0;
}

.saga-avatar-btn:active {
    transform: translateY(2px);
}

.saga-stat-pill {
    flex: 1;
    height: 44px;
    background: #faf8f0;
    border: 1.5px solid var(--tile-border);
    box-shadow: 0 3px 0 var(--tile-lip);
    border-radius: 15px;
    padding: 0 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    color: var(--pine-dark);
    font-size: 1.02rem;
    font-weight: 800;
    transition: transform 0.1s ease;
}

.saga-stat-pill:active {
    transform: translateY(2px);
    box-shadow: 0 1px 0 var(--tile-lip);
}

.stat-icon-heart {
    color: #b85d52;
    font-size: 1.05rem;
}

.stat-icon-coin {
    font-size: 1rem;
}

.stat-plus {
    color: var(--pine-muted);
    font-weight: 800;
    margin-left: 1px;
}

.saga-gear-btn {
    width: 42px;
    height: 42px;
    border: none;
    background: transparent;
    color: var(--pine-dark);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 12px;
    transition: transform 0.2s ease, background-color 0.15s ease;
    flex-shrink: 0;
}

.saga-gear-btn:hover {
    background: rgba(29, 61, 51, 0.06);
    transform: rotate(25deg);
}

/* Brand Block */
.saga-brand-block {
    text-align: center;
    margin-bottom: 6px;
    flex-shrink: 0;
}

.saga-brand-logo {
    font-size: 2.4rem;
    font-weight: 900;
    letter-spacing: -0.04em;
    color: var(--pine-dark);
    line-height: 1.05;
}

.saga-chapter-sub {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--pine-muted);
    margin-top: 3px;
}

/* ==========================================================================
   WINDING S-CURVE MAP AREA & WEEKLY ROUTE WIDGET
   ========================================================================== */
.saga-map-area {
    position: relative;
    flex: 1;
    min-height: 0;
    margin: 4px -6px;
    overflow: hidden;
}

/* Floating Weekly Route Widget (Top-left of map) */
.weekly-route-widget {
    position: absolute;
    top: 14px;
    left: 12px;
    z-index: 15;
    background: transparent;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    transition: transform 0.15s ease;
}

.weekly-route-widget:hover {
    transform: scale(1.04);
}

.weekly-route-widget:active {
    transform: scale(0.96);
}

.weekly-flag-tile {
    width: 66px;
    height: 60px;
    background: var(--tan-flag);
    border: 2px solid var(--tan-flag-lip);
    box-shadow: 0 4px 0 var(--tan-flag-lip);
    border-radius: 16px;
    transform: rotate(-6deg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #5e4319;
}

.weekly-label {
    font-size: 0.78rem;
    font-weight: 800;
    color: var(--pine-dark);
    margin-top: 2px;
}

.weekly-progress-pill {
    background: #ffffff;
    border: 1px solid var(--tile-border);
    border-radius: 99px;
    padding: 2px 10px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--pine-muted);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

/* Scrollable Winding Map Road */
.map-road-scroll {
    width: 100%;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
    scroll-behavior: smooth;
}

.map-road-scroll::-webkit-scrollbar {
    display: none;
}

.map-road-canvas {
    position: relative;
    width: 100%;
    margin: 0 auto;
}

.map-road-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* 3D Level Nodes on the Winding Road */
.map-node-wrap {
    position: absolute;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 5;
}

.map-node-btn {
    position: relative;
    width: 58px;
    height: 54px;
    border-radius: 19px;
    border: none;
    font-family: var(--font-sans);
    font-size: 1.25rem;
    font-weight: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.12s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.map-node-btn:active:not(:disabled) {
    transform: translateY(3px);
}

/* Cleared Node */
.map-node-btn.node-cleared {
    background: var(--node-cleared);
    color: var(--pine-dark);
    border: 2px solid var(--node-cleared-lip);
    box-shadow: 0 4px 0 var(--node-cleared-lip);
}

/* Current / NEXT Node */
.map-node-btn.node-current {
    width: 74px;
    height: 68px;
    border-radius: 24px;
    background: var(--green-main);
    color: #ffffff;
    font-size: 1.55rem;
    border: 2.5px solid var(--green-lip);
    box-shadow: 0 5px 0 var(--green-lip), 0 0 0 8px var(--green-halo);
    animation: nextNodePulse 2.4s ease-in-out infinite;
}

@keyframes nextNodePulse {
    0%, 100% {
        transform: translateY(0);
        box-shadow: 0 5px 0 var(--green-lip), 0 0 0 8px var(--green-halo);
    }
    50% {
        transform: translateY(-3px);
        box-shadow: 0 8px 0 var(--green-lip), 0 0 0 11px var(--green-halo);
    }
}

/* Locked Node */
.map-node-btn.node-locked {
    background: var(--node-locked);
    color: #6b7869;
    border: 2px solid var(--node-locked-lip);
    box-shadow: 0 4px 0 var(--node-locked-lip);
    cursor: pointer;
}

/* NEXT Badge above Current Node */
.map-next-pill {
    background: #eef1e4;
    border: 1px solid #d5dcc5;
    color: var(--pine-dark);
    font-size: 0.7rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    padding: 3px 11px;
    border-radius: 99px;
    margin-bottom: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

/* Stars perched on Cleared Node */
.map-node-stars {
    display: flex;
    gap: 1px;
    margin-bottom: -5px;
    z-index: 6;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.18));
}

.map-star-svg {
    width: 16px;
    height: 16px;
}

/* ==========================================================================
   BOTTOM MAP DOCK: Daily | PLAY LEVEL X | Shop
   ========================================================================== */
.saga-map-dock, .game-bottom-dock {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    padding-top: 8px;
    flex-shrink: 0;
}

.dock-side-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.btn-saga-square {
    width: 56px;
    height: 54px;
    background: var(--tile-white);
    border: 1.5px solid var(--tile-border);
    box-shadow: 0 4px 0 var(--tile-lip);
    border-radius: 17px;
    color: var(--pine-dark);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.btn-saga-square:active:not(:disabled) {
    transform: translateY(3px);
    box-shadow: 0 1px 0 var(--tile-lip);
}

.btn-saga-square:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.dock-side-label {
    font-size: 0.78rem;
    font-weight: 800;
    color: var(--pine-dark);
}

.btn-saga-play {
    flex: 1;
    height: 70px;
    background: var(--green-main);
    border: 2px solid var(--green-lip);
    box-shadow: 0 5px 0 var(--green-lip);
    border-radius: 22px;
    color: #ffffff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.1s ease, background-color 0.15s ease;
}

.btn-saga-play:hover {
    background: var(--green-hover);
}

.btn-saga-play:active {
    transform: translateY(4px);
    box-shadow: 0 1px 0 var(--green-lip);
}

.play-main-text {
    font-size: 1.55rem;
    font-weight: 900;
    letter-spacing: 0.04em;
    color: #0e241b;
    line-height: 1.05;
}

.play-sub-text {
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: #132d22;
    margin-top: 2px;
}

/* ==========================================================================
   SCREEN 2: ACTIVE PUZZLE GAMEPLAY (Capture 2)
   ========================================================================== */
.game-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 2px 12px;
    flex-shrink: 0;
}

.game-pause-btn {
    width: 38px;
    height: 38px;
    border: none;
    background: transparent;
    color: var(--pine-dark);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 10px;
}

.game-pause-btn:hover {
    background: rgba(29, 61, 51, 0.06);
}

.game-level-heading {
    font-size: 0.95rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--pine-dark);
}

.game-timer-label {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--pine-muted);
    font-variant-numeric: tabular-nums;
}

.game-prompt-header {
    text-align: center;
    margin: 4px 0 12px;
    flex-shrink: 0;
}

.game-main-instruction {
    font-size: 1.55rem;
    font-weight: 900;
    color: var(--pine-dark);
    letter-spacing: -0.02em;
}

.game-sub-instruction {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--pine-muted);
    margin-top: 4px;
}

/* Tactile 3D Word Board Stage */
.game-board-stage {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 12px;
    min-height: 0;
    overflow-y: auto;
    padding: 4px 2px;
}

.pz-board-rows {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.pz-word-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.pz-word-row.row-pulse .pz-tile.tile-done:last-of-type,
.pz-word-row.row-pulse .pz-tile.tile-head {
    animation: tileBounce 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes tileBounce {
    0% { transform: scale(1); }
    45% { transform: scale(1.12) translateY(-3px); }
    100% { transform: scale(1) translateY(0); }
}

.pz-word-tiles {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: nowrap;
}

/* 3D White Rounded Tiles (Matches Capture 2) */
.pz-tile {
    width: 48px;
    height: 52px;
    border-radius: 15px;
    background: var(--tile-white);
    border: 1.5px solid var(--tile-border);
    box-shadow: 0 4px 0 var(--tile-lip);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    font-weight: 900;
    color: var(--pine-dark);
    transition: all 0.16s ease;
}

/* Active Head Letter Waiting to be Synced */
.pz-tile.tile-head {
    border: 2.2px solid var(--green-main);
    box-shadow: 0 4px 0 var(--green-lip);
    background: #ffffff;
    color: var(--pine-dark);
}

.pz-tile.tile-head .tile-letter {
    text-decoration: underline;
    text-underline-offset: 4px;
    text-decoration-thickness: 2.5px;
}

/* Completed Letters */
.pz-tile.tile-done {
    background: #e3ebd8;
    border-color: #b8c9a6;
    box-shadow: 0 2px 0 #b8c9a6;
    color: var(--green-main);
    transform: translateY(2px);
}

.pz-row-progress {
    font-size: 0.82rem;
    font-weight: 800;
    color: var(--pine-muted);
    min-width: 32px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Status Line ("0 / 6 tocs · Òptim: 6") */
.game-selection-status {
    text-align: center;
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--pine-muted);
    margin: 2px 0;
}

.game-selection-status.prompt-hint {
    color: var(--green-main);
    font-weight: 800;
}

.game-selection-status.prompt-error {
    color: var(--danger-red);
    font-weight: 800;
}

/* 3D Letter Keys Palette */
.pz-symbol-keys {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    margin-top: 2px;
}

.pz-key-btn {
    height: 54px;
    border-radius: 16px;
    font-family: var(--font-sans);
    font-size: 1.25rem;
    font-weight: 900;
    cursor: pointer;
    transition: transform 0.08s ease, box-shadow 0.08s ease, background-color 0.15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.pz-key-btn.key-enabled {
    background: var(--green-main);
    color: #ffffff;
    border: 2px solid var(--green-lip);
    box-shadow: 0 4px 0 var(--green-lip);
}

.pz-key-btn.key-enabled:hover {
    background: var(--green-hover);
}

.pz-key-btn.key-enabled:active {
    transform: translateY(3px);
    box-shadow: 0 1px 0 var(--green-lip);
}

.pz-key-btn.key-disabled {
    background: #e5e8dc;
    color: #879484;
    border: 1.5px solid #cfd5c2;
    box-shadow: 0 3px 0 #cfd5c2;
    cursor: not-allowed;
    opacity: 0.75;
}

.pz-key-btn.key-hinted {
    box-shadow: 0 4px 0 var(--green-lip), 0 0 0 4px #eab308;
    animation: nextNodePulse 1.3s infinite;
}

/* Center Action Button in Gameplay Bottom Dock (Matches "Cut" pill in Capture 2) */
.btn-game-center-action {
    flex: 1;
    height: 56px;
    background: #d5dcc8;
    border: 1.5px solid #bfc8b0;
    box-shadow: 0 4px 0 #bfc8b0;
    border-radius: 18px;
    color: #496658;
    font-family: var(--font-sans);
    font-size: 1.15rem;
    font-weight: 900;
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.btn-game-center-action:active {
    transform: translateY(3px);
    box-shadow: 0 1px 0 #bfc8b0;
}

/* Inline Win / Retry Card */
.sc-win-box {
    background: #ecf2e4;
    border: 2px solid #b8cba4;
    border-radius: 20px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
    animation: modalPopIn 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

.sc-win-title {
    font-size: 0.96rem;
    font-weight: 800;
    color: var(--pine-dark);
    line-height: 1.35;
}

/* ==========================================================================
   MODAL SHEETS (Matches Captures 3, 4, 5: Puzzle tools, Weekly route, Settings)
   ========================================================================== */
.saga-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(92, 108, 92, 0.52);
    backdrop-filter: blur(2px);
    z-index: 100;
    display: none;
    align-items: flex-end;
    justify-content: center;
    padding: 16px;
}

.saga-modal-backdrop.active {
    display: flex;
    animation: fadeBackdrop 0.18s ease;
}

@keyframes fadeBackdrop {
    from { opacity: 0; }
    to { opacity: 1; }
}

.saga-sheet-card {
    width: 100%;
    max-height: 88%;
    overflow-y: auto;
    background: var(--bg-sheet);
    border: 1.5px solid var(--tile-border);
    box-shadow: 0 10px 30px rgba(29, 61, 51, 0.18);
    border-radius: 26px;
    padding: 22px 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    animation: modalPopIn 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes modalPopIn {
    from {
        opacity: 0;
        transform: translateY(18px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sheet-title {
    font-size: 1.5rem;
    font-weight: 900;
    color: #0b1914;
    letter-spacing: -0.02em;
}

.sheet-close-btn {
    border: none;
    background: transparent;
    color: var(--pine-dark);
    font-size: 1.25rem;
    font-weight: 700;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.sheet-close-btn:hover {
    background: rgba(29, 61, 51, 0.07);
}

.sheet-subtitle {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--pine-muted);
    line-height: 1.38;
    margin-top: -4px;
}

/* Progress Bar inside Weekly Route Sheet (Capture 4) */
.sheet-progress-track {
    width: 100%;
    height: 14px;
    background: #dce0d1;
    border-radius: 99px;
    overflow: hidden;
    margin: 2px 0;
}

.sheet-progress-fill {
    height: 100%;
    background: var(--green-main);
    border-radius: 99px;
    transition: width 0.35s ease;
}

/* Clean Divider Rows inside Sheets (Captures 3, 4, 5) */
.sheet-rows-list {
    display: flex;
    flex-direction: column;
}

.sheet-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 2px;
    border-bottom: 1px solid #e6e8de;
    font-size: 0.95rem;
    background: transparent;
    border-left: none;
    border-right: none;
    border-top: none;
    width: 100%;
    text-align: left;
    font-family: var(--font-sans);
}

.sheet-row.clickable {
    cursor: pointer;
    border-radius: 8px;
    padding-left: 6px;
    padding-right: 6px;
    transition: background-color 0.12s ease;
}

.sheet-row.clickable:hover {
    background: rgba(70, 113, 61, 0.07);
}

.sheet-row-label {
    font-weight: 800;
    color: var(--pine-dark);
}

.sheet-row-val {
    font-weight: 800;
    color: var(--pine-muted);
}

/* Primary 3D Green CTA Button inside Sheets */
.btn-saga-green {
    width: 100%;
    min-height: 52px;
    background: var(--green-main);
    border: 2px solid var(--green-lip);
    box-shadow: 0 4px 0 var(--green-lip);
    border-radius: 16px;
    color: #ffffff;
    font-family: var(--font-sans);
    font-size: 1rem;
    font-weight: 900;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.1s ease, background-color 0.15s ease;
    margin-top: 4px;
}

.btn-saga-green:hover:not(:disabled) {
    background: var(--green-hover);
}

.btn-saga-green:active:not(:disabled) {
    transform: translateY(3px);
    box-shadow: 0 1px 0 var(--green-lip);
}

.btn-saga-secondary {
    width: 100%;
    min-height: 46px;
    background: #ffffff;
    border: 1.5px solid var(--tile-border);
    box-shadow: 0 3px 0 var(--tile-lip);
    border-radius: 14px;
    color: var(--pine-dark);
    font-family: var(--font-sans);
    font-size: 0.92rem;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
}

.btn-saga-secondary:active {
    transform: translateY(2px);
    box-shadow: 0 1px 0 var(--tile-lip);
}

/* Language Switcher Pills */
.lang-switcher {
    display: inline-flex;
    background: #e8ebde;
    padding: 3px;
    border-radius: 10px;
    border: 1px solid var(--tile-border);
    gap: 2px;
}

.lang-pill {
    border: none;
    background: transparent;
    color: var(--pine-muted);
    font-size: 0.74rem;
    font-weight: 800;
    padding: 4px 9px;
    border-radius: 7px;
    cursor: pointer;
}

.lang-pill.active {
    background: var(--green-main);
    color: #ffffff;
}

/* Form Inputs inside Account Sheet */
.input-field {
    width: 100%;
    min-height: 44px;
    padding: 8px 12px;
    border-radius: 12px;
    border: 1.5px solid var(--tile-border);
    background: #ffffff;
    color: var(--pine-dark);
    font-family: var(--font-sans);
    font-size: 0.92rem;
    font-weight: 600;
}

/* Toasts */
.toast-container {
    position: absolute;
    top: 72px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 150;
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 88%;
    pointer-events: none;
}

.toast {
    background: var(--pine-dark);
    color: #ffffff;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 0.85rem;
    font-weight: 800;
    text-align: center;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.16);
}

.toast-error {
    background: var(--danger-red);
}

/* ==========================================================================
   MANDATORY PWA / HOME SCREEN INSTALL GATE
   ========================================================================== */
body.require-install-gate {
    overflow: hidden;
}

body.require-install-gate #main-app-shell {
    display: none !important;
}

.pwa-gate-backdrop {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.pwa-gate-card {
    max-width: 400px;
    height: auto;
    max-height: 92dvh;
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    text-align: center;
    overflow-y: auto;
}

.pwa-gate-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.saga-logo-sm {
    font-size: 1.45rem;
    font-weight: 900;
    letter-spacing: -0.04em;
    color: var(--pine-dark);
}

.pwa-gate-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.pwa-gate-icon {
    width: 72px;
    height: 72px;
    border-radius: 18px;
    box-shadow: 0 4px 0 var(--tile-lip);
    border: 2px solid #ffffff;
}

.pwa-gate-title {
    font-size: 1.25rem;
    font-weight: 900;
    color: var(--pine-dark);
    line-height: 1.25;
}

.pwa-gate-desc {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--pine-muted);
    line-height: 1.42;
}

.pwa-platform-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    background: #e8ebde;
    padding: 4px;
    border-radius: 14px;
    border: 1px solid var(--tile-border);
}

.pwa-plat-tab {
    background: transparent;
    border: none;
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 0.84rem;
    font-weight: 800;
    color: var(--pine-muted);
    cursor: pointer;
}

.pwa-plat-tab.active {
    background: var(--green-main);
    color: #ffffff;
}

.pwa-steps-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: left;
}

.pwa-step-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: #ffffff;
    border: 1.5px solid var(--tile-border);
    box-shadow: 0 3px 0 var(--tile-lip);
    border-radius: 14px;
    padding: 10px 12px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--pine-dark);
    line-height: 1.38;
}

.pwa-step-num {
    width: 24px;
    height: 24px;
    border-radius: 99px;
    background: var(--green-main);
    color: #ffffff;
    font-size: 0.78rem;
    font-weight: 900;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.pwa-gate-note {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--pine-muted);
    background: #e8ede0;
    border: 1px dashed #b9c6aa;
    border-radius: 12px;
    padding: 10px 12px;
}

@media (max-width: 370px) {
    .pz-tile {
        width: 42px;
        height: 46px;
        font-size: 1.12rem;
    }
    .pz-key-btn {
        height: 48px;
        font-size: 1.1rem;
    }
}
