/* The Daily Vault — fun & trustworthy redesign */

/* Local overrides on top of fundash-base.css tokens */
:root {
    --vault-bg:      #07101e;
    --vault-surface: #101e34;
    --vault-border:  rgba(148, 163, 184, 0.22);
    --vault-accent:  #22d3ee;
    --vault-accent-dim: #17a2b8;
    --vault-text:    #eef4ff;
    --vault-muted:   #8fa6c4;
    --vault-success: #10b981;
    --vault-danger:  #f43f5e;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    height: 100%;
    font-family: "Inter", "Lexend", system-ui, sans-serif;
    background: var(--vault-bg);
    color: var(--vault-text);
    -webkit-tap-highlight-color: transparent;
    overflow: hidden;
}

/* ─── App shell ─── */

.vault-app {
    height: 100dvh;
    max-height: 100dvh;
    display: grid;
    grid-template-rows: auto 1fr auto;
    gap: 0.25rem;
    padding:
        calc(0.45rem + env(safe-area-inset-top))
        calc(0.55rem + env(safe-area-inset-right))
        calc(0.35rem + env(safe-area-inset-bottom))
        calc(0.55rem + env(safe-area-inset-left));
    box-sizing: border-box;
    overflow: hidden;
    align-items: center;
    justify-items: center;
}

/* ─── Header ─── */

.vault-header {
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    margin-bottom: 0;
    position: relative;
    z-index: 120;
}

.vault-brand {
    display: inline-flex;
    align-self: flex-start;
    line-height: 0;
    text-decoration: none;
}

.vault-prize {
    text-align: center;
    width: 100%;
    font-size: clamp(0.66rem, 2.6vw, 0.76rem);
    color: var(--vault-muted);
    line-height: 1.3;
}

.vault-prize strong {
    display: block;
    color: var(--vault-text);
    font-size: clamp(0.74rem, 3vw, 0.88rem);
    font-weight: 700;
    line-height: 1.25;
}

/* ─── Main vault panel ─── */

.vault-shell {
    width: 100%;
    max-width: 420px;
    max-height: 100%;
    background: linear-gradient(175deg, rgba(18, 30, 52, 0.97) 0%, rgba(10, 18, 34, 0.99) 100%);
    border: 1px solid var(--vault-border);
    border-radius: 20px;
    padding: clamp(0.75rem, 3vw, 1rem);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 16px 40px rgba(2, 8, 20, 0.5);
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
    position: relative;
    z-index: 120;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

/* State variants */
.vault-shell.is-open {
    border-color: var(--vault-accent-dim);
    box-shadow:
        inset 0 1px 0 rgba(34, 211, 238, 0.18),
        0 0 0 1px rgba(34, 211, 238, 0.22),
        0 12px 28px rgba(8, 130, 160, 0.2);
}

.vault-shell.is-error {
    animation: vault-shake 0.5s ease;
    border-color: var(--vault-danger);
    box-shadow: 0 0 20px rgba(244, 63, 94, 0.35);
}

.vault-shell.is-win-pulse {
    animation: vault-win-glow 0.85s ease;
    border-color: var(--vault-success);
    box-shadow: 0 0 24px rgba(16, 185, 129, 0.32);
}

/* ─── Title ─── */

.vault-title {
    text-align: center;
    font-size: 0.68rem;
    letter-spacing: 0.2em;
    color: var(--vault-muted);
    margin: 0 0 0.45rem;
    text-transform: uppercase;
}

/* ─── Digit display ─── */

.digit-row {
    display: flex;
    justify-content: center;
    gap: clamp(0.35rem, 2.5vw, 0.55rem);
    margin-bottom: 0.55rem;
}

.digit-cell {
    width: clamp(2.85rem, 16vw, 4.25rem);
    height: clamp(3.35rem, 17vw, 5rem);
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, #1a2d4a 0%, #111e35 100%);
    border: 1.5px solid rgba(100, 148, 210, 0.38);
    border-radius: 12px;
    font-size: clamp(1.75rem, 9vw, 2.35rem);
    font-weight: 800;
    color: var(--vault-text);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.12),
        0 6px 14px rgba(2, 8, 20, 0.38);
    transition: color 0.2s, border-color 0.2s, transform 0.08s ease;
}

.digit-cell.tick { animation: digit-tick 0.12s ease; }

@keyframes digit-tick {
    0%   { transform: scale(1); }
    50%  { transform: scale(0.92); }
    100% { transform: scale(1); }
}

.vault-shell.is-error .digit-cell {
    color: #fca5a5;
    border-color: rgba(244, 63, 94, 0.55);
}

.vault-shell.is-open .digit-cell {
    color: var(--vault-accent);
    border-color: var(--vault-accent-dim);
}

/* ─── Status line ─── */

.status-line {
    text-align: center;
    font-size: 0.82rem;
    color: var(--vault-muted);
    min-height: 1.4em;
    margin-bottom: 0.45rem;
}

.status-line strong { color: var(--vault-text); }

/* ─── Hint panel ─── */

.hint-panel {
    display: none;
    margin-bottom: 0.85rem;
    padding: 0.65rem 0.8rem;
    border-radius: 12px;
    border: 1px solid rgba(34, 211, 238, 0.2);
    background: rgba(34, 211, 238, 0.06);
    font-size: clamp(0.78rem, 3vw, 0.84rem);
    color: #cde9f3;
    line-height: 1.5;
}

.hint-panel.visible { display: block; }

.hint-cta {
    display: none;
    width: 100%;
    margin-bottom: 0.75rem;
    padding: 0.65rem;
    border-radius: 12px;
    border: 1px solid rgba(34, 211, 238, 0.3);
    background: rgba(34, 211, 238, 0.07);
    color: var(--vault-accent);
    font-weight: 700;
    font-size: clamp(0.85rem, 3.5vw, 0.95rem);
    min-height: 44px;
    cursor: pointer;
    font-family: inherit;
    position: relative;
    z-index: 125;
    transition: background 0.15s;
}

.hint-cta:hover { background: rgba(34, 211, 238, 0.12); }
.hint-cta.visible { display: block; }

/* ─── Number keypad ─── */

.keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.45rem;
    max-width: 320px;
    margin: 0 auto 0.35rem;
}

.keypad-row-zero {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.45rem;
    max-width: 320px;
    margin: 0 auto 0.45rem;
}

.keypad-row-zero .key-spacer { pointer-events: none; }

.key {
    aspect-ratio: 1.15;
    max-height: clamp(2.55rem, 9.5vw, 3.15rem);
    min-height: 44px;
    border-radius: 12px;
    border: 1px solid rgba(100, 148, 210, 0.38);
    background:
        linear-gradient(160deg, rgba(255, 255, 255, 0.13) 0%, transparent 42%),
        linear-gradient(145deg, #1e3256 0%, #111e35 50%, #1a2d4a 100%);
    color: var(--vault-text);
    font-size: 1.15rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    box-shadow:
        0 3px 0 #06111f,
        inset 0 1px 0 rgba(255, 255, 255, 0.2),
        inset 0 -8px 18px rgba(1, 6, 16, 0.32);
    transition: transform 0.07s ease, box-shadow 0.07s ease;
}

.key:active {
    transform: translateY(2px);
    box-shadow: 0 1px 0 #06111f;
}

.key-wide {
    max-height: none;
    min-height: 2.85rem;
    aspect-ratio: auto;
}

.key-clear {
    border-color: rgba(100, 148, 210, 0.24);
    color: var(--vault-muted);
    font-size: 0.84rem;
}

/* ─── Submit button ─── */

.key-unseal {
    grid-column: 1 / -1;
    width: 100%;
    max-width: 320px;
    margin: 0.15rem auto 0;
    display: block;
    padding: 0.75rem 1rem;
    min-height: 50px;
    border: 0;
    border-radius: 16px;
    background: linear-gradient(135deg, #5b5eff 0%, #22d3ee 60%, #10b981 100%);
    color: #fff;
    font-weight: 800;
    font-size: clamp(0.95rem, 4vw, 1.1rem);
    letter-spacing: 0.03em;
    cursor: pointer;
    font-family: inherit;
    box-shadow: 0 6px 20px rgba(91, 94, 255, 0.3);
    transition: transform 0.07s ease, box-shadow 0.07s ease;
    position: relative;
    z-index: 125;
}

.key-unseal:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 28px rgba(91, 94, 255, 0.4);
}

.key-unseal:active {
    transform: translateY(2px);
    box-shadow: 0 3px 10px rgba(91, 94, 255, 0.2);
}

.key-unseal:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ─── Ad strip (hidden) ─── */

.ad-strip {
    width: min(320px, 100%);
    max-width: 320px;
    min-height: 50px;
    max-height: 50px;
    margin-top: 0.1rem;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    font-size: 0.65rem;
    letter-spacing: 0.15em;
    color: var(--vault-muted);
    z-index: 90;
    opacity: 0;
    pointer-events: none;
}

/* ─── Full-screen ad overlay ─── */

.ad-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.88);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    text-align: center;
}

.ad-overlay-msg {
    color: #fff;
    font-size: clamp(1.2rem, 5vw, 1.65rem);
    font-weight: 800;
    margin-bottom: 1.5rem;
}

.ad-overlay-btn {
    display: none;
    margin-top: 0.5rem;
    padding: 0.75rem 1.25rem;
    font-size: clamp(1rem, 4vw, 1.35rem);
    font-weight: 800;
    font-family: inherit;
    border: none;
    border-radius: 12px;
    cursor: pointer;
}

.ad-overlay-btn.is-hint,
.ad-overlay-btn.is-unseal {
    background: linear-gradient(135deg, #5b5eff, #22d3ee);
    color: #fff;
}

/* ─── Animations ─── */

@keyframes vault-win-glow {
    0%, 100% { box-shadow: 0 0 18px rgba(16, 185, 129, 0.22); }
    50%       { box-shadow: 0 0 32px rgba(34, 211, 238, 0.4); }
}

@keyframes vault-shake {
    0%, 100% { transform: translateX(0); }
    20%       { transform: translateX(-9px); }
    40%       { transform: translateX(9px); }
    60%       { transform: translateX(-5px); }
    80%       { transform: translateX(5px); }
}

/* ─── Short phone compact pass ─── */

@media (max-height: 780px) {
    .vault-shell   { padding: clamp(0.45rem, 2vw, 0.7rem); }
    .vault-title   { margin-bottom: 0.25rem; font-size: 0.62rem; }
    .digit-cell    { width: clamp(2.65rem, 15vw, 4rem); height: clamp(3rem, 15vw, 4.5rem); font-size: clamp(1.5rem, 8vw, 2.1rem); }
    .digit-row     { margin-bottom: 0.35rem; }
    .status-line   { font-size: 0.76rem; margin-bottom: 0.3rem; min-height: 1.3em; }
    .keypad        { gap: 0.35rem; margin-bottom: 0.25rem; }
    .keypad-row-zero { gap: 0.35rem; margin-bottom: 0.35rem; }
    .key           { max-height: clamp(2.3rem, 8.5vw, 2.8rem); font-size: 1rem; }
    .key-unseal    { padding: 0.58rem 1rem; font-size: 0.95rem; }
    .vault-header  { gap: 0.18rem; }
}

@media (max-height: 680px) {
    .vault-shell { padding: 0.45rem; }
    .digit-cell  { height: clamp(2.7rem, 12vw, 3.8rem); font-size: clamp(1.35rem, 7vw, 1.9rem); }
    .key         { max-height: 2.5rem; }
    .key-unseal  { padding: 0.5rem 1rem; min-height: 44px; font-size: 0.9rem; }
}

@media (max-width: 360px) {
    .vault-shell { border-radius: 16px; max-width: calc(100% - 16px); }
}
