/* ============================================================================
   Bootstrap 3.3.7 base — inlined (replaces the maxcdn <link> that used to sit
   in index.html <head>). See MARKETING_STRATEGY.md Phase 0 #6 (payload trim).
   ----------------------------------------------------------------------------
   The game used almost none of Bootstrap — no grid, no JS plugins — and the
   rules further down this file already restyle its buttons/panels in a
   monochrome palette. What it *inherited* from Bootstrap's normalize +
   scaffolding was a small structural base: control font inheritance (so native
   <button>/<input> pick up TikTok Sans), link colours, heading sizing, `p`/
   list margins, `.btn` layout, box-sizing on pseudo-elements, `.form-control`,
   `.container-fluid` and `.sr-only`. Those exact declarations are reproduced
   here verbatim from Bootstrap 3.3.7 and kept at the TOP of the file so every
   game rule that follows overrides them exactly as it did when the CDN sheet
   loaded ahead of styles.css.

   Deliberately NOT inlined (unused or fully restyled below, and re-adding them
   would only reintroduce Bootstrap's blue): the colour button variants
   (.btn-primary/.btn-success/.btn-danger blues and their :hover/:focus states),
   .container max-widths, .row, .panel and .close. The game defines its own
   .btn-primary/.btn-secondary, so its buttons keep their monochrome look.
   ========================================================================== */

/* normalize.css v3.0.3 (subset the game inherits) */
html { font-family: sans-serif; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; }
body { margin: 0; }
a { background-color: transparent; }
a:active, a:hover { outline: 0; }
img { border: 0; vertical-align: middle; }
button, input, optgroup, select, textarea { margin: 0; font: inherit; color: inherit; }
button { overflow: visible; }
button, select { text-transform: none; }
button, html input[type="button"], input[type="reset"], input[type="submit"] { -webkit-appearance: button; cursor: pointer; }
button::-moz-focus-inner, input::-moz-focus-inner { padding: 0; border: 0; }
/* the character cards are clickable role="button" divs — Bootstrap's normalize
   gave them (and, via inheritance, their contents) a pointer cursor. */
[role="button"] { cursor: pointer; }

/* box-sizing (styles.css already sets it on `*`; add the pseudo-elements) */
:after, :before { box-sizing: border-box; }

/* scaffolding + type */
a { color: #337ab7; text-decoration: none; }
a:focus, a:hover { color: #23527c; text-decoration: underline; }
a:focus { outline: 5px auto -webkit-focus-ring-color; outline-offset: -2px; }
h1, h2, h3, h4, h5, h6 { font-family: inherit; font-weight: 500; line-height: 1.1; color: inherit; }
h1, h2, h3 { margin-top: 20px; margin-bottom: 10px; }
h4, h5, h6 { margin-top: 10px; margin-bottom: 10px; }
h1 { font-size: 36px; }
h2 { font-size: 30px; }
h3 { font-size: 24px; }
h4 { font-size: 18px; }
h5 { font-size: 14px; }
h6 { font-size: 12px; }
p { margin: 0 0 10px; }
ol, ul { margin-top: 0; margin-bottom: 10px; }
ol ol, ol ul, ul ol, ul ul { margin-bottom: 0; }

/* forms */
button, input, select, textarea { font-family: inherit; font-size: inherit; line-height: inherit; }
label { display: inline-block; max-width: 100%; margin-bottom: 5px; font-weight: 700; }
.form-control {
    display: block;
    width: 100%;
    height: 34px;
    padding: 6px 12px;
    font-size: 14px;
    line-height: 1.42857143;
    color: #555;
    background-color: #fff;
    background-image: none;
    border: 1px solid #ccc;
    border-radius: 4px;
    -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
    box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
    -webkit-transition: border-color ease-in-out .15s, -webkit-box-shadow ease-in-out .15s;
    -o-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
    transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
}

/* grid container (the game overrides the horizontal padding further down) */
.container-fluid { padding-right: 15px; padding-left: 15px; margin-right: auto; margin-left: auto; }

/* .page-header component — the game reuses this class and overrides everything
   below except margin-bottom, which it relies on for the header's spacing. */
.page-header { padding-bottom: 9px; margin: 40px 0 20px; border-bottom: 1px solid #eee; }

/* buttons — structural base only; the game supplies its own colours below */
.btn {
    display: inline-block;
    padding: 6px 12px;
    margin-bottom: 0;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.42857143;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    -ms-touch-action: manipulation;
    touch-action: manipulation;
    cursor: pointer;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    background-image: none;
    border: 1px solid transparent;
    border-radius: 4px;
}
.btn:focus, .btn:hover { color: #333; text-decoration: none; }
.btn:active, .btn.active { background-image: none; outline: 0; -webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125); box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125); }
.btn.active.focus, .btn.active:focus, .btn.focus, .btn:active.focus, .btn:active:focus, .btn:focus { outline: 5px auto -webkit-focus-ring-color; outline-offset: -2px; }

/* accessibility utility */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }

/* ============================ end inlined Bootstrap base ==================== */

* {
    box-sizing: border-box;
}

:root {
    --main-text-color: #1f2022;
    --main-bg-color: white;
    --accent-color: #c0392b;
    --border-color-light: rgba(0, 0, 0, 0.1);
}

html {
    font-size: 100%;
    height: 100%;
    overflow: hidden;
    color-scheme: light;
    background: var(--main-bg-color);
    /* Standard for Firefox/modern browsers */
    scrollbar-width: thin;
    scrollbar-color: var(--main-text-color) transparent;
}

body {
    background: var(--main-bg-color);
    height: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    color: var(--main-text-color);
    font-family: "TikTok Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-optical-sizing: auto;
    font-weight: 400;
    font-style: normal;
    font-size: 0.9rem;
    line-height: 1.5;
}

body.no-scroll {
    overflow: hidden;
    position: fixed;
    width: 100%;
    /* top is set via JS to preserve scroll position */
}

ul {
    padding-left: 40px;
    list-style-type: none;
}

li {
    padding-bottom: 10px;
}

p {
    font-size: 0.9rem;
    font-weight: 400;
    line-height: 1.5;
    color: var(--main-text-color);
}

em {
    color: var(--main-text-color);
    font-style: normal;
    font-weight: 400;
}

hr {
    border-color: var(--border-color-light);
    margin: 30px 0;
}

/* Table styles */
table,
tr {
    padding: 8px;
    text-align: center;
    border: 1px solid var(--border-color-light);
    border-collapse: collapse;
    margin: auto;
    background: rgba(0, 0, 0, 0.02);
    backdrop-filter: blur(10px);
}

th {
    background: rgba(0, 0, 0, 0.05);
    padding: 12px 20px;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.9rem;
}

td {
    padding: 10px 20px;
}

.inlineWrap {
    display: inline-block;
    padding: 2px;
    border: 2px;
}

.alignMiddle {
    text-align: center;
}

.container-fluid {
    padding: 0 40px;
    padding-bottom: 74px; /* 54px bottom bar + 20px breathing room */
    min-height: calc(100% + 56px); /* Ensure page is always scrollable for address bar auto-hide */
}

/* Page header */
.page-header {
    padding-bottom: 0;
    border-bottom: none;
    max-width: 760px;
    margin-left: auto;
    margin-right: auto;
    margin-top: 20px;
}

.page-header h1 {
    color: var(--main-text-color);
    font-family: "Playfair Display", serif;
    font-weight: 400;
    font-size: 1.4rem;
    text-shadow: none;
    text-align: center;
    margin: 0;
}

.page-header p {
    color: var(--main-text-color);
    font-weight: 400;
    font-size: 0.9rem;
    margin-top: 10px;
}

/* Difficulty buttons container */


/* Button styles */
.btn {
    border-radius: 0;
    padding: 10px 20px;
    font-weight: 400;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    border: 1px solid var(--main-text-color);
    box-shadow: none;
    background: var(--main-bg-color);
}

/* Hover styles only on pointer devices. On touch, a sticky :hover state
   makes iOS Safari swallow the first tap (it applies the hover highlight and
   only fires click on the second tap) whenever the tap reveals new content —
   e.g. "Get a hint" swapping the button for the hint text. */
@media (hover: hover) {
    .btn:hover {
        box-shadow: none;
        background: var(--main-text-color);
        color: var(--main-bg-color);
    }
}

.btn:focus,
.btn:active,
.btn:focus:active {
    outline: none;
    box-shadow: none;
}

.btn:focus-visible {
    outline: 2px solid var(--main-text-color);
    outline-offset: 2px;
}

.btn-primary {
    background: var(--main-text-color);
    color: var(--main-bg-color);
}

.btn-primary:hover {
    background: var(--main-text-color);
    color: var(--main-bg-color);
}

.btn-secondary {
    background: var(--main-bg-color);
    color: var(--main-text-color);
    border: 1px solid var(--main-text-color);
}

@media (hover: hover) {
    .btn-secondary:hover {
        background: var(--main-text-color);
        color: var(--main-bg-color);
    }
}

.btn-success {
    background: var(--main-bg-color) !important;
}

.btn-danger {
    background: var(--main-bg-color) !important;
}

.btn-group .btn {
    margin: 0 5px;
}

/* Navbar */
.navbar {
    background: rgba(0, 0, 0, 0.05) !important;
    border: none;
    backdrop-filter: blur(10px);
}

.navbar-brand img {
    filter: brightness(1.2);
}

.navbar-text,
.navbar-link {
    color: var(--main-text-color) !important;
}

/* Game panels */
#claimsPanel {
    margin: 0 0 20px 0;
}

#verdictPanel,
#logicPanel {
    padding: 15px;
    background: var(--main-bg-color);
    border-radius: 0;
    text-align: center;
    font-weight: 400;
    color: var(--main-text-color);
}

#logicPanel {
    line-height: 1.4;
}

#logicPanel ul {
    padding-left: 0;
    margin: 0;
}

#logicPanel li {
    padding-bottom: 10px;
}

#verdictPanel,
#verdictPanel * {
    font-size: 0.9rem;
    font-weight: 500;
}

#logicToggle {
    display: none;
    /* margin-top removed for flex gap */
}

#revealToggle,
#logicToggle {
    text-align: center;
}

#revealToggle {
    margin-top: -12px;
    display: none;
    /* Hidden by default to prevent flash */
}



#revealTruth.active {
    background: var(--main-text-color);
    color: var(--main-bg-color);
}

#revealTruth:not(.active) {
    cursor: default;
    pointer-events: auto;
}

#revealTruth:not(.active):hover {
    background: var(--main-bg-color);
    color: var(--main-text-color);
}

#selectionPrompt {
    color: var(--accent-color);
    font-size: 0.9rem;
    margin-top: 10px;
    display: none;
}

/* Hint box */
.hint-box {
    background: none;
    border: none;
    padding: 15px;
    margin: -10px 0 4px 0;
    text-align: center;
    line-height: 1.8;
    display: none;
    /* Hidden by default to prevent flash */
    /* Adjusted to 1.8 */
}

.hint-box p {
    margin: 0;
    color: var(--main-text-color);
    font-size: 1em;
    line-height: 1.8;
    /* Further increased spacing */
}

/* Tutorial Intro Transition Class */
.hint-box-shrunk {
    font-size: 0.9rem !important;
    transition: all 0.3s ease-in-out;
}

/* Character cards layout */
.cards-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
    margin: 4px 0 20px 0;
    align-items: stretch;
}



.card-wrapper {
    display: flex;
    flex-direction: column;
    flex: 0 1 200px;
    min-width: 120px;
    max-width: 200px;
}

.character-card {
    background: var(--main-bg-color);
    border: 1px solid transparent;
    border-radius: 0;
    padding: 20px;
    padding-bottom: 0;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    width: 100%;
}

.card-wrapper.selected .character-card {
    border-color: var(--main-text-color);
}

@media (hover: hover) {
    .character-card:hover {
        border-color: var(--main-text-color);
    }
}

.character-card h3 {
    margin: -10px 0 15px -10px;
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--main-text-color);
    text-align: left;
}

.character-card p {
    margin: 10px 0;
    font-size: 0.9rem;
    font-weight: 400;
    line-height: 1.5;
    color: var(--main-text-color);
}

.character-card .no-statement {
    color: var(--main-text-color);
    font-style: italic;
}

/* Card content */
.card-content {
    aspect-ratio: 1 / 1.5;
    overflow: hidden;
    padding: 20px;
    margin: -20px;
    margin-bottom: 0;
    position: relative;
    display: flex;
    flex-direction: column;
}

.card-content h3 {
    position: relative;
    z-index: 1;
}

.card-content .speech-bubble,
.card-content .speech-bubbles-stack {
    z-index: 1;
}

/* Portrait image */
.portrait-image {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-size: 100%;
    background-position: center calc(100% + 4px);
    background-repeat: no-repeat;
    opacity: 0.8;
    z-index: 0;
    filter: grayscale(100%);
    transition: opacity 0.3s ease, transform 0.3s ease, filter 0.3s ease;
}

.character-video {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center calc(100% + 4px);
    opacity: 0.8;
    z-index: 0;
    filter: grayscale(100%);
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease, filter 0.3s ease;
}

/* Global Selected Image Rule */
.card-wrapper.selected .portrait-image,
.card-wrapper.selected .character-video {
    opacity: 1.0;
    transform: scale(1.1);
    filter: grayscale(0%);
}

/* Card button container */
.card-button-container {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 0;
    margin-left: -21px;
    margin-right: -21px;
    margin-bottom: -1px;
    opacity: 0;
}

@media (hover: hover) {

    .character-card:hover .portrait-image,
    .character-card:hover .character-video {
        opacity: 1.0;
        transform: scale(1.1);
        filter: grayscale(0%);
    }

    .card-wrapper:hover .card-button-container,
    .card-wrapper.selected .card-button-container {
        opacity: 1;
    }
}

@media (hover: none) {

    .portrait-image,
    .character-video {
        opacity: 1.0;
        /* filter: grayscale(0%); removed to default to B&W */
    }

    .card-button-container {
        opacity: 0 !important;
        pointer-events: none;
    }

    .card-wrapper.selected .card-button-container {
        opacity: 1 !important;
        pointer-events: auto;
    }

    /* Ensure selected state still works visually if needed */
    .card-wrapper.selected .portrait-image,
    .card-wrapper.selected .character-video {
        transform: scale(1.1);
    }
}

.card-button-container .btn {
    width: 100%;
    background: var(--main-text-color);
    color: var(--main-bg-color);
    border-color: var(--main-text-color);
}

.card-button-container .btn:hover {
    background: var(--main-text-color);
    color: var(--main-bg-color);
}

/* Speech bubble styles */
.speech-bubble {
    background: var(--main-bg-color);
    border: 1px solid var(--main-text-color);
    padding: 8px;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
}

.card-wrapper.selected .speech-bubble {
    border-left-color: transparent;
    border-right-color: transparent;
    border-bottom-color: transparent;
}

@media (hover: hover) {
    .character-card:hover .speech-bubble {
        border-left-color: transparent;
        border-right-color: transparent;
        border-bottom-color: transparent;
    }
}

.speech-bubble p {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.5;
    font-weight: 400;
}

.speech-bubble p+p {
    margin-top: 10px;
}

/* Speech bubble carets */
.speech-bubble.caret-left::before {
    content: '';
    position: absolute;
    top: -16px;
    left: 45px;
    width: 0;
    height: 0;
    border-right: 0;
    border-left: 12px solid transparent;
    border-bottom: 16px solid var(--main-text-color);
}

.speech-bubble.caret-left::after {
    content: '';
    position: absolute;
    top: -14px;
    left: 46px;
    width: 0;
    height: 0;
    border-right: 0;
    border-left: 10px solid transparent;
    border-bottom: 14px solid var(--main-bg-color);
}

.speech-bubble.caret-right::before {
    content: '';
    position: absolute;
    top: -16px;
    right: 45px;
    width: 0;
    height: 0;
    border-left: 0;
    border-right: 12px solid transparent;
    border-bottom: 16px solid var(--main-text-color);
}

.speech-bubble.caret-right::after {
    content: '';
    position: absolute;
    top: -14px;
    right: 46px;
    width: 0;
    height: 0;
    border-left: 0;
    border-right: 10px solid transparent;
    border-bottom: 14px solid var(--main-bg-color);
}

.speech-bubble.caret-right-small::before {
    content: '';
    position: absolute;
    top: -12px;
    right: 45px;
    width: 0;
    height: 0;
    border-left: 0;
    border-right: 9px solid transparent;
    border-bottom: 12px solid var(--main-text-color);
}

.speech-bubble.caret-right-small::after {
    content: '';
    position: absolute;
    top: -10px;
    right: 46px;
    width: 0;
    height: 0;
    border-left: 0;
    border-right: 7px solid transparent;
    border-bottom: 10px solid var(--main-bg-color);
}

/* Stacked speech bubbles */
.speech-bubbles-stack {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.speech-bubbles-stack .speech-bubble {
    position: relative;
    bottom: auto;
    left: auto;
    right: auto;
}

/* Main Action Buttons (Reveal, Rational, Next Level) */
.mainAction {
    max-width: 420px;
    width: 100%;
}

#showLogic {
    width: 100%;
}

.speech-bubbles-stack .speech-bubble:not(:last-child) {
    border-bottom: none;
}

/* Bottom bar */
.bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 54px;
    background: var(--main-bg-color);
    border-top: 1px solid var(--main-text-color);
    z-index: 9101;
    display: flex;
    align-items: center;
    padding: 0 15px;
}

/* Bottom bar buttons - shared styles */
.bottom-bar-btn {
    height: 100%;
    border: none;
    background: var(--main-bg-color);
    color: var(--main-text-color);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.2rem;
    font-weight: 400;
    white-space: nowrap;
}

.bottom-bar-btn:hover {
    background: var(--main-text-color);
    color: var(--main-bg-color);
}

.bottom-bar-btn svg {
    width: 28px;
    height: 28px;
}

/* Specific bottom bar buttons */
.language-picker {
    width: 68px;
    border-right: 1px solid var(--main-text-color);
    margin-left: -15px;
}

.help-button {
    width: 60px;
    border-right: 1px solid var(--main-text-color);
}

.support-button {
    border-right: 1px solid var(--main-text-color);
    padding: 0 20px;
}

.share-button {
    margin-left: auto;
    border-left: 1px solid var(--main-text-color);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 20px;
}

.share-button svg {
    position: relative;
    top: -2px;
}

.contact-button {
    width: 62px;
    border-left: 1px solid var(--main-text-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

.reddit-button {
    width: 62px;
    border-left: 1px solid var(--main-text-color);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.reddit-button svg {
    position: relative;
    top: -2px;
}

/* Toast Notification */
.toast {
    visibility: hidden;
    min-width: 250px;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 4px;
    padding: 16px;
    position: fixed;
    z-index: 9999;
    left: 50%;
    bottom: 80px;
    transform: translateX(-50%);
    font-size: 1rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transition: opacity 0.3s, bottom 0.3s;
}

.toast.show {
    visibility: visible;
    opacity: 1;
    bottom: 90px;
}

.social-button {
    margin-right: -15px;
    width: 64px;
    border-left: 1px solid var(--main-text-color);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.social-button svg {
    width: 20px;
    height: 20px;
}

/* Newsletter container */
.newsletter-container {
    flex: 1;
    display: flex;
    height: 100%;
    border-right: 1px solid var(--main-text-color);
}

.newsletter-input {
    flex: 1;
    height: 100%;
    border: none;
    padding: 2px 20px 0 20px;
    font-size: 1rem;
    font-family: inherit;
    background: white;
    color: var(--main-text-color);
}

.newsletter-input::placeholder {
    color: #767676;
    font-size: 1.2rem;
    font-weight: 300;
}

.newsletter-input:focus {
    outline: none;
}

.newsletter-submit {
    height: 100%;
    padding: 0 20px;
    background: var(--main-text-color);
    color: white;
    border: none;
    font-size: 1.2rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
}

.newsletter-submit:hover {
    background: #3a3b3d;
}

/* Sheet overlay */
.sheet-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 54px;
    background: rgba(0, 0, 0, 0.3);
    z-index: 9098;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.sheet-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* When a submenu sheet (z-index 9105) is stacked on top of the mobile menu
   sheet (9100), raise the overlay above the menu so the menu is dimmed too.
   Without this the overlay sits below the menu and only the page dims. */
.sheet-overlay.above-menu {
    z-index: 9102;
}

/* When a sheet is opened from the victory overlay (#gameCompleteOverlay,
   z-index 10000) — e.g. the "Hear about new levels" button — raise the sheet
   and its backdrop above the overlay so they aren't hidden behind it. */
.sheet-overlay.above-victory {
    z-index: 10001;
}

.sheet.above-victory {
    z-index: 10002;
}

/* Sheets - shared styles */
.sheet {
    position: fixed;
    bottom: 53px;
    background: white;
    border: 1px solid var(--main-text-color);
    z-index: 9099;
    opacity: 0;
    visibility: hidden;
    transform: translateY(100%);
    transition: transform 200ms ease, opacity 200ms ease, visibility 200ms ease;
    max-height: 70vh;
    overflow-y: hidden;
    display: flex;
    flex-direction: column;
}

/* Scrollable content within sheets */
.sheet> :not(.sheet-header) {
    overflow-y: auto;
    flex: 1;
    overscroll-behavior: contain;
}

/* Custom scrollbar for sheet content */


.sheet> :not(.sheet-header)::-webkit-scrollbar {
    width: 4px;
    background: transparent;
}

.sheet> :not(.sheet-header)::-webkit-scrollbar-track {
    background: transparent;
}

.sheet> :not(.sheet-header)::-webkit-scrollbar-thumb {
    background-color: var(--main-text-color);
    border-radius: 0;
}

.sheet.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.sheet-header {
    padding: 15px 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    flex-shrink: 0;
}

.sheet-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 500;
}

.sheet-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    padding: 0;
    cursor: pointer;
    color: var(--main-text-color);
}

/* Intro Animation */


/* Level Header (replaces buttons) */
/* Run-status row: live timer + retry count, below the logo. */
#runStatus {
    width: 100%;
    text-align: center;
    margin-top: -12px;
    font-family: "TikTok Sans", sans-serif;
    font-size: 0.9rem;
    font-weight: 400;
    letter-spacing: 0.02em;
    color: var(--main-text-color);
    opacity: 0.55;
    font-variant-numeric: tabular-nums;
}

#runStatus .run-stat {
    white-space: nowrap;
}

#runStatus .run-stat-sep {
    margin: 0 0.5em;
    opacity: 0.6;
}

#levelHeader {
    /* Make static so it scrolls with content */
    position: relative;
    margin-top: 10px;
    width: 100%;
    text-align: center;

    font-family: "TikTok Sans", sans-serif;
    font-size: 1.6rem;
    font-weight: 400;
    color: var(--main-text-color);
    z-index: 9000;
    white-space: nowrap;
}

/* Wave Transition for Level Header */
.level-transition-wave {
    animation: waveBlock 0.6s ease-in-out forwards;
}

@keyframes waveBlock {
    0% {
        transform: translateY(0);
        opacity: 1;
    }

    25% {
        transform: translateY(-10px);
        opacity: 1;
    }

    50% {
        transform: translateY(0);
        opacity: 0;
    }

    75% {
        transform: translateY(10px);
        opacity: 0;
    }

    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Dedicated enter-only wave for Tutorial Intro */
.level-wave-enter {
    animation: waveEnter 0.6s ease-out forwards;
}

@keyframes waveEnter {
    0% {
        transform: translateY(10px);
        opacity: 0;
    }

    100% {
        transform: translateY(0);
        opacity: 1;
    }
}



#introRules {
    position: relative;
    margin: 0 auto 20px auto;
    width: 600px;
    max-width: 90%;

    font-family: "TikTok Sans", sans-serif;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: var(--main-text-color);
    text-align: center;
    z-index: 9000;
    will-change: opacity;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}


.sheet-content {
    padding: 15px 20px;
    font-size: 0.9rem;
    color: var(--main-text-color);
}

/* Sheet-specific positioning */
.language-sheet {
    left: 0;
    width: 260px;
    max-width: 260px;
    max-height: calc(100vh - 74px);
}

.help-sheet {
    left: 67px;
    width: 360px;
    max-width: 360px;
    max-height: calc(100vh - 74px);
}

.help-sheet h4 {
    font-size: 1rem;
    /* Space above each section title. */
    margin-top: 20px;
    /* Space below the title before its text (20% less than Bootstrap's 10px). */
    margin-bottom: 8px;
}

.help-sheet ul {
    padding-left: 0;
    margin-bottom: 0;
}

/* Tighter spacing between the rules (20% less than the global li's 10px).
   Pin font-size to match the sheet's paragraphs (which carry the global
   p { font-size: 0.9rem }); otherwise the list inherits the larger mobile
   .sheet-content size (1rem) and the rules read bigger than the body text. */
.help-sheet ul li {
    padding-bottom: 8px;
    font-size: 0.9rem;
}

.help-sheet ul+p {
    margin-top: -4px;
}

.support-sheet {
    left: 127px;
    width: 360px;
    max-width: 360px;
    /* Taller on desktop so the content fits without scrolling (still capped
       to the viewport). Mobile keeps its 85vh !important override. */
    max-height: calc(100vh - 74px);
}

/* Tighter, even spacing between the support "cards" — replaces the larger
   gaps the old <br> tags created between paragraphs. */
.support-sheet .sheet-content p {
    margin-bottom: 14px;
}


.contact-sheet {
    right: 125px;
    width: 280px;
    max-width: 280px;
}

.share-sheet {
    right: 187px;
    width: 260px;
    max-width: 260px;
}

/* Language list */
.language-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.language-list li {
    padding: 0;
}

.language-list button {
    width: 100%;
    padding: 15px 20px;
    background: none;
    border: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    text-align: left;
    font-size: 0.9rem;
    color: var(--main-text-color);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s ease;
}

.language-list button:hover {
    background: var(--main-text-color);
    color: white;
}

.language-list button:hover .lang-code {
    color: white;
}

.language-list button.selected {
    font-weight: 500;
}

.language-list button .lang-code {
    color: #6f7072;
    font-weight: 400;
}

/* Share options */
.share-options {
    list-style: none;
    margin: 0;
    padding: 0;
}

.share-options li {
    padding: 0;
}

.share-options button {
    width: 100%;
    padding: 15px 20px;
    background: none;
    border: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    text-align: left;
    font-size: 0.9rem;
    color: var(--main-text-color);
    cursor: pointer;
    transition: background 0.2s ease;
    display: flex;
    align-items: center;
    gap: 12px;
}

.share-options button svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.share-options button:hover {
    background: var(--main-text-color);
    color: white;
}

/* Newsletter checkboxes */
.newsletter-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 15px;
    cursor: pointer;
}

.newsletter-checkbox:last-child {
    margin-bottom: 0;
}

.newsletter-checkbox input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    min-width: 18px;
    border: 2px solid var(--main-text-color);
    background: white;
    cursor: pointer;
    position: relative;
    margin-top: 2px;
    outline: none;
}

.newsletter-checkbox input[type="checkbox"]:checked {
    background: var(--main-text-color);
}

.newsletter-checkbox input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 1px;
    width: 4px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.newsletter-checkbox span {
    line-height: 1.4;
    font-weight: 400;
}

/* Mobile menu button */
.mobile-menu-button {
    display: none;
    flex: 1;
    height: 100%;
    border: none;
    background: var(--main-bg-color);
    color: var(--main-text-color);
    font-size: 1.2rem;
    font-weight: 400;
    cursor: pointer;
    margin-left: -15px;
    margin-right: -15px;
    text-align: center;
}

/* Mobile menu sheet */
.mobile-menu-sheet {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 54px;
    background: white;
    border: 1px solid var(--main-text-color);
    border-bottom: none;
    z-index: 9100;
    opacity: 0;
    visibility: hidden;
    transform: translateY(100%);
    transition: transform 200ms ease, opacity 200ms ease, visibility 200ms ease;
    max-height: 70vh;
    overflow-y: hidden;
    flex-direction: column;
}

.mobile-menu-sheet.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    display: flex;
}

.mobile-menu-sheet> :not(.sheet-header) {
    overflow-y: auto;
    flex: 1;
    overscroll-behavior: contain;
}

/* Reuse scrollbar styles from .sheet if possible, but for specificity: */
.mobile-menu-sheet> :not(.sheet-header)::-webkit-scrollbar {
    width: 4px;
    background: transparent;
}

.mobile-menu-sheet> :not(.sheet-header)::-webkit-scrollbar-track {
    background: transparent;
}

.mobile-menu-sheet> :not(.sheet-header)::-webkit-scrollbar-thumb {
    background-color: var(--main-text-color);
    border-radius: 0;
}

.mobile-menu-sheet .sheet-header {
    background: white;
    z-index: 1;
    flex-shrink: 0;
}

.mobile-menu-options {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mobile-menu-options li {
    padding: 0;
}

.mobile-menu-options button {
    width: 100%;
    padding: 15px 20px;
    background: none;
    border: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    text-align: left;
    font-size: 0.9rem;
    color: var(--main-text-color);
    cursor: pointer;
    transition: background 0.2s ease;
    display: flex;
    align-items: center;
    gap: 12px;
}

.mobile-menu-options button svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    margin-top: -1px;
}

.mobile-menu-options button:hover {
    background: var(--main-text-color);
    color: white;
}

/* Mobile responsive */
@media (max-width: 740px) {
    .container-fluid {
        padding: 0 15px;
    }

    .cards-container {
        flex-wrap: wrap;
        gap: 10px;
        max-width: none !important;
        align-items: flex-start;
    }

    .card-wrapper {
        flex: 0 0 calc(50% - 5px);
        min-width: 0;
        max-width: 200px;
    }

    .character-card {
        padding: 0 !important;
        height: auto;
    }

    .card-content {
        padding: 15px;
        margin: 0 !important;
        aspect-ratio: 1 / 1.5 !important;
        height: auto;
        width: 100%;
        flex: 0 0 auto;
    }

    .card-button-container {
        margin: 0 !important;
        padding: 0;
    }

    /* .portrait-image rule removed */



    .portrait-image {
        background-size: cover !important;
    }

    .character-card h3 {
        font-size: 1.2rem;
    }

    .character-card p {
        font-size: 0.9rem;
    }

    .card-button-container {
        margin-left: -16px;
        margin-right: -16px;
    }

    .card-button-container .btn {
        width: 100%;
        padding: 8px 12px;
        font-size: 0.9rem;
    }

    .speech-bubble {
        padding: 10px;
    }

    .speech-bubble p {
        font-size: 0.8rem;
    }

    /* Mobile bottom bar */
    .mobile-menu-button {
        display: block;
    }

    .mobile-menu-sheet {
        display: block;
    }

    .language-picker,
    .help-button,
    .support-button,
    .newsletter-container,
    .share-button,
    .contact-button,
    .reddit-button,
    .social-button {
        display: none !important;
    }

    /* Bottom sheets on mobile — slide up from the bottom edge, cap at 85vh
       so the underlying page peeks through above the sheet. Replaces the
       previous full-screen mobile sheet treatment. */
    .sheet {
        position: fixed;
        top: auto;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100% !important;
        max-width: 100% !important;
        max-height: 85vh !important;
        border: 1px solid var(--main-text-color);
        border-bottom: none;
        border-radius: 0;
        z-index: 9105;
        /* Enhance layering over mobile menu */
    }

    /* Centered modals (Reddit / Facebook / Upsell share helpers) get the
       same bottom-sheet treatment on mobile — same edge, same slide. The
       desktop centering override stays in effect above 600px. */
    .sheet.modal-center {
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        transform: translateY(100%);
        width: 100% !important;
        max-width: 100% !important;
        max-height: 85vh !important;
        border-radius: 0;
        box-shadow: none;
    }

    .sheet.modal-center.active {
        transform: translateY(0);
    }

    .sheet .sheet-header {
        padding: 20px;
        border-bottom: 1px solid var(--main-text-color);
        position: sticky;
        top: 0;
        background: white;
        z-index: 1;
    }

    /* Unify header/close sizing across the main menu sheet (.mobile-menu-sheet,
       which lacks the .sheet class) and the submenu sheets (.sheet), using
       values midway between the two so both sheets read consistently. */
    .sheet .sheet-header h3,
    .mobile-menu-sheet .sheet-header h3 {
        font-size: 1.1rem;
    }

    .sheet .sheet-close,
    .mobile-menu-sheet .sheet-close {
        font-size: 1.75rem;
    }

    .sheet-overlay {
        bottom: 0;
    }

    /* Unify list-item sizing across the language, share and main-menu sheets:
       same font size, padding (row height) and icon size so all three read
       identically. font-size is midway between the old main-menu (0.9rem) and
       submenu (1.1rem) values. */
    .language-list button,
    .share-options button,
    .mobile-menu-options button {
        padding: 20px;
        font-size: 1rem;
    }

    .share-options button svg,
    .mobile-menu-options button svg {
        width: 22px;
        height: 22px;
    }

    .sheet-content {
        padding: 20px;
        font-size: 1rem;
    }


}



/* Milestone Level Indicator */
.milestone-level {
    position: relative;
}

.milestone-level::after {
    content: '•';
    position: absolute;
    bottom: -3px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.5em;
    color: inherit;
    line-height: 1;
}

/* Brevo Form Styles */
@font-face {
    font-display: block;
    font-family: Roboto;
    src: url(https://assets.brevo.com/font/Roboto/Latin/normal/normal/7529907e9eaf8ebb5220c5f9850e3811.woff2) format("woff2"), url(https://assets.brevo.com/font/Roboto/Latin/normal/normal/25c678feafdc175a70922a116c9be3e7.woff) format("woff")
}

@font-face {
    font-display: fallback;
    font-family: Roboto;
    font-weight: 600;
    src: url(https://assets.brevo.com/font/Roboto/Latin/medium/normal/6e9caeeafb1f3491be3e32744bc30440.woff2) format("woff2"), url(https://assets.brevo.com/font/Roboto/Latin/medium/normal/71501f0d8d5aa95960f6475d5487d4c2.woff) format("woff")
}

@font-face {
    font-display: fallback;
    font-family: Roboto;
    font-weight: 700;
    src: url(https://assets.brevo.com/font/Roboto/Latin/bold/normal/3ef7cf158f310cf752d5ad08cd0e7e60.woff2) format("woff2"), url(https://assets.brevo.com/font/Roboto/Latin/bold/normal/ece3a1d82f18b60bcce0211725c476aa.woff) format("woff")
}

#sib-container input:-ms-input-placeholder {
    text-align: left;
    font-family: Helvetica, sans-serif;
    color: #c0ccda;
}

#sib-container input::placeholder {
    text-align: left;
    font-family: Helvetica, sans-serif;
    color: #c0ccda;
}

#sib-container textarea::placeholder {
    text-align: left;
    font-family: Helvetica, sans-serif;
    color: #c0ccda;
}

#sib-container a {
    text-decoration: underline;
    color: #1877b3;
}

.sib-form {
    text-align: center;
    background-color: #EFF2F7;
}

.sib-form-message-panel {
    font-size: 16px;
    text-align: left;
    font-family: Helvetica, sans-serif;
    background-color: #ffeded;
    border-radius: 3px;
    max-width: 540px;
}

#error-message {
    color: #661d1d;
    border-color: #ff4949;
}

#success-message {
    color: #085229;
    background-color: #e7faf0;
    border-color: #13ce66;
}

#sib-container {
    text-align: center;
    background-color: rgba(255, 255, 255, 1);
    max-width: 540px;
    border-radius: 3px;
    border-width: 1px;
    border-color: #C0CCD9;
    border-style: solid;
    direction: ltr;
}

/* Adjustments to fit inside the sheet */
#newsletterSheet .sib-form {
    background: transparent;
    padding: 0;
}

/* When shown as a centered modal / bottom sheet (e.g. the victory "Hear about
   new levels" button) the sheet is detached from the footer email input, so it
   must carry its own input + SUBSCRIBE button. Reveal the in-sheet Brevo form,
   which Brevo's sib-styles.css hides with `display:none !important` (it expects
   Brevo's main.js to unhide it). The footer-anchored sheet keeps it hidden and
   relies on the footer input instead. */
#newsletterSheet.modal-center #sib-container {
    display: block !important;
}

#newsletterSheet #sib-container {
    /* !important is required: the Brevo markup sets the white background and
       grey border via an inline style attribute, which outranks a plain
       selector. Without it the grey box stays visible on mobile. */
    border: none !important;
    background: transparent !important;
    max-width: 100%;
    margin: 0;
    padding: 0;
}

/* Brevo's sib-styles.css sets .sib-form-block { padding: 0 16px }, which insets
   every form block by 16px each side. The input's wrapper (.sib-input) is reset
   below, but the SUBSCRIBE button's wrapper is a bare .sib-form-block — without
   this it stays 32px narrower than the input. Zero the horizontal padding on
   all blocks so the input and button share the same width. */
#newsletterSheet .sib-input,
#newsletterSheet .sib-form-block {
    padding-left: 0;
    padding-right: 0;
}

#newsletterSheet .sib-input {
    padding: 0;
}

#newsletterSheet .entry__field .input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 0;
    /* Match game style */
}

#newsletterSheet .sib-form-block__button {
    width: 100%;
    padding: 10px;
    background-color: var(--main-text-color) !important;
    /* Match game primary color */
    color: white !important;
    border-radius: 0 !important;
    font-family: "TikTok Sans", sans-serif !important;
    font-weight: 400 !important;
    text-align: center !important;
}

#newsletterSheet .sib-form-block__button:hover {
    background-color: #3a3b3d !important;
}

/* Brevo's submit button ships a loader-spinner <svg> that its own stylesheet
   (which we don't load) normally hides and shrinks. Left unstyled it defaults
   to filling the button — ballooning it into a giant square ~324px tall. Hide
   it so the button is a normal slim button matching the input's height. */
#newsletterSheet .sib-form-block__button svg {
    display: none !important;
}

/* Hide the honeypot field */
.input--hidden {
    display: none !important;
}

/* Ensure invisible recaptcha doesn't take space if it renders explicitly */
.g-recaptcha {
    display: none;
}

/* Nuclear option to hide honeypot and other hidden elements */
#sib-container input[name="email_address_check"],
#sib-container .input--hidden,
input[name="email_address_check"],
.input--hidden {
    display: none !important;
    opacity: 0 !important;
    position: absolute !important;
    left: -9999px !important;
    height: 0 !important;
    width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    clip: rect(0, 0, 0, 0) !important;
    pointer-events: none !important;
    visibility: hidden !important;
}

/* Ensure recaptcha is also hidden */
.g-recaptcha,
.grecaptcha-badge {
    visibility: hidden;
}

/* Hide the visible form container inside the newsletter sheet ON DESKTOP */
/* This hides the input and button but leaves the success/error messages visible */
@media (min-width: 741px) {
    #newsletterSheet #sib-container {
        display: none !important;
    }
}

/* Error text */
.error-text {
    color: #c9302c;
    font-weight: 500;
    margin-top: 10px;
    font-size: 0.9rem;
    text-align: left;
}

/* Success text */
.success-text {
    color: #218838;
    font-weight: 500;
    margin-top: 10px;
    font-size: 0.9rem;
    text-align: left;
}

/* Hide default Brevo messages inside newsletter sheet since we use custom ones */
#newsletterSheet .sib-form-message-panel {
    display: none !important;
}

/* Helper for Intro Animation Layout Preservation */
.invisible-layout {
    visibility: hidden !important;
    opacity: 0;
}

/* Text Animation Effects */
.char {
    display: inline-block;
    white-space: pre;
}

.effect-wave-pop .char {
    animation: wavePop 0.1s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    opacity: 0;
    transform: scale(0);
    animation-delay: calc(var(--i) * 0.01s);
    /* Twice as fast */
}

@keyframes wavePop {
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.effect-headshake {
    animation: headshake 0.5s ease-in-out;
    display: inline-block;
    /* Needed for transform to work on inline elements */
}

@keyframes headshake {
    0% {
        transform: translateX(0);
    }

    6.5% {
        transform: translateX(-6px) rotateY(-9deg);
    }

    18.5% {
        transform: translateX(5px) rotateY(7deg);
    }

    31.5% {
        transform: translateX(-3px) rotateY(-5deg);
    }

    43.5% {
        transform: translateX(2px) rotateY(3deg);
    }

    50% {
        transform: translateX(0);
    }
}

#postGameControls {
    margin-top: -42px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
    width: 100%;
}

/* Ensure children extend full width to allow internal centering or full width buttons */
#postGameControls>div {
    width: 100%;
}

/* --- Text Animation Effects --- */

.char {
    display: inline-block;
    white-space: pre;
    opacity: 0;
    /* Start hidden */
}

.effect-wave-opacity .char {
    animation: waveOpacityFadeIn 0.3s ease-in-out forwards;
    animation-delay: calc(var(--i) * 0.03s);
}

@keyframes waveOpacityFadeIn {
    0% {
        opacity: 0;
    }

    100% {
        opacity: 1;
    }
}

/* Game Complete Overlay */
#gameCompleteOverlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    color: #ffffff !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
}

#gameCompleteOverlay h1 {
    font-size: 4rem;
    margin-bottom: 20px;
    color: #ffffff !important;
    font-family: 'Playfair Display', serif;
    font-weight: 400;
    line-height: 1.1;
}

#gameCompleteOverlay p {
    font-size: 1.4rem;
    max-width: 600px;
    line-height: 1.5;
    color: #ffffff !important;
    margin: 0;
}

#gameCompleteOverlay .btn-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
    max-width: 300px;
    margin-top: 40px;
}

#gameCompleteOverlay .btn-share {
    background-color: #ffffff;
    color: #000000;
    border: none;
    font-size: 1.2rem;
    padding: 12px 20px;
    width: 100%;
}

#gameCompleteOverlay .btn-restart {
    background-color: transparent;
    color: #ffffff;
    border: 1px solid #ffffff;
    font-size: 1.2rem;
    padding: 12px 20px;
    width: 100%;
}

#gameCompleteOverlay .btn-share:hover,
#gameCompleteOverlay .btn-restart:hover {
    opacity: 0.9;
    transform: scale(1.02);
}

/* Mobile Responsive Adjustments */
@media (max-width: 600px) {
    #gameCompleteOverlay h1 {
        font-size: 2.5rem;
    }

    #gameCompleteOverlay p {
        font-size: 1.2rem;
    }
}

@media (max-width: 360px) {
    #gameCompleteOverlay h1 {
        font-size: 2rem;
    }

    #gameCompleteOverlay p {
        font-size: 1rem;
    }

    #gameCompleteOverlay .btn-container {
        max-width: 100%;
    }
}

/* Global Scrollbar */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--main-text-color);
    border-radius: 0;
}

.bottom-layout-spacer {
    height: 74px;
    margin-top: 10px;
    width: 100%;
}

/* Victory Share Menu Styles */
.victory-share-container {
    position: relative;
    display: block;
    /* changed from inline-block to block/flex item behavior */
    width: 280px;
    /* Explicit width */
}

.victory-share-menu {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: transparent;
    padding: 0;
    margin: 0;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out, opacity 0.3s ease-in;
    /* Start hidden */
    pointer-events: none;
    /* Prevent clicks when hidden */
}

.victory-share-menu.expanded {
    max-height: 300px;
    /* Sufficient to fit 4 buttons */
    opacity: 1;
    pointer-events: auto;
    margin-top: -50px;
    /* Pull up to cover the trigger button or replace it */
    position: relative;
    z-index: 10;
}

/* We want the menu to appear 'in place' of the trigger button. 
   When expanded, we hide the trigger button. 
   But simpler: Just toggle visibility/logic in JS. 
   CSS Transition for height is good. 
*/

/* Shared Style for Game Complete Overlay Buttons */
#gameCompleteOverlay .btn-share,
#gameCompleteOverlay .btn-share-option,
#gameCompleteOverlay .btn-restart {
    background-color: transparent;
    color: #ffffff;
    border: 1px solid #ffffff;
    font-size: 1.2rem;
    padding: 12px 20px;
    width: 100%;
    cursor: pointer;
    transition: all 0.3s ease;
    box-sizing: border-box;
    /* Ensure padding included */
}

#gameCompleteOverlay .btn-share-option {
    text-align: left;
    display: flex;
    align-items: center;
    gap: 10px;
}

#gameCompleteOverlay .btn-share:hover,
#gameCompleteOverlay .btn-share-option:hover,
#gameCompleteOverlay .btn-restart:hover {
    opacity: 1;
    transform: none;
    background: white;
    color: var(--main-text-color);
    border-color: white;
}

.btn-share-option svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* Specific Tweak for Game Complete Overlay Layout */
#gameCompleteOverlay .btn-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    width: 100%;
    /* Ensure container allows full width children if needed */
}

/* Ensure buttons are same width if possible, or wide enough */
.victory-share-container,
.btn-restart {
    width: 300px;
    max-width: 90vw;
    /* Safety for mobile */
    /* Fixed width for consistency */
    box-sizing: border-box;
    /* Ensure padding doesn't add to width */
}

.btn-share,
.btn-share-option {
    width: 100%;
    /* Fill container */
}

#finalMessage {
    font-size: 1.4rem;
    line-height: 2;
}

/* Supporter Mode - Hide Ads */
body.supporter-mode .adsbygoogle {
    display: none !important;
}

/* License Section Styles */
#licenseKeyInput {
    border-radius: 0 !important;
    box-shadow: none !important;
    -webkit-appearance: none;
    appearance: none;
}

#verifyLicenseBtn {
    height: 34px !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    line-height: 34px !important;
}

/* Modal Center Override for Sheets — desktop only. On mobile (<=600px)
   these sheets fall back to the bottom-sheet behavior defined in the
   earlier @media (max-width: 600px) block. */
@media (min-width: 601px) {
    .sheet.modal-center {
        bottom: auto;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%) scale(0.9);
        width: 90%;
        max-width: 400px;
        max-height: 90vh;
        border-radius: 0;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    }

    .sheet.modal-center.active {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
        visibility: visible;
    }
}

/* Mobile share-sheet only: elements that should only render on devices where
   navigator.share() with files is supported (iOS Safari, Android Chrome).
   The body class is set by app.js once on init. */
.share-sheet-only {
    display: none;
}
body.has-share-sheet .share-sheet-only {
    display: block;
}

/* Mid-puzzle share consolidation: on mobile, hide the four per-platform
   "Ask X" buttons in favour of the single #askFriendBtn, and vice versa
   on desktop. !important is needed because the game-over flow calls
   jQuery .show() on each of these, which would otherwise win. */
body:not(.has-share-sheet) #askFriendBtn {
    display: none !important;
}
body.has-share-sheet #askRedditBtn,
body.has-share-sheet #askFacebookBtn,
body.has-share-sheet #askXBtn,
body.has-share-sheet #askWhatsappBtn {
    display: none !important;
}

/* Share-image builder — off-screen 1080px-wide DOM captured by html2canvas
   to produce a portrait-orientation shareable PNG. */
#shareImageBuilder {
    position: fixed;
    left: -100000px;
    top: 0;
    width: 1080px;
    pointer-events: none;
    z-index: -1;
}

.share-image-root {
    width: 1080px;
    background: var(--main-bg-color);
    color: var(--main-text-color);
    /* Tight margins (~25% less than before) so cards get more horizontal room. */
    padding: 24px 36px 36px 36px;
    font-family: "TikTok Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    box-sizing: border-box;
}

.share-image-brand-header {
    text-align: center;
    margin-bottom: 24px;
    color: var(--main-text-color);
    line-height: 1.2;
}

.share-image-brand-header .share-image-brand {
    font-family: "Playfair Display", serif;
    font-weight: 500;
    font-size: 60px;
}

.share-image-brand-header .share-image-url {
    font-size: 32px;
    margin-top: 2px;
}

.share-image-instructions {
    text-align: center;
    margin-bottom: 32px;
    /* Use the same body font + size as the statements so the two feel like
       one continuous voice. Brand title above stays in Playfair Display. */
    font-family: "TikTok Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-weight: 400;
    color: var(--main-text-color);
}

/* Set font metrics on the <p> directly — the global `p { font-size: 0.9rem }`
   rule earlier in this file has equal specificity to inherited values and
   would otherwise win, shrinking the text. */
.share-image-instructions p {
    margin: 0;
    font-size: 36px;
    line-height: 1.4;
    font-weight: 400;
}

.share-image-instructions strong {
    font-weight: 600;
}

.share-image-cards {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.share-image-card {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    border: 1px solid var(--main-text-color);
}

.share-image-portrait {
    flex: 0 0 187px;
    width: 187px;
    /* Use min-height instead of a hard height so the portrait box stretches
       with the card when the text side grows past 224px. background-size:
       100% auto then reveals more of the character (down toward the
       shoulders / chest) instead of leaving an empty white strip below. */
    min-height: 224px;
    background-color: var(--main-bg-color);
    background-size: 100% auto;
    background-position: top center;
    background-repeat: no-repeat;
    border-right: 1px solid var(--main-text-color);
}

.share-image-text {
    flex: 1 1 auto;
    padding: 22px 30px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    min-width: 0;
}

.share-image-text h3 {
    font-family: "TikTok Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-weight: 500;
    font-size: 36px;
    line-height: 1.1;
    margin: 0 0 16px 0;
    color: var(--main-text-color);
}

.share-image-text p {
    font-family: "TikTok Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    margin: 0 0 10px 0;
    font-size: 36px;
    line-height: 1.4;
    font-weight: 400;
    color: var(--main-text-color);
}

.share-image-text p:last-child {
    margin-bottom: 0;
}

