@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;600;700;800;900&display=swap");

:root {
    --page-blue: #0b62c6;
    --ink: #3f3f46;
    --muted: #4b5563;
    --line: #d8e2ef;
    --panel: #ffffff;
    --control-height: 46px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--page-blue);
    color: var(--ink);
    font-family: Manrope, "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

body.settings-route {
    background: #ffffff;
}

body.public-route,
body.public-route * {
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    user-select: none;
}

body.public-route {
    overflow: hidden;
}

button,
input {
    font: inherit;
}

.page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.page-loading {
    background: #ffffff;
}

.wheel-shell {
    position: relative;
    width: 96vmin;
    height: 96vmin;
    max-width: 676px;
    max-height: 676px;
    border-radius: 9999px;
    background: var(--frame-color, #ffffff);
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28), inset 0 0 16px rgba(255, 255, 255, 0.18);
    transform: translate(
        calc(var(--wheel-offset-x, 0) * 5%),
        calc(var(--wheel-offset-y, 0) * 5%)
    ) scale(var(--wheel-scale, 1));
    touch-action: manipulation;
}

.wheel-frame-image {
    position: absolute;
    inset: 0;
    z-index: 4;
    width: 100%;
    height: 100%;
    object-fit: fill;
    border-radius: 50%;
    pointer-events: none;
}

.wheel-shell-image-frame {
    background: transparent;
    box-shadow: none;
}

.stopper {
    position: absolute;
    top: 50%;
    right: calc(var(--marker-size, 5) * -5px);
    width: calc(var(--marker-size, 5) * 18px);
    height: calc(var(--marker-size, 5) * 14px);
    transform: translate(-10%, -50%);
    z-index: 8;
}

.stopper-triangle {
    clip-path: polygon(0 50%, 100% 0, 100% 100%);
    background:
        linear-gradient(135deg, rgba(255,255,255,0.38), rgba(255,255,255,0) 38%),
        linear-gradient(315deg, rgba(0,0,0,0.24), rgba(0,0,0,0) 45%),
        var(--marker-color, #ff3d64);
    filter: drop-shadow(-5px 2px 3px rgba(0, 0, 0, 0.41));
}

.stopper-image {
    object-fit: contain;
    transform: translate(-10%, -50%);
    filter: drop-shadow(-5px 2px 3px rgba(0, 0, 0, 0.41));
}

.wheel {
    position: absolute;
    top: 50%;
    left: 50%;
    width: calc(100% - 58px);
    height: calc(100% - 58px);
    aspect-ratio: 1 / 1;
    z-index: 1;
    transform: translate(-50%, -50%);
    border-radius: 9999px;
    border: 10px solid #ffffff;
    overflow: hidden;
    will-change: transform;
}

.wheel-slices {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    pointer-events: none;
    border-radius: 9999px;
    box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.42);
}

.wheel-shell-image-frame .wheel {
    width: 88%;
    height: 88%;
    border: 0;
}

.slice-label {
    position: absolute;
    width: 30%;
    transform-origin: center center;
    pointer-events: none;
}

.slice-label-text {
    display: block;
    text-align: inherit;
    color: var(--slice-text-color, #ffffff);
    font-family: Manrope, "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    font-stretch: normal;
    font-size: var(--slice-font-size, 14px);
    font-weight: 400;
    line-height: 1.35;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    overflow-wrap: anywhere;
}

.slice-label-text span {
    display: block;
}

.slice-separator {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 51%;
    height: 5px;
    background: var(--separator-color, #ffffff);
    transform-origin: left center;
    pointer-events: none;
    z-index: 2;
}

.slice-image {
    position: absolute;
    object-fit: contain;
    pointer-events: none;
    z-index: 3;
}

.spin-button {
    position: absolute;
    top: 50%;
    left: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    width: calc(var(--center-size, 7) * 25.0714px);
    height: calc(var(--center-size, 7) * 25.0714px);
    padding: 0;
    transform: translate(-50%, -50%);
    border: 8px solid var(--center-border-color, #17335c);
    border-radius: 50%;
    background: var(--center-bg, #ffffff);
    color: var(--center-text-color, #17335c);
    font-weight: 900;
    line-height: 1;
    text-align: center;
    cursor: pointer;
    z-index: 7;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35), inset 0 0 12px rgba(0, 0, 0, 0.12);
    touch-action: manipulation;
}

.center-text {
    position: relative;
    z-index: 1;
    color: var(--center-text-color, #17335c);
    font-size: calc(var(--center-text-size, 5) * 3.2px);
    font-weight: 900;
    line-height: 1.2;
    text-align: center;
    overflow-wrap: anywhere;
    max-width: 77%;
}

.spin-button-image {
    border: 0;
    background: transparent;
    box-shadow: none;
}

.spin-button-image img {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    transform: translate(-50%, -50%);
    filter: drop-shadow(0 10px 12px rgba(0, 0, 0, 0.32));
}

.spin-button:active {
    transform: translate(-50%, -50%) scale(0.96);
}

.spin-button:disabled {
    cursor: wait;
    opacity: 1;
}

.winner-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(15, 23, 42, 0.52);
    overflow: hidden;
}

.winner-modal {
    position: relative;
    z-index: 2;
    width: min(560px, calc(100vw - 32px));
    padding: 22px 22px 28px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.94);
    color: #0f172a;
    text-align: center;
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.32);
    animation: winner-pop 0.28s ease-out;
}

.winner-modal-close {
    position: absolute;
    top: 34px;
    right: 34px;
    z-index: 3;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.08);
    color: #0f172a;
    cursor: pointer;
}

.winner-modal-close svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
}

.winner-prize {
    position: relative;
    min-height: 338px;
    display: grid;
    place-items: center;
    gap: 14px;
    padding: 34px 22px;
    border-radius: 20px;
    background:
        radial-gradient(circle at 28% 18%, rgba(255, 255, 255, 0.46), transparent 34%),
        linear-gradient(145deg, rgba(255, 255, 255, 0.18), rgba(0, 0, 0, 0.14)),
        var(--winner-color);
    color: #ffffff;
    overflow: hidden;
}

.winner-prize-image {
    width: min(305px, 64vw);
    height: min(305px, 64vw);
    object-fit: contain;
    filter: drop-shadow(0 16px 22px rgba(0, 0, 0, 0.28));
}

.winner-prize-placeholder {
    width: min(292px, 60vw);
    height: min(292px, 60vw);
    display: grid;
    place-items: center;
    padding: 18px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
    color: #ffffff;
    font-size: 31px;
    font-weight: 900;
    line-height: 1.1;
    overflow-wrap: anywhere;
}

.winner-prize-label {
    max-width: 100%;
    color: #ffffff;
    font-size: 36px;
    font-weight: 900;
    line-height: 1.08;
    text-shadow: 0 3px 12px rgba(0, 0, 0, 0.34);
    overflow-wrap: anywhere;
}

.winner-modal-copy {
    padding: 26px 10px 0;
}

.winner-kicker {
    margin: 0 0 4px;
    color: #64748b;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.winner-modal-copy h2 {
    margin: 0;
    color: #0f172a;
    font-size: 44px;
    font-weight: 900;
    line-height: 1.05;
}

.winner-result-text {
    margin: 10px 0 0;
    color: #334155;
    font-size: 25px;
    font-weight: 800;
    line-height: 1.25;
}

.winner-confetti {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.winner-confetti-piece {
    position: absolute;
    top: -28px;
    left: var(--confetti-x);
    width: 10px;
    height: 18px;
    border-radius: 3px;
    background: var(--confetti-color);
    opacity: 0.92;
    transform: rotate(var(--confetti-rotate));
    animation: winner-confetti-fall var(--confetti-duration) linear var(--confetti-delay) infinite;
}

.winner-confetti-piece:nth-child(3n) {
    width: 8px;
    height: 8px;
    border-radius: 999px;
}

.winner-confetti-piece:nth-child(4n) {
    width: 14px;
    height: 8px;
}

@keyframes winner-pop {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes winner-confetti-fall {
    0% {
        transform: translate3d(0, -20px, 0) rotate(var(--confetti-rotate));
    }
    100% {
        transform: translate3d(42px, calc(100vh + 60px), 0) rotate(calc(var(--confetti-rotate) + 720deg));
    }
}

@media (max-width: 520px) {
    .winner-modal {
        border-radius: 20px;
        padding: 14px 14px 18px;
    }

    .winner-modal-close {
        top: 26px;
        right: 26px;
    }

    .winner-prize {
        min-height: 286px;
        padding: 30px 16px 22px;
        border-radius: 18px;
    }

    .winner-prize-label {
        font-size: 31px;
    }

    .winner-modal-copy h2 {
        font-size: 38px;
    }

    .winner-result-text {
        font-size: 22px;
    }
}

.spin-toast {
    position: fixed;
    top: 28px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1200;
    padding: 12px 22px;
    background: rgba(23, 51, 92, 0.94);
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.01em;
    border-radius: 999px;
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.32);
    pointer-events: none;
    animation: spin-toast-in 0.22s ease-out;
}

@keyframes spin-toast-in {
    from { opacity: 0; transform: translate(-50%, -12px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

@media (max-width: 520px) {
    .spin-toast {
        top: 18px;
        padding: 10px 18px;
        font-size: 13px;
    }
}

/* ============================================================
   Admin / Settings UI
   ============================================================ */

.settings-page {
    min-height: 100vh;
    padding: 48px 20px 64px;
    color: var(--ink);
    background: #f5f7fb;
}

.settings-page-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
}

.preloader {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 22px;
}

.preloader-wheel {
    position: relative;
    width: 92px;
    height: 92px;
    border-radius: 50%;
    background: var(--preloader-gradient, conic-gradient(
        #0b62c6 0deg 60deg,
        #ff3d64 60deg 120deg,
        #0b62c6 120deg 180deg,
        #ff3d64 180deg 240deg,
        #0b62c6 240deg 300deg,
        #ff3d64 300deg 360deg
    ));
    box-shadow:
        0 14px 34px rgba(11, 98, 198, 0.22),
        inset 0 0 0 4px #ffffff;
    animation: preloader-spin 1.1s cubic-bezier(0.55, 0.1, 0.45, 0.95) infinite;
}

.preloader-wheel::before {
    content: "";
    position: absolute;
    inset: 4px;
    border-radius: 50%;
    background: var(--preloader-separators, repeating-conic-gradient(
        rgba(255, 255, 255, 0) 0deg 59deg,
        rgba(255, 255, 255, 0.85) 59deg 60deg
    ));
    pointer-events: none;
}

.preloader-wheel-hub {
    position: absolute;
    inset: 50% auto auto 50%;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    background: #ffffff;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(23, 51, 92, 0.22);
}

.preloader-label {
    margin: 0;
    color: #17335c;
    font-size: 15px;
    letter-spacing: 0.02em;
    animation: preloader-pulse 1.6s ease-in-out infinite;
}

@keyframes preloader-spin {
    to { transform: rotate(360deg); }
}

@keyframes preloader-pulse {
    0%, 100% { opacity: 0.45; }
    50% { opacity: 0.95; }
}

@media (prefers-reduced-motion: reduce) {
    .preloader-wheel {
        animation-duration: 3s;
        animation-timing-function: linear;
    }
    .preloader-label {
        animation: none;
        opacity: 0.8;
    }
}

.settings-wrap {
    width: min(980px, 100%);
    margin: 0 auto;
}

.settings-wrap.narrow {
    width: min(440px, 100%);
}

.settings-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
    padding: 8px 4px 9px;
    background: #f5f7fb;
}

.settings-header-text {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.settings-header h1 {
    margin: 0;
    color: #0f172a;
    font-size: 32px;
    font-weight: 700;
    letter-spacing: 0;
}

.settings-subtitle {
    margin: 0;
    color: #64748b;
    font-size: 14.5px;
    line-height: 1.45;
}

.settings-card {
    position: relative;
    background: #ffffff;
    border: 1px solid #e8edf3;
    border-radius: 20px;
    padding: 28px;
    box-shadow: none;
}

.settings-card.login-card {
    padding: 32px 28px 28px;
}

/* ----- Tabs (segmented pill, in header) ----- */
.settings-tabs {
    display: inline-flex;
    flex-wrap: nowrap;
    flex: 0 0 auto;
    gap: 2px;
    padding: 4px;
    background: transparent;
    border-radius: 11px;
    border: 0;
}

.settings-tab {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 0;
    border-radius: 8px;
    padding: 6px 8px;
    background: transparent;
    color: #64748b;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.settings-tab svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    flex-shrink: 0;
}

.settings-tab:hover {
    color: #0f172a;
}

.settings-tab.active {
    background: #334155;
    color: #ffffff;
    box-shadow: none;
}

.settings-tab.active:hover {
    color: #ffffff;
}

/* ----- Hidden header measurement clone (for overflow detection) ----- */
.settings-header-measure {
    position: absolute;
    top: -9999px;
    left: 0;
    visibility: hidden;
    pointer-events: none;
    display: inline-flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 16px;
}

.settings-header-measure .settings-header-text {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.settings-header-measure .settings-header-text h1,
.settings-header-measure .settings-header-text p {
    margin: 0;
    white-space: nowrap;
}

.settings-header-measure .settings-tabs {
    flex: 0 0 auto;
    flex-wrap: nowrap;
}

.settings-header-measure .settings-tab {
    flex: 0 0 auto;
}

/* ----- Hamburger trigger (in header, icon-only, no border) ----- */
.settings-tabs-trigger {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #475569;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.settings-tabs-trigger:hover {
    background: rgba(15, 23, 42, 0.05);
    color: #0f172a;
}

.settings-tabs-trigger svg {
    width: 24px;
    height: 24px;
    fill: none;
    stroke: currentColor;
    flex-shrink: 0;
}

/* ----- Logout button ----- */
.logout-button {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    margin-left: -10px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #475569;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.logout-button:hover {
    background: rgba(180, 35, 24, 0.08);
    color: #b42318;
}

.logout-button svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    flex-shrink: 0;
}

.mobile-menu-logout {
    color: #b42318;
}

.mobile-menu-logout:hover {
    background: #fee2e2;
}

/* ----- Mobile menu sheet ----- */
.mobile-menu-backdrop {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 18px;
    background: rgba(15, 23, 42, 0.32);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    animation: backdrop-fade 0.18s ease-out;
}

.mobile-menu-sheet {
    width: 100%;
    max-width: 440px;
    background: #ffffff;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.30);
    animation: sheet-rise 0.2s ease-out;
}

@keyframes sheet-rise {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.mobile-menu-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
}

.mobile-menu-head strong {
    color: #475569;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.mobile-menu-list {
    display: flex;
    flex-direction: column;
}

.mobile-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border: 0;
    background: transparent;
    color: #0f172a;
    font: inherit;
    font-size: 15px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.mobile-menu-item:hover {
    background: #f8fafc;
}

.mobile-menu-item.active {
    color: var(--page-blue);
    background: #eff6ff;
    font-weight: 600;
}

.mobile-menu-item svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    flex-shrink: 0;
}

/* ----- Dashboard (home tab) ----- */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.dashboard-card {
    position: relative;
    padding: 18px;
    background: #ffffff;
    border: 1px solid #eef2f7;
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    box-shadow: none;
}

.dashboard-card-icon {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: #eff6ff;
    color: #2563eb;
}

.dashboard-card-icon svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
}

.dashboard-card-label {
    color: #64748b;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding-right: 44px;
    line-height: 1.3;
}

.dashboard-card-value {
    color: #0f172a;
    font-size: 32px;
    font-weight: 700;
    line-height: 1;
    margin-top: 4px;
    font-variant-numeric: tabular-nums;
}

.dashboard-card-meta {
    color: #475569;
    font-size: 13px;
    font-weight: 500;
    margin-top: 4px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.dashboard-pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
}

.dashboard-pill.winning {
    background: #fffbeb;
    color: #b45309;
    border: 1px solid #fde68a;
}

.dashboard-pill.losing {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.dashboard-recent {
    padding: 18px;
    background: #ffffff;
    border: 1px solid #eef2f7;
    border-radius: 14px;
    box-shadow: none;
}

.dashboard-recent-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    color: #64748b;
}

.dashboard-recent-head h3 {
    margin: 0;
    color: #475569;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.dashboard-recent-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.dashboard-recent-tile {
    min-height: 154px;
    display: grid;
    grid-template-rows: 1fr auto;
    align-items: center;
    justify-items: center;
    gap: 10px;
    padding: 16px 12px 12px;
    border-radius: 12px;
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.16), rgba(0, 0, 0, 0.10)),
        var(--recent-tile-bg);
    color: #ffffff;
    overflow: hidden;
}

.dashboard-recent-image {
    width: min(124px, 88%);
    height: 112px;
    object-fit: contain;
    filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.22));
}

.dashboard-recent-image-placeholder {
    width: 76px;
    height: 76px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
}

.dashboard-recent-tile-label {
    width: 100%;
    color: #ffffff;
    font-size: 15px;
    font-weight: 800;
    line-height: 1.2;
    text-align: center;
    text-shadow: none;
    overflow-wrap: anywhere;
}

.dashboard-recent-tile-label small {
    font-size: 12px;
    font-weight: 700;
    opacity: 0.9;
}

.dashboard-recent-empty {
    margin: 0;
    color: #94a3b8;
    font-size: 14px;
    text-align: center;
    padding: 16px 0;
}

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

    .dashboard-recent-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

}

@media (max-width: 620px) {
    .dashboard-card-value {
        font-size: 28px;
    }

    .dashboard-recent-tile {
        min-height: 138px;
    }
}

@media (max-width: 420px) {
    .dashboard-recent-grid {
        grid-template-columns: 1fr;
    }
}

/* ----- Tab heading (icon + title above panel) ----- */
.tab-heading {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 12px;
}

.tab-heading h2 {
    margin: 0;
    color: #0f172a;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1.2;
}

.tab-heading svg {
    width: 24px;
    height: 24px;
    fill: none;
    stroke: var(--page-blue);
    flex-shrink: 0;
}

/* ----- Tab description ----- */
.tab-description {
    margin: 0 0 24px;
    padding: 14px 16px;
    background: #f8fafc;
    border: 1px solid #eef2f7;
    border-radius: 12px;
    color: #475569;
    font-size: 14px;
    line-height: 1.55;
}

/* ----- Info block (bottom of each tab, after Save) ----- */
.info-block {
    margin-top: 18px;
    padding: 14px 16px;
    background: #f8fafc;
    border-radius: 12px;
    color: #475569;
}

.info-block-header {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #475569;
}

.info-block-header svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    flex-shrink: 0;
}

.info-block-title {
    margin: 0;
    color: #0f172a;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.info-block-text {
    margin: 12px 0 0;
    padding-top: 12px;
    border-top: 1px solid #e2e8f0;
    color: #64748b;
    font-size: 13.5px;
    line-height: 1.55;
}

.info-block-note {
    margin: 10px 0 0;
    padding: 8px 10px;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 8px;
    color: #92400e;
    font-size: 12.5px;
    line-height: 1.5;
}

@media (max-width: 620px) {
    .info-block {
        padding: 12px 14px;
    }
    .info-block-text {
        font-size: 13px;
    }
    .info-block-note {
        font-size: 12px;
    }
}

/* ----- Tab panel + sections ----- */
.settings-tab-panel {
    min-height: 0;
}

.frame-marker-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
    align-items: start;
}

.frame-marker-grid .settings-section {
    padding-top: 4px;
}

.settings-section {
    display: grid;
    gap: 14px;
    padding: 18px 0 0;
}

.settings-section:first-child {
    padding-top: 4px;
}

.settings-section-title {
    margin: 0;
    color: #475569;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.settings-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    align-items: end;
}

.settings-row.split-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.settings-row.split-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.modal-toggle-row {
    display: grid;
    gap: 12px;
    justify-items: start;
}

.behavior-note {
    margin-top: 18px;
    padding: 14px 16px;
    background: #f8fafc;
    border: 1px solid #e6edf5;
    border-radius: 12px;
    display: grid;
    gap: 8px;
}

.behavior-note p {
    margin: 0;
    color: #475569;
    font-size: 13.5px;
    line-height: 1.55;
}

.behavior-note strong {
    color: #1e293b;
    font-weight: 700;
}

.modal-toggle-field {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 0;
    color: #64748b;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.modal-toggle-field .modal-toggle-switch {
    margin-top: 2px;
}

.modal-toggle-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.modal-toggle-description {
    color: #94a3b8;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.4;
}

.settings-card .modal-toggle-description input.inline-number-input {
    display: inline-block;
    width: 2.5em;
    padding: 0 2px;
    margin: 0 1px;
    border: 1px solid #cbd5e1;
    border-radius: 3px;
    background: #ffffff;
    color: #1e293b;
    font-size: inherit;
    font-weight: 600;
    text-align: center;
    line-height: inherit;
    font-family: inherit;
    height: auto;
    vertical-align: baseline;
    box-sizing: content-box;
}

.settings-card .modal-toggle-description input.inline-number-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.settings-card .modal-toggle-description input.inline-number-input::-webkit-outer-spin-button,
.settings-card .modal-toggle-description input.inline-number-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.settings-card .modal-toggle-description input.inline-number-input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

.modal-toggle-field > input[type="checkbox"] {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.modal-toggle-switch {
    position: relative;
    flex: 0 0 auto;
    width: 36px;
    height: 20px;
    border-radius: 999px;
    background: #cbd5e1;
    transition: background-color 0.15s ease;
}

.modal-toggle-switch::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 999px;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.22);
    transition: transform 0.15s ease;
}

.modal-toggle-field input:checked + .modal-toggle-switch {
    background: #22c55e;
}

.modal-toggle-field input:checked + .modal-toggle-switch::after {
    transform: translateX(16px);
}

.modal-toggle-label {
    line-height: 1.35;
}

/* ----- Fields (outlined input with floating label) ----- */
.field {
    position: relative;
    display: block;
    margin: 0;
    font-weight: 400;
}

.field-stack {
    display: grid;
    gap: 18px;
}

.field-label,
.plain-field-label {
    position: absolute;
    top: 0;
    left: 11px;
    z-index: 1;
    max-width: calc(100% - 22px);
    padding: 0 6px;
    background: #ffffff;
    color: #64748b;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0.01em;
    transform: translateY(-50%);
    pointer-events: none;
    transition: color 0.15s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.field:focus-within .field-label,
.field:focus-within .plain-field-label {
    color: var(--page-blue);
}

/* ----- Inputs ----- */
.settings-card input[type="number"],
.settings-card input[type="password"],
.settings-card input[type="text"] {
    width: 100%;
    height: var(--control-height);
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 0 14px;
    background: #ffffff;
    color: #0f172a;
    font-size: 14.5px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.settings-card input[type="number"]:hover,
.settings-card input[type="password"]:hover,
.settings-card input[type="text"]:hover {
    border-color: #cbd5e1;
}

.settings-card input[type="number"]:focus,
.settings-card input[type="password"]:focus,
.settings-card input[type="text"]:focus {
    outline: 0;
    border-color: var(--page-blue);
    box-shadow: 0 0 0 3px rgba(11, 98, 198, 0.14);
}

.settings-card input::placeholder {
    color: #94a3b8;
}

/* ----- Color combo ----- */
.color-combo-field {
    min-width: 0;
}

.color-combo {
    width: 100%;
    height: var(--control-height);
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 0 8px 0 14px;
    background: #ffffff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.color-combo:hover {
    border-color: #cbd5e1;
}

.color-combo:focus-within {
    border-color: var(--page-blue);
    box-shadow: 0 0 0 3px rgba(11, 98, 198, 0.14);
}

.settings-card .color-combo .color-hex-input,
.settings-card .color-combo input.color-hex-input[type="text"] {
    min-width: 0;
    height: calc(var(--control-height) - 2px);
    flex: 1 1 auto;
    border: 0;
    border-radius: 0;
    padding: 0;
    background: transparent;
    color: #0f172a;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
    font-size: 13px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.settings-card .color-combo .color-hex-input:focus {
    outline: 0;
    box-shadow: none;
}

.settings-card input[type="color"],
.settings-card .color-picker-input {
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    padding: 0;
    border: 1px solid #d8dfe7;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    overflow: hidden;
    appearance: none;
    -webkit-appearance: none;
    align-self: center;
    box-shadow: inset 0 0 0 2px #ffffff;
}

.settings-card input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
    border: 0;
    border-radius: 50%;
}

.settings-card input[type="color"]::-webkit-color-swatch {
    border: 0;
    border-radius: 50%;
}

.settings-card input[type="color"]::-moz-color-swatch {
    border: 0;
    border-radius: 50%;
}

/* ----- Slice list / editor ----- */
.slice-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.slice-editor {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) 92px minmax(140px, 168px) max-content auto;
    align-items: end;
    gap: 12px;
    padding: 14px;
    background: #f8fafc;
    border: 1px solid #eef2f7;
    border-radius: 14px;
    transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.slice-editor.dragging {
    opacity: 0.4;
}

.slice-editor.drop-target {
    box-shadow: inset 0 3px 0 var(--page-blue);
    border-color: var(--page-blue);
}

.slice-grip {
    position: absolute;
    left: 6px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    width: 26px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #94a3b8;
    cursor: grab;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.slice-grip:hover {
    background: rgba(15, 23, 42, 0.06);
    color: #475569;
}

.slice-grip:active {
    cursor: grabbing;
}

.slice-grip svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
}

.slice-editor:hover {
    background: #ffffff;
    border-color: #dbe3ec;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.slice-editor .field {
    margin: 0;
}

.slice-name-field {
    position: relative;
}

.slice-name-input {
    padding-left: 38px !important;
}

.slice-editor .slice-size-field input {
    text-align: center;
    font-variant-numeric: tabular-nums;
}

/* ----- Image field ----- */
.image-field {
    display: block;
    color: var(--muted);
    font-size: 13px;
    font-weight: 400;
}

.file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.upload-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    height: var(--control-height);
    padding: 4px;
    border: 1px dashed #cbd5e1;
    border-radius: 10px;
    background: transparent;
    transition: border-color 0.15s ease;
}

.upload-controls:hover {
    border-color: #94a3b8;
}

.upload-preview {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    object-fit: contain;
    display: block;
    border-radius: 7px;
    background: transparent;
}

.upload-preview-placeholder {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 7px;
    background: transparent;
    color: #94a3b8;
    font-size: 11px;
    line-height: 1;
    text-align: center;
    padding: 0 4px;
    word-break: break-all;
}

.upload-preview-placeholder.has-file {
    color: #1d4ed8;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 36px;
    box-shadow: inset 0 0 0 1px #bfdbfe;
}

/* ----- Large image upload (background, frame) ----- */
.upload-large {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.upload-large-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.upload-text-button,
.danger-text-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    cursor: pointer;
}

.upload-text-button svg,
.danger-text-button svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
}

@media (max-width: 900px) {
    .upload-large-actions {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

.upload-text-button:hover {
    border-color: var(--page-blue);
    color: var(--page-blue);
    background: rgba(11, 98, 198, 0.04);
}

.danger-text-button:not(.disabled):not(:disabled):hover {
    border-color: #fecaca;
    background: #fef2f2;
    color: #b42318;
}

.danger-text-button.disabled,
.danger-text-button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

.upload-large-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 220px;
    border-radius: 14px;
    overflow: hidden;
    background: transparent;
    text-align: center;
}

.upload-large-preview > img {
    display: block;
    max-width: 100%;
    width: auto;
    height: auto;
    background: transparent;
    vertical-align: middle;
}

.upload-large-preview.with-overlay {
    container-type: inline-size;
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
}

.upload-large-preview.with-overlay > img {
    display: block;
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: fill;
}

/* ----- Static wheel preview (admin) ----- */
.wheel-shell.wheel-preview {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 676px;
    height: 676px;
    max-width: none;
    max-height: none;
    transform:
        translate(-50%, -50%)
        translate(calc(var(--wheel-offset-x, 0) * 1.918118cqi), calc(var(--wheel-offset-y, 0) * 2.011905cqi))
        scale(calc((35.208333cqi / 676px) * var(--wheel-scale, 1)));
    transform-origin: center center;
    pointer-events: none;
}

.wheel-shell.wheel-preview .spin-button {
    cursor: default;
}

/* ----- Wheel offset controls (background tab) ----- */
.wheel-offset-controls {
    width: 100%;
    min-height: 206px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-top: 2px;
    padding: 16px 18px 20px;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    background: #f8fafc;
}

.wheel-offset-title {
    width: 100%;
    margin: 0;
    color: #475569;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    line-height: 1.2;
    text-align: center;
    text-transform: uppercase;
}

.wheel-offset-pad {
    width: 152px;
    height: 152px;
    display: grid;
    grid-template-columns: repeat(3, 44px);
    grid-template-rows: repeat(3, 44px);
    gap: 10px;
}

.wheel-offset-body {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
}

.wheel-offset-btn {
    width: 44px;
    height: 44px;
    padding: 0;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #475569;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.wheel-scale-btn {
    width: 44px;
    height: 44px;
    padding: 0;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #475569;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.wheel-scale-btn:hover {
    background: #eff6ff;
    border-color: var(--page-blue);
    color: var(--page-blue);
}

.wheel-offset-btn:hover {
    background: #eff6ff;
    border-color: var(--page-blue);
    color: var(--page-blue);
}

.wheel-offset-btn svg,
.wheel-scale-btn svg {
    width: 26px;
    height: 26px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
}

.wheel-offset-btn.up {
    grid-column: 2;
    grid-row: 1;
}

.wheel-offset-btn.down {
    grid-column: 2;
    grid-row: 3;
}

.wheel-offset-btn.left {
    grid-column: 1;
    grid-row: 2;
}

.wheel-offset-btn.right {
    grid-column: 3;
    grid-row: 2;
}

.wheel-offset-btn.center {
    grid-column: 2;
    grid-row: 2;
}

.upload-large-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 220px;
    padding: 24px;
    border: 1px dashed #cbd5e1;
    border-radius: 14px;
    color: #94a3b8;
    font-size: 14px;
    text-align: center;
}

.upload-large-empty.has-file {
    color: #1d4ed8;
    border-style: solid;
    border-color: #bfdbfe;
    background: rgba(59, 130, 246, 0.04);
    font-weight: 600;
}

.upload-controls .status {
    min-width: 0;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.icon-button {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.icon-button:hover:not(:disabled):not(.disabled) {
    background: #f1f5f9;
    color: #0f172a;
}

.icon-button.upload:hover:not(.disabled) {
    color: var(--page-blue);
    background: rgba(11, 98, 198, 0.08);
}

.icon-button.danger:hover:not(.disabled):not(:disabled) {
    background: #fee2e2;
    color: #b42318;
}

.icon-button svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
}

.icon-button.disabled,
.icon-button:disabled {
    cursor: default;
    opacity: 0.32;
}

.text-button {
    justify-self: start;
    border: 0;
    padding: 0;
    background: transparent;
    color: #b42318;
    cursor: pointer;
    font-weight: 700;
}

/* ----- Unify button (slice editor) ----- */
.unify-button {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 10;
    display: none;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #ffffff;
    color: var(--page-blue);
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.12);
    white-space: nowrap;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.unify-button:hover {
    background: #eff6ff;
    border-color: var(--page-blue);
}

.field:focus-within > .unify-button {
    display: inline-flex;
}

/* ----- Slice winning toggle ----- */
.slice-winning-toggle {
    width: var(--control-height);
    height: var(--control-height);
    padding: 0;
    flex-shrink: 0;
    border: 1px dashed #cbd5e1;
    border-radius: 10px;
    background: transparent;
    color: #cbd5e1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.slice-winning-toggle:hover {
    border-color: #94a3b8;
    color: #94a3b8;
}

.slice-winning-toggle.active {
    border-color: #94a3b8;
    background: rgba(15, 23, 42, 0.08);
    color: #475569;
}

.slice-winning-toggle.active:hover {
    background: rgba(15, 23, 42, 0.12);
}

.slice-winning-toggle:disabled,
.slice-winning-toggle.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f1f5f9;
    border-style: solid;
    border-color: #e2e8f0;
    pointer-events: none;
}

.slice-winning-toggle svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    flex-shrink: 0;
}

/* ----- Inline icon in tab description ----- */
.tab-description-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    margin: -2px 1px 0;
    vertical-align: middle;
    border-radius: 6px;
    background: rgba(15, 23, 42, 0.08);
    color: #475569;
    border: 1px solid #cbd5e1;
}

.tab-description-icon svg {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
}

/* ----- Inline link button in tab description ----- */
.tab-description-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 22px;
    padding: 0 8px;
    margin: -2px 1px 0;
    vertical-align: middle;
    border: 1px solid #d8e2ef;
    border-radius: 6px;
    background: #ffffff;
    color: var(--page-blue);
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.tab-description-link:hover {
    background: #eff6ff;
    border-color: var(--page-blue);
}

.tab-description-link svg {
    width: 12px;
    height: 12px;
    fill: none;
    stroke: currentColor;
    flex-shrink: 0;
}

/* ----- Chances tab summary ----- */
.chances-summary {
    margin: 6px 0 0;
    color: #475569;
    font-size: 13.5px;
}

.chances-warning {
    color: #b45309;
    font-weight: 600;
}

/* ----- Instant lock tooltip + disabled look for event-locked fields ----- */
.lock-tooltip {
    position: relative;
    display: flex;
}

/* When wrapping a full field (e.g. slice count in a grid row), fill the cell. */
.lock-tooltip > .field {
    flex: 1 1 auto;
    width: 100%;
}

.lock-tooltip input:disabled,
.lock-tooltip button:disabled {
    /* Disabled controls don't fire mouse events; let the pointer reach the
       wrapper so the :hover tooltip shows reliably. */
    pointer-events: none;
}

.lock-tooltip::after {
    content: attr(data-lock-tip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    width: max-content;
    max-width: 240px;
    padding: 8px 11px;
    background: #1e293b;
    color: #f8fafc;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.45;
    white-space: normal;
    text-align: left;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: 60;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.22);
}

.lock-tooltip::before {
    content: "";
    position: absolute;
    bottom: calc(100% + 3px);
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #1e293b;
    opacity: 0;
    visibility: hidden;
    z-index: 60;
}

.lock-tooltip:hover::after,
.lock-tooltip:hover::before {
    opacity: 1;
    visibility: visible;
}

/* Make the locked state clearly readable as disabled. */
.field-locked {
    opacity: 0.65;
}

.field.field-locked .field-label {
    color: #94a3b8;
}

.dashboard-card-value.time-based {
    color: #2563eb;
}

.chances-info-note {
    margin: 8px 0 0;
    padding: 10px 12px;
    border-radius: 8px;
    background: #eff6ff;
    border: 1px solid #dbeafe;
    color: #1d4ed8;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.45;
}

.settings-card input.computed-chance-input[type="text"] {
    height: var(--control-height, 40px);
    padding: 0 12px;
    border: 1px solid #dbe3ec;
    border-radius: 8px;
    background: #eef2f7;
    color: #1e293b;
    font-size: 14px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    cursor: default;
}

/* ----- Chances tab: per-slice distribution ----- */
.chance-slice-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chance-slice-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: #f8fafc;
    border: 1px solid #eef2f7;
    border-radius: 10px;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.chance-slice-row.active {
    background: #ffffff;
    border-color: #dbe3ec;
}

.settings-card input.chance-slice-label[type="text"] {
    flex: 1 1 auto;
    height: 38px;
    padding: 0 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #ffffff;
    color: #0f172a;
    font-size: 14px;
    cursor: not-allowed;
    opacity: 1;
}

.settings-card input.chance-slice-label[type="text"]:disabled {
    color: #475569;
    background: #f1f5f9;
}

.chance-slice-weight-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
}

.settings-card input.chance-slice-weight[type="text"] {
    width: 72px;
    height: 38px;
    padding: 0 22px 0 8px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #ffffff;
    color: #0f172a;
    font-size: 14px;
    font-variant-numeric: tabular-nums;
    text-align: center;
}

.settings-card input.chance-slice-weight[type="text"]:disabled {
    background: #f1f5f9;
    color: #94a3b8;
    cursor: not-allowed;
}

.chance-slice-percent {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 13.5px;
    font-weight: 600;
    pointer-events: none;
    user-select: none;
}

.chance-slice-stock-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
}

.settings-card input.chance-slice-stock[type="text"] {
    width: 86px;
    height: 38px;
    padding: 0 26px 0 8px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #ffffff;
    color: #0f172a;
    font-size: 14px;
    font-variant-numeric: tabular-nums;
    text-align: center;
}

.settings-card input.chance-slice-stock[type="text"]:disabled {
    background: #f1f5f9;
    color: #94a3b8;
    cursor: not-allowed;
}

.chance-slice-actual {
    flex: 0 0 auto;
    min-width: 80px;
    padding: 0 12px;
    color: #475569;
    font-size: 13px;
    font-weight: 600;
    text-align: right;
    letter-spacing: 0.02em;
}

.chance-slice-actual-empty {
    color: #cbd5e1;
}

/* ----- Chances tab: time-based event ----- */
.event-block {
    padding: 16px;
    background: #f8fafc;
    border: 1px solid #e6edf5;
    border-radius: 14px;
}

.event-controls {
    display: grid;
    gap: 14px;
}

.event-toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    cursor: pointer;
}

.event-toggle input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #0b62c6;
    cursor: pointer;
}

.event-toggle input[type="checkbox"]:disabled {
    cursor: not-allowed;
}

.event-duration-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    align-items: end;
}

.settings-card input.event-human-input[readonly],
.event-human input[readonly] {
    background: #f1f5f9;
    color: #475569;
    cursor: default;
}

.event-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.event-actions .primary {
    height: 40px;
}

.event-status {
    margin-top: 4px;
    padding: 14px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    display: grid;
    gap: 12px;
}

.event-status-head {
    display: flex;
    align-items: center;
    gap: 10px;
}

.event-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.event-badge.status-draft {
    background: #e2e8f0;
    color: #475569;
}

.event-badge.status-running {
    background: #dcfce7;
    color: #15803d;
}

.event-badge.status-ended {
    background: #fee2e2;
    color: #b91c1c;
}

.event-status-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px 16px;
}

.event-status-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.event-status-label {
    color: #94a3b8;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.event-status-value {
    color: #0f172a;
    font-size: 14px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.event-direction {
    margin: 0;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    background: #f1f5f9;
    color: #475569;
}

.event-direction.direction-raising {
    background: #ecfdf5;
    color: #047857;
}

.event-direction.direction-lowering {
    background: #fff7ed;
    color: #c2410c;
}

.event-warning {
    margin: 0;
    padding: 8px 12px;
    border-radius: 8px;
    background: #fef3c7;
    color: #92400e;
    font-size: 13px;
    font-weight: 600;
}

/* ----- Chances tab: per-slice consumption ----- */
.consumption-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.consumption-row {
    display: grid;
    grid-template-columns: 2fr repeat(4, 1fr);
    gap: 10px;
    align-items: center;
    padding: 8px 12px;
    background: #f8fafc;
    border: 1px solid #eef2f7;
    border-radius: 10px;
    font-size: 13.5px;
    color: #0f172a;
    font-variant-numeric: tabular-nums;
}

.consumption-row.consumption-head {
    background: transparent;
    border: none;
    padding: 0 12px;
    color: #94a3b8;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.consumption-label {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.consumption-percent {
    font-weight: 700;
    color: #0b62c6;
}

.consumption-percent.consumption-empty {
    color: #cbd5e1;
}

@media (max-width: 640px) {
    .event-duration-row {
        grid-template-columns: 1fr;
    }
    .event-status-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .consumption-row {
        grid-template-columns: 1.6fr repeat(4, 1fr);
        font-size: 12px;
        gap: 6px;
        padding: 8px;
    }
}

/* ----- Logs button next to chance input ----- */
.logs-open-button {
    height: var(--control-height);
    padding: 0 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.logs-open-button svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    flex-shrink: 0;
}

/* ----- Logs modal ----- */
.logs-modal {
    width: min(560px, 100%);
    max-height: calc(100vh - 80px);
    display: flex;
    flex-direction: column;
}

.logs-modal-body {
    margin-top: 14px;
    flex: 1 1 auto;
    overflow-y: auto;
    max-height: 60vh;
}

.logs-empty {
    margin: 16px 0;
    color: #94a3b8;
    font-size: 14px;
    text-align: center;
}

.logs-modal-stats {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    margin-bottom: 12px;
    background: #f1f5f9;
    border-radius: 8px;
    color: #475569;
    font-size: 13px;
}

.logs-modal-stats span {
    flex: 1 1 auto;
    text-align: center;
}

.logs-modal-stats strong {
    color: #0f172a;
    font-weight: 700;
}

.logs-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.logs-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: #f8fafc;
    border-radius: 8px;
    color: #0f172a;
    font-size: 14px;
}

.logs-list-item.winning {
    background: rgba(15, 23, 42, 0.06);
}

.logs-list-time {
    flex: 0 0 auto;
    color: #64748b;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.logs-list-label {
    flex: 1 1 auto;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.logs-list-badge {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    color: #475569;
}

.logs-list-badge svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
}

.logs-list-stock {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 10px;
    background: #e0f2fe;
    color: #075985;
    font-size: 12px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.logs-list-stock.empty {
    background: #fef2f2;
    color: #b42318;
}

.logs-modal-actions {
    margin-top: 16px;
    flex-shrink: 0;
}

.logs-modal-actions .primary.disabled,
.logs-modal-actions .primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

@media (max-width: 620px) {
    .logs-list-item {
        flex-wrap: wrap;
        gap: 4px 12px;
    }
    .logs-list-time {
        flex: 1 1 100%;
        font-size: 12px;
    }
}

/* ----- Actions / buttons ----- */
.actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 18px;
}

.actions-block {
    margin-top: 8px;
}

.primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    border-radius: 10px;
    padding: 12px 22px;
    background: var(--page-blue);
    color: #ffffff;
    font-size: 14.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease, transform 0.05s ease, box-shadow 0.15s ease;
    box-shadow:
        0 1px 2px rgba(11, 98, 198, 0.25),
        0 6px 16px rgba(11, 98, 198, 0.18);
}

.primary svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    flex-shrink: 0;
}

.primary:hover {
    background: #094fa3;
}

.primary:active {
    transform: translateY(1px);
    box-shadow:
        0 1px 2px rgba(11, 98, 198, 0.25),
        0 2px 6px rgba(11, 98, 198, 0.18);
}

.primary:focus-visible {
    outline: 0;
    box-shadow:
        0 0 0 3px rgba(11, 98, 198, 0.25),
        0 6px 16px rgba(11, 98, 198, 0.18);
}

.primary-block {
    width: 100%;
    padding: 13px 22px;
}

.danger-primary {
    background: #b42318;
    box-shadow:
        0 1px 2px rgba(180, 35, 24, 0.25),
        0 6px 16px rgba(180, 35, 24, 0.18);
}

.danger-primary:hover {
    background: #991b15;
}

.secondary-button {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 11px 20px;
    background: #ffffff;
    color: #0f172a;
    font-size: 14.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.secondary-button:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

/* ----- Modals ----- */
.confirm-backdrop {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(15, 23, 42, 0.42);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    animation: backdrop-fade 0.15s ease-out;
}

@keyframes backdrop-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

.confirm-modal {
    width: min(420px, 100%);
    border: 0;
    border-radius: 18px;
    padding: 24px;
    background: #ffffff;
    color: var(--ink);
    box-shadow: 0 24px 64px rgba(15, 23, 42, 0.28);
    animation: modal-rise 0.18s ease-out;
}

@keyframes modal-rise {
    from { opacity: 0; transform: translateY(8px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.confirm-modal p {
    margin: 14px 0 0;
    color: #64748b;
    font-size: 14.5px;
    line-height: 1.5;
}

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

.confirm-modal .settings-modal-header {
    color: #b42318;
}

.warning-modal-header {
    color: #b45309 !important;
}

.warning-modal-header svg {
    width: 24px;
    height: 24px;
}

.settings-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 30;
    width: min(360px, calc(100vw - 32px));
    padding: 16px 18px;
    border: 1px solid #e8edf3;
    border-radius: 14px;
    background: #ffffff;
    color: var(--ink);
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.25);
    animation: toast-pop-in 0.22s ease-out;
}

@keyframes toast-pop-in {
    from { opacity: 0; transform: translate(-50%, -50%) scale(0.95); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.settings-modal-header {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #16a34a;
}

.settings-modal-header svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
}

.settings-modal-header strong {
    color: #0f172a;
    font-size: 15px;
    font-weight: 700;
}

.settings-modal-line {
    display: none;
}

.settings-modal p {
    margin: 10px 0 0;
    color: #64748b;
    font-size: 14px;
    font-weight: 400;
}

.secondary-link {
    color: var(--page-blue);
    font-weight: 700;
    text-decoration: none;
}

.status {
    min-height: 22px;
    color: var(--muted);
}

.error {
    margin: 8px 0 0;
    padding: 10px 12px;
    border-radius: 8px;
    background: #fef2f2;
    color: #b42318;
    font-size: 13.5px;
    font-weight: 500;
}

/* ----- Responsive ----- */
@media (max-width: 620px) {
    .page {
        padding: 16px;
    }

    .wheel-shell {
        width: 96vmin;
        height: 96vmin;
        max-width: 559px;
        max-height: 559px;
    }

    .wheel {
        width: calc(100% - 42px);
        height: calc(100% - 42px);
    }

    .spin-button {
        font-size: 13px;
    }

    .settings-page {
        padding: 24px 14px 40px;
        background: #f5f7fb;
    }

    .settings-card {
        padding: 20px 16px;
        border-radius: 16px;
    }

    .settings-header h1 {
        font-size: 26px;
    }

    .settings-tabs-trigger {
        width: 40px;
        height: 40px;
    }

    .settings-header {
        gap: 10px;
    }

    .settings-header h1 {
        font-size: 22px;
    }

    .settings-subtitle {
        font-size: 13px;
    }

    .tab-heading h2 {
        font-size: 19px;
    }

    .tab-description {
        padding: 12px 14px;
        font-size: 13.5px;
    }

    .settings-row {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .settings-row.split-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    .upload-large-actions {
        gap: 12px;
    }

    .frame-marker-grid .settings-row.split-2 {
        gap: 16px;
    }

    .frame-marker-grid .upload-large-actions {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .settings-row.cols-keep {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
    }

    .modal-toggle-row {
        gap: 8px;
    }

    .settings-row.cols-marker {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .settings-row.cols-marker > :nth-child(3) {
        grid-column: 1 / -1;
    }

    .slice-editor {
        grid-template-columns: minmax(70px, 1fr) minmax(114px, 1fr) max-content auto;
        gap: 8px;
        padding: 12px;
    }

    .slice-editor .slice-name-field {
        grid-column: 1 / -1;
        grid-row: 1;
    }

    .slice-editor .slice-size-field {
        grid-column: 1;
        grid-row: 2;
        min-width: 0;
    }

    .slice-editor .color-combo-field {
        grid-column: 2;
        grid-row: 2;
        min-width: 0;
    }

    .slice-editor .image-field {
        grid-column: 3;
        grid-row: 2;
        min-width: 0;
        justify-self: end;
    }

    .slice-editor .slice-winning-toggle {
        grid-column: 4;
        grid-row: 2;
        justify-self: end;
    }

    .upload-controls {
        min-width: 0;
        gap: 4px;
        justify-content: flex-end;
    }

    .upload-controls .status {
        max-width: 46px;
    }
}

@media (max-width: 480px) {
    .settings-page {
        padding: 20px 12px 32px;
    }

    .settings-card {
        padding: 16px 12px;
    }

    .frame-marker-grid {
        grid-template-columns: 1fr;
        gap: 18px;
    }

    .slice-editor {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        gap: 8px;
        padding: 12px;
    }

    .slice-editor .slice-name-field {
        grid-column: 1 / -1;
        grid-row: 1;
    }

    .slice-editor .slice-size-field {
        grid-column: 1;
        grid-row: 2;
    }

    .slice-editor .color-combo-field {
        grid-column: 2;
        grid-row: 2;
    }

    .slice-editor .image-field {
        grid-column: 1;
        grid-row: 3;
        justify-self: stretch;
    }

    .slice-editor .slice-winning-toggle {
        grid-column: 2;
        grid-row: 3;
        width: 100%;
        justify-self: stretch;
    }

    .slice-editor .upload-controls {
        justify-content: flex-start;
    }

    .actions {
        justify-content: stretch;
    }

    .actions .primary,
    .actions .secondary-button {
        flex: 1 1 auto;
    }
}
