/*
 * Barti — Short Missions (the mini app)
 *
 * Mobile first and phone-shaped: this is opened on a handset, read for one
 * minute, then put face down on a table while a child makes something. So
 * every tap target is thumb-sized, nothing needs two hands, and the type is
 * large enough for a six-year-old.
 *
 * Self-hosted Mitr, the same faces the main site serves, from the same paths
 * (one document root, two hostnames). No inline styles anywhere: the mini
 * app's CSP allows stylesheets from 'self' only.
 */

@font-face {
    font-family: 'Mitr';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url(/assets/barti/fonts/pxiLypw5ucZF-Tw4Mbr8f1s.woff2) format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Mitr';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url(/assets/barti/fonts/pxiLypw5ucZF-TI4Mbr8f1t9EQ.woff2) format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Mitr';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url(/assets/barti/fonts/pxiEypw5ucZF8c8bJJfecnFHGPc.woff2) format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Mitr';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url(/assets/barti/fonts/pxiEypw5ucZF8YcdJJfecnFHGPc.woff2) format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Mitr';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url(/assets/barti/fonts/pxiEypw5ucZF8YcdJJnecnFHGPezSQ.woff2) format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
    --cream: #fdf6e8;
    --card: #ffffff;
    --navy: #0d3557;
    --navy-deep: #021d4b;
    --muted: #6b7b8c;
    --blue: #3b82d6;
    --blue-dark: #2a63a8;
    --green: #5a9e28;
    --green-dark: #47801d;
    --gold: #f0a020;
    --gold-soft: #fdeccd;
    --purple: #6755d1;
    --purple-soft: #ece9ff;
    --locked: #c2c2bc;
    --line: #ece3d2;
    --radius: 18px;
    --shadow: 0 2px 10px rgba(13, 53, 87, .07);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--cream);
    color: var(--navy);
    font-family: 'Mitr', ui-sans-serif, system-ui, -apple-system, sans-serif;
    font-weight: 400;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body { min-height: 100svh; display: flex; flex-direction: column; }

/* ---------------------------------------------------------------- layout */

.sm-root {
    flex: 1;
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    padding: 18px 20px calc(28px + env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
}

.sm-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
    animation: sm-in .26s ease-out both;
}

@keyframes sm-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    .sm-screen, .sm-pop, .sm-mascot, .sm-dot { animation: none !important; }
    * { transition-duration: .01ms !important; }
}

.sm-spacer { flex: 1; }
.sm-center { text-align: center; }
.sm-center-block { align-self: center; }

/* --------------------------------------------------------------- splash */

.sm-splash { align-items: center; justify-content: center; gap: 22px; }
.sm-splash-logo { width: min(260px, 70vw); height: auto; }

.sm-dots { display: flex; gap: 10px; }

.sm-dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--blue);
    opacity: .35;
    animation: sm-blink 1.1s ease-in-out infinite;
}

.sm-dot:nth-child(2) { animation-delay: .18s; }
.sm-dot:nth-child(3) { animation-delay: .36s; }

@keyframes sm-blink {
    0%, 100% { opacity: .3; transform: scale(.85); }
    50% { opacity: 1; transform: scale(1); }
}

/* --------------------------------------------------------------- typography */

.sm-h1 { font-size: 26px; line-height: 1.25; font-weight: 700; margin: 0; }
.sm-h2 { font-size: 19px; line-height: 1.3; font-weight: 700; margin: 0; }
.sm-lead { font-size: 16px; line-height: 1.5; margin: 0; color: var(--muted); }
.sm-note { font-size: 14px; line-height: 1.5; color: var(--muted); margin: 0; }

/* ------------------------------------------------------------------- bar */

.sm-topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }

.sm-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border: 0;
    border-radius: 999px;
    padding: 7px 14px;
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
}

.sm-chip img { width: 24px; height: 24px; display: block; }
.sm-chip-badge { background: var(--gold-soft); color: #8a5a06; }
.sm-chip-won { background: var(--gold-soft); color: #8a5a06; cursor: default; }
.sm-chip-cat { background: #e4effb; color: var(--blue-dark); cursor: default; }

.sm-linkish {
    background: none;
    border: 0;
    padding: 6px 2px;
    color: var(--blue);
    font: inherit;
    font-size: 15px;
    cursor: pointer;
    text-decoration: none;
}

.sm-footer { display: flex; justify-content: space-between; gap: 10px; margin-top: 4px; }
.sm-footer .sm-linkish { color: var(--muted); font-size: 13px; text-decoration: underline; }

/* -------------------------------------------------------------- progress */

.sm-progress {
    background: #e6eef7;
    border-radius: 999px;
    height: 12px;
    overflow: hidden;
}

.sm-progress-fill {
    --p: 0;
    height: 100%;
    width: calc(var(--p) * 100%);
    background: var(--blue);
    border-radius: 999px;
    transition: width .5s ease;
}

.sm-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.sm-stat {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sm-stat-label { font-size: 12px; color: var(--muted); }
.sm-stat-value { font-size: 19px; font-weight: 700; line-height: 1.2; }
.sm-stat-note { font-size: 12px; color: var(--gold); font-weight: 500; }

/* ------------------------------------------------------------ task rows */

.sm-rows { display: flex; flex-direction: column; gap: 10px; }

.sm-row {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 14px 16px;
    background: var(--card);
    border: 2px solid var(--line);
    border-radius: var(--radius);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.sm-row[disabled] { cursor: default; }
.sm-row.is-now { border-color: var(--blue); }
.sm-row.is-locked { opacity: .55; }

.sm-row-mark {
    width: 44px;
    height: 44px;
    flex: 0 0 auto;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 17px;
    font-weight: 700;
    color: #fff;
    background: var(--locked);
}

.sm-row-mark img { width: 20px; height: 20px; opacity: .9; }
.sm-row.is-done .sm-row-mark { background: var(--green); }
.sm-row.is-now .sm-row-mark { background: var(--blue); }

.sm-row-body { display: flex; flex-direction: column; gap: 2px; }
.sm-row-title { font-size: 16px; font-weight: 500; color: var(--navy); }
.sm-row-state { font-size: 13px; color: var(--muted); }
.sm-row.is-done .sm-row-state { color: var(--green); }
.sm-row.is-now .sm-row-state { color: var(--blue); }

/* --------------------------------------------------------------- cards */

.sm-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow);
}

/* Barti's own attempt, in view before and during the mission. */
.sm-example {
    position: relative;
    background: var(--card);
    border: 2px solid var(--blue);
    border-radius: var(--radius);
    padding: 22px 16px 16px;
    text-align: center;
}

.sm-example-tag {
    position: absolute;
    top: -13px;
    left: 16px;
    background: var(--gold-soft);
    color: #8a5a06;
    border-radius: 999px;
    padding: 4px 12px;
    font-size: 13px;
    font-weight: 500;
}

.sm-example img {
    width: 100%;
    max-width: 260px;
    height: auto;
    border-radius: 12px;
    display: block;
    margin: 0 auto 10px;
}

.sm-example-caption { font-size: 15px; line-height: 1.45; margin: 0 0 4px; color: var(--navy); }

/* The badge bands: the trade, spelled out before the timer starts. */
.sm-bands {
    background: var(--gold-soft);
    border-radius: var(--radius);
    padding: 16px;
}

.sm-bands-title {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 0 0 14px;
    font-size: 16px;
    font-weight: 700;
    color: #8a5a06;
    line-height: 1.3;
}

.sm-bolt { font-size: 20px; line-height: 1; }
.sm-bands-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; }
.sm-band { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.sm-band-coins { display: flex; }
.sm-band-coins img { width: 30px; height: 30px; margin-left: -8px; }
.sm-band-coins img:first-child { margin-left: 0; }
.sm-band:not(.is-best) .sm-band-coins img { filter: grayscale(1); opacity: .55; }
.sm-band-range { font-size: 13px; color: var(--muted); }
.sm-band-badges { font-size: 14px; font-weight: 700; color: #8a5a06; }

.sm-badge-preview {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--card);
    border: 1px dashed var(--line);
    border-radius: var(--radius);
    padding: 12px 14px;
}

.sm-badge-preview span span { display: block; }

/* ---------------------------------------------------------------- timer */

.sm-timer {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 22px;
    text-align: center;
    box-shadow: var(--shadow);
}

.sm-clock {
    display: block;
    font-size: 54px;
    font-weight: 700;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
    color: var(--navy-deep);
}

/* ------------------------------------------------------------ celebration */

.sm-mascot { width: min(230px, 62vw); height: auto; align-self: center; }

.sm-pop { animation: sm-pop .5s cubic-bezier(.2, 1.4, .5, 1) both; }

@keyframes sm-pop {
    from { transform: scale(.55); opacity: 0; }
    to { transform: none; opacity: 1; }
}

.sm-coins { display: flex; justify-content: center; gap: 6px; }

.sm-time-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px 16px;
}

.sm-time-icon { font-size: 26px; }
.sm-time-card span span { display: block; }
.sm-time-value { font-size: 21px; font-weight: 700; }

.sm-reward {
    background: var(--purple-soft);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

/* ------------------------------------------------------------- collection */

.sm-banner {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--gold-soft);
    border-radius: var(--radius);
    padding: 14px 16px;
}

.sm-banner span span { display: block; }
.sm-banner-title { font-size: 17px; font-weight: 700; color: #8a5a06; }
.sm-banner-sub { font-size: 13px; color: #9a6a1a; }

.sm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.sm-badge {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px 10px;
    text-align: center;
    box-shadow: var(--shadow);
}

.sm-badge img { width: 64px; height: 64px; }
.sm-badge-name { font-size: 13px; line-height: 1.3; margin: 8px 0 0; font-weight: 500; }
.sm-badge.is-locked { box-shadow: none; }
.sm-badge.is-locked .sm-badge-name { color: var(--muted); font-weight: 400; }

/* --------------------------------------------------------------- buttons */

.sm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 56px;
    padding: 14px 20px;
    border: 0;
    border-radius: 14px;
    font: inherit;
    font-size: 18px;
    font-weight: 500;
    color: #fff;
    text-decoration: none;
    cursor: pointer;
    transition: background-color .12s ease, transform .1s ease;
}

.sm-btn:active { transform: translateY(1px); }
.sm-btn-primary { background: var(--blue); }
.sm-btn-primary:hover { background: var(--blue-dark); }
.sm-btn-go { background: var(--green); }
.sm-btn-go:hover { background: var(--green-dark); }
.sm-btn-verify { background: var(--green); }
.sm-btn-quiet { background: #fff; color: var(--navy); border: 2px solid var(--line); }
.sm-btn[disabled] { background: #d9dee4; color: #8b95a1; cursor: not-allowed; }

/* ----------------------------------------------------------------- plans */

.sm-member {
    background: #eef7e6;
    border-radius: var(--radius);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sm-member .sm-h2 { color: var(--green-dark); }

.sm-or {
    text-align: center;
    color: var(--muted);
    font-size: 14px;
    margin: 6px 0;
    position: relative;
}

.sm-plans { display: flex; flex-direction: column; gap: 12px; }
.sm-plan-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.sm-plan {
    position: relative;
    background: var(--card);
    border: 2px solid var(--line);
    border-radius: var(--radius);
    padding: 18px 14px 14px;
    font: inherit;
    text-align: left;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sm-plan.is-chosen { border-color: var(--blue); }
.sm-plan-name { font-size: 17px; font-weight: 700; }
.sm-plan-price strong { font-size: 26px; font-weight: 700; }
.sm-plan-price small { font-size: 13px; color: var(--muted); margin-left: 3px; }
.sm-plan-note { font-size: 12px; color: var(--muted); line-height: 1.35; }

.sm-save {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--gold-soft);
    color: #8a5a06;
    font-size: 12px;
    font-weight: 700;
    border-radius: 999px;
    padding: 3px 10px;
    white-space: nowrap;
}

.sm-ok {
    background: #eef7e6;
    border-radius: var(--radius);
    padding: 14px 16px;
    color: var(--green-dark);
}


/* The gate's number, written out. Long compound words need room to wrap and
   a size that makes reading them the actual task. */
.sm-sum-word {
    /* "settecentosessantaquattro" is 25 characters and splitting it in half
       turns a reading task into a puzzle about hyphens. Scale with the
       screen so it stays on one line on a phone. */
    font-size: clamp(15px, 4.6vw, 21px);
    line-height: 1.35;
    overflow-wrap: break-word;
}

/* The confirmation page renders its plans as forms, one button each, so the
   whole adult journey works with JavaScript switched off. */
.sm-plan-form { margin: 0; display: flex; }
.sm-plan-form .sm-plan { width: 100%; }

.sm-plan-go {
    margin-top: 8px;
    color: var(--blue);
    font-weight: 500;
    font-size: 15px;
}


/* "Show a grown-up" — a nudge, not a notification. */
.sm-show-grownup {
    background: var(--gold-soft);
    color: #8a5a06;
    border-radius: 999px;
    padding: 10px 16px;
    margin: 0 auto;
    font-size: 15px;
    font-weight: 500;
    text-align: center;
}

/* The Back to School line, while that campaign is running. */
.sm-campaign {
    background: #eef7e6;
    border-radius: var(--radius);
    padding: 14px 16px;
}

.sm-campaign strong { display: block; color: var(--green-dark); margin-bottom: 4px; }

/* ------------------------------------------------------------------ forms */

.sm-input {
    width: 100%;
    min-height: 52px;
    padding: 12px 16px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    font: inherit;
    font-size: 16px;
    color: var(--navy);
}

.sm-input-big { text-align: center; font-size: 20px; }

.sm-input:focus-visible,
:where(a, button, input):focus-visible {
    outline: 3px solid var(--blue);
    outline-offset: 2px;
}

.sm-check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 1.4; }
.sm-check input { width: 20px; height: 20px; margin: 2px 0 0; flex: 0 0 auto; }

.sm-error { color: #b3261e; font-size: 15px; margin: 0; }

/* ------------------------------------------------------------------ sheet */

.sm-modal {
    position: fixed;
    inset: 0;
    background: rgba(13, 53, 87, .45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    z-index: 20;
}

.sm-sheet {
    background: var(--cream);
    width: 100%;
    max-width: 420px;
    border-radius: 22px;
    padding: 24px 20px;
    max-height: 92svh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    animation: sm-up .22s ease-out both;
}

@keyframes sm-up {
    from { transform: translateY(16px); opacity: .5; }
    to { transform: none; opacity: 1; }
}

.sm-lock {
    width: 62px;
    height: 62px;
    border-radius: 50%;
    background: #e4effb;
    display: grid;
    place-items: center;
    align-self: center;
}

.sm-sum {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 20px;
    text-align: center;
    font-size: 30px;
    font-weight: 700;
}

/* -------------------------------------------------------------- documents */

.sm-doc { max-width: 660px; margin: 0 auto; padding: 24px 20px 60px; line-height: 1.6; }
.sm-doc-narrow { max-width: 460px; text-align: center; }
.sm-doc h1 { font-size: 25px; line-height: 1.3; }
.sm-doc h2 { font-size: 18px; margin-top: 28px; }
.sm-doc a { color: var(--blue); }

.sm-doc-back { display: inline-block; margin-bottom: 14px; color: var(--muted); text-decoration: none; font-size: 15px; }

.sm-doc-draft {
    background: var(--gold-soft);
    border-left: 4px solid var(--gold);
    padding: 12px 14px;
    border-radius: 8px;
}

.sm-doc-updated { color: var(--muted); font-size: 14px; margin-top: 32px; }
.sm-noscript { padding: 24px; text-align: center; }
