:root {
    --page: #f6f4fe;
    --panel: #ffffff;
    --panel-muted: #f0edfb;
    --ink: #1d1b3a;
    --muted: #5a5878;
    --line: #dddaf0;
    --line-strong: #8c88b3;
    --primary: #6d4aff;
    --primary-dark: #5233d6;
    --primary-soft: #e9e4ff;
    --accent: #f0489b;
    --accent-soft: #fde4f0;
    --error: #b0185f;
    --shadow: 0 20px 60px rgba(29, 27, 58, 0.12);
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html {
    min-height: 100%;
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    background:
        linear-gradient(180deg, #ece8fb 0%, var(--page) 42%, #fff7fb 100%);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: 0;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(109, 74, 255, 0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(109, 74, 255, 0.045) 1px, transparent 1px);
    background-size: 34px 34px;
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.72), transparent 78%);
}

.homePage {
    display: grid;
    align-items: center;
}

.homeShell {
    position: relative;
    width: min(100%, 1160px);
    margin: 0 auto;
    padding: 36px 18px;
}

.homeIntro {
    max-width: 720px;
    margin-bottom: 22px;
}

.brandLogo {
    display: block;
    width: auto;
    height: 60px;
    margin-bottom: 16px;
}

.brandHome {
    display: inline-flex;
    flex: none;
    align-items: center;
    min-height: 44px;
    border-radius: 6px;
}

.brandHome img {
    display: block;
    width: auto;
    height: 36px;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--primary-dark);
    font-size: 0.8rem;
    font-weight: 850;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.homeIntro h1,
.appTopbar h1 {
    margin: 0;
    color: var(--ink);
    font-weight: 820;
    line-height: 1.05;
    letter-spacing: 0;
}

.homeIntro h1 {
    font-size: clamp(2rem, 4vw, 3.25rem);
    line-height: 1.1;
}

.homeIntro p {
    max-width: 650px;
    margin: 12px 0 0;
    color: var(--muted);
    font-size: 1.08rem;
    line-height: 1.6;
}

.homeIntro .trustLine {
    margin-top: 8px;
    color: var(--ink);
    font-size: 0.95rem;
    font-weight: 700;
}

.artTiles {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.artTile {
    display: grid;
    align-content: start;
    gap: 10px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--ink);
    background: rgba(255, 255, 255, 0.95);
    box-shadow: var(--shadow);
    text-decoration: none;
    transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.artTile:hover,
.artTile:focus {
    border-color: var(--primary);
    color: var(--ink);
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 24px 70px rgba(29, 27, 58, 0.16);
}

.tileCanvas,
.tileCompare {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fcfbff;
}

.tileCanvas {
    aspect-ratio: 3 / 2;
    max-height: 212px;
    object-fit: contain;
}

.tileCompare {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 15px;
}

.tileCompare img {
    width: min(42%, 180px);
    height: auto;
    aspect-ratio: 1 / 1;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: #fff;
}

.tileArrow {
    color: var(--primary-dark);
    font-size: 1.5rem;
    font-weight: 850;
}

.tileLabel {
    color: var(--primary-dark);
    font-size: 0.78rem;
    font-weight: 850;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.artTile strong {
    color: var(--ink);
    font-size: 1.55rem;
    line-height: 1.15;
}

.tileText {
    color: var(--muted);
    line-height: 1.5;
}

.tileCta {
    display: inline-flex;
    align-items: center;
    justify-self: start;
    min-height: 44px;
    padding: 9px 16px;
    border-radius: 8px;
    color: #fff;
    background: var(--primary);
    font-weight: 800;
}

.artTile:hover .tileCta,
.artTile:focus .tileCta {
    background: var(--primary-dark);
}

.howItWorks {
    margin-top: 34px;
}

.howItWorks h2 {
    margin: 0 0 12px;
    color: var(--ink);
    font-size: 1.2rem;
    font-weight: 820;
}

.howItWorks ol {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: step;
}

.howItWorks li {
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.7);
    line-height: 1.5;
    counter-increment: step;
}

.howItWorks li::before {
    content: counter(step);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    margin-bottom: 8px;
    border-radius: 50%;
    color: var(--primary-dark);
    background: var(--primary-soft);
    font-weight: 850;
}

.howItWorks li strong {
    display: block;
    margin-bottom: 2px;
    color: var(--ink);
}

/* Get your kit: WhatsApp and Instagram, with a QR code for visitors on a computer */
.kitBand {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 24px;
    margin-top: 34px;
    padding: 24px;
    border-radius: 8px;
    color: #fff;
    background: linear-gradient(110deg, var(--primary-dark) 0%, var(--primary) 50%, var(--accent) 100%);
    box-shadow: var(--shadow);
}

.kitBand h2 {
    margin: 0;
    color: #fff;
    font-size: 1.45rem;
    font-weight: 820;
    line-height: 1.2;
}

.kitBand p {
    max-width: 560px;
    margin: 8px 0 0;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.55;
}

.kitActions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 18px;
}

.kitButton {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 52px;
    padding: 8px 18px 8px 14px;
    border: 1px solid #fff;
    border-radius: 8px;
    color: var(--ink);
    background: #fff;
    font-weight: 800;
    line-height: 1.2;
    text-decoration: none;
    transition: transform 160ms ease, background-color 160ms ease;
}

.kitButton:hover,
.kitButton:focus {
    color: var(--ink);
    text-decoration: none;
    transform: translateY(-1px);
}

.kitButton:focus-visible {
    outline: 3px solid var(--ink);
    outline-offset: 2px;
}

.kitButton svg {
    flex: none;
    width: 26px;
    height: 26px;
    color: var(--primary);
}

.kitButton small {
    display: block;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 700;
}

.kitButtonQuiet {
    border-color: rgba(255, 255, 255, 0.7);
    color: #fff;
    background: transparent;
}

.kitButtonQuiet:hover,
.kitButtonQuiet:focus {
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
}

.kitButtonQuiet svg,
.kitButtonQuiet small {
    color: rgba(255, 255, 255, 0.85);
}

.kitQr {
    display: grid;
    justify-items: center;
    gap: 6px;
    margin: 0;
    padding: 10px 10px 8px;
    border-radius: 8px;
    background: #fff;
}

.kitQr svg {
    display: block;
    width: 132px;
    height: 132px;
}

.kitQr figcaption {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
}

.container {
    position: relative;
    width: min(100%, 896px);
    padding: 28px 18px 56px;
}

.geometricApp {
    position: relative;
    width: min(100%, 1280px);
    margin: 0 auto;
    padding: 28px 18px 48px;
}

.appTopbar {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 22px;
}

.appTopbar h1 {
    font-size: clamp(2rem, 4vw, 3.4rem);
}

.appTopbar .eyebrow {
    margin-bottom: 4px;
}

.patternWorkbench {
    display: grid;
    grid-template-columns: minmax(250px, 320px) minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.patternPanel,
.patternStage {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 16px 42px rgba(29, 27, 58, 0.1);
}

.patternPanel,
.setupControls,
.playerSettings {
    display: grid;
    gap: 10px;
}

.patternPanel {
    padding: 18px;
}

.phaseHeader {
    display: grid;
    gap: 4px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
}

.phaseStep {
    color: var(--primary-dark);
    font-size: 0.78rem;
    font-weight: 850;
    text-transform: uppercase;
}

.phaseHeader h2 {
    margin: 0;
    color: var(--ink);
    font-size: 1rem;
    font-weight: 800;
}

.patternChoice:disabled {
    cursor: not-allowed;
}

.patternPanel label,
.panelLabel {
    margin-bottom: -2px;
}

.panelLabel {
    color: var(--ink);
    font-size: 0.86rem;
    font-weight: 700;
}

.fieldHint {
    margin-left: 6px;
    color: var(--muted);
    font-weight: 400;
}

.fieldHelp {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 400;
    line-height: 1.4;
}

.fieldError {
    display: block;
    margin-top: 6px;
    color: var(--error);
    font-size: 0.82rem;
    font-weight: 700;
}

.patternChoices {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.patternChoice {
    display: grid;
    gap: 7px;
    min-height: 0;
    margin: 0;
    padding: 8px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    color: var(--ink);
    background: #fcfbff;
    text-align: left;
    box-shadow: none;
}

.patternChoice:hover,
.patternChoice:focus {
    border-color: var(--primary);
    background: #ffffff;
}

.patternChoice.isSelected {
    border-color: var(--primary);
    background: var(--primary-soft);
    box-shadow: 0 0 0 2px rgba(109, 74, 255, 0.14);
}

.patternChoice canvas {
    display: block;
    width: 100%;
    aspect-ratio: 17 / 12;
    border: 1px solid rgba(221, 218, 240, 0.85);
    border-radius: 6px;
    background: #fff;
}

.patternChoice span {
    font-size: 0.8rem;
    font-weight: 850;
    text-align: center;
}

.colorInput {
    min-height: 44px;
    padding: 5px;
}

.checkRow {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 44px;
    margin: 0;
    cursor: pointer;
}

.checkRow input,
.playerVoice input {
    flex: none;
    width: 20px;
    height: 20px;
    accent-color: var(--primary);
}

.patternActions {
    display: grid;
    gap: 10px;
    margin-top: 6px;
}

.downloadRow {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.downloadRow .btn {
    padding-right: 8px;
    padding-left: 8px;
    font-size: 0.86rem;
}

.patternStage {
    padding: 16px;
}

#geometricCanvas {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.patternStats {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 12px;
    color: var(--primary-dark);
    font-weight: 800;
}

.playerVoice {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 44px;
    margin: 0;
    font-weight: 800;
    cursor: pointer;
}

.geometricApp.isDrawingMode {
    width: 100%;
    min-height: 100vh;
    max-width: none;
    padding: 0;
    color: #f9f8fd;
    background:
        radial-gradient(circle at 58% 44%, rgba(240, 72, 155, 0.2), transparent 28%),
        linear-gradient(135deg, #111312 0%, #171b22 100%);
}

.geometricApp.isDrawingMode .appTopbar,
.geometricApp.isDrawingMode .setupControls,
.geometricApp.isDrawingMode .patternStats {
    display: none;
}

.geometricApp.isDrawingMode .patternWorkbench {
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 0;
    min-height: 100vh;
}

.geometricApp.isDrawingMode .patternPanel {
    position: sticky;
    top: 0;
    align-content: start;
    height: 100vh;
    overflow-y: auto;
    border: 0;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 0;
    color: #f9f8fd;
    background: rgba(13, 14, 14, 0.96);
    box-shadow: none;
}

.geometricApp.isDrawingMode .phaseHeader {
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

.geometricApp.isDrawingMode .phaseStep,
.geometricApp.isDrawingMode .phaseHeader h2,
.geometricApp.isDrawingMode label {
    color: #f9f8fd;
}

.geometricApp.isDrawingMode .form-control,
.geometricApp.isDrawingMode .btn-secondary {
    border-color: rgba(255, 255, 255, 0.45);
    color: #f9f8fd;
    background: rgba(255, 255, 255, 0.08);
}

.geometricApp.isDrawingMode .form-control option {
    color: var(--ink);
}

.playerSettings > * {
    padding: 12px 14px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    color: #f9f8fd;
    background: rgba(255, 255, 255, 0.09);
}

.playerCard {
    display: grid;
    gap: 6px;
    font-weight: 800;
}

.playerCard .caption {
    margin: 0;
    color: #f9f8fd;
    font-size: 0.95rem;
}

.playerCardStats {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

/* Female / Male: two halves of one switch; the chosen one is filled. */
.playerSettings > .voiceChoice {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    padding: 6px;
}

.voiceChoice label {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    margin: 0;
    border-radius: 6px;
    font-weight: 800;
    cursor: pointer;
    transition: background-color 160ms ease;
}

.voiceChoice input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.voiceChoice label:hover {
    background: rgba(255, 255, 255, 0.08);
}

.voiceChoice label:has(input:checked) {
    color: #fff;
    background: var(--primary);
}

.voiceChoice label:has(input:focus-visible) {
    box-shadow: 0 0 0 3px var(--primary-soft);
}

/* Time per line: Slower and Faster round buttons either side of the time, with the
   next faster time faded above it and the next slower one below. */
.stepTimer {
    display: grid;
    gap: 8px;
}

.stepTimerLabel {
    color: rgba(255, 255, 255, 0.74);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.stepTimerBody {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
}

button.stepTimerButton {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    min-height: 0;
    padding: 0;
    border: 0;
    color: #f9f8fd;
    background: none;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

button.stepTimerButton:hover {
    transform: none;
}

.stepTimerSign {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    font-size: 1.5rem;
    font-weight: 500;
    line-height: 1;
    transition: background-color 160ms ease;
}

button.stepTimerButton:hover .stepTimerSign {
    background: rgba(255, 255, 255, 0.22);
}

button.stepTimerButton:active .stepTimerSign {
    background: rgba(255, 255, 255, 0.3);
}

button.stepTimerButton:focus-visible {
    outline: none;
}

button.stepTimerButton:focus-visible .stepTimerSign {
    box-shadow: 0 0 0 3px var(--primary);
}

button.stepTimerButton:disabled {
    opacity: 0.35;
    cursor: default;
}

.stepTimerHint {
    color: rgba(255, 255, 255, 0.74);
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.stepTimerValues {
    display: grid;
    justify-items: center;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.stepTimerNeighbour {
    min-height: 1.2em;
    color: rgba(255, 255, 255, 0.32);
    font-size: 0.85rem;
    font-weight: 700;
}

.stepTimerValue {
    color: #fff;
    font-size: 1.5rem;
    font-weight: 850;
}

.geometricApp.isDrawingMode .patternStage {
    position: sticky;
    top: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto auto;
    align-items: center;
    justify-items: center;
    gap: 14px;
    height: 100vh;
    padding: 16px 40px 24px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.geometricApp.isDrawingMode #geometricCanvas {
    width: min(100%, calc(100vh - 236px));
    max-width: 840px;
    border-color: rgba(255, 255, 255, 0.16);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.08),
        0 0 72px rgba(109, 74, 255, 0.32),
        0 28px 90px rgba(0, 0, 0, 0.32);
}

.geometricApp.isDrawingMode .playerInstruction {
    align-items: center;
    color: #fff;
    text-shadow: 0 8px 26px rgba(0, 0, 0, 0.45);
}

.geometricApp.isDrawingMode .playerInstruction span:not(.playerArrow) {
    min-width: 92px;
    font-size: 3.9rem;
    font-weight: 820;
}

.geometricApp.isDrawingMode .playerArrow {
    color: rgba(255, 255, 255, 0.74);
}

.geometricApp.isDrawingMode #geoLineSlider {
    width: 100%;
}

.geometricApp.isDrawingMode .playerControls {
    gap: 12px;
    margin: 0;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(34, 36, 45, 0.78);
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
}

.geometricApp.isDrawingMode .playerControls .btn {
    width: auto;
    min-width: 58px;
    border-radius: 999px;
}

.statusPill {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-height: 36px;
    margin: 0 0 14px;
    padding: 7px 13px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--primary-dark);
    background: var(--primary-soft);
    font-size: 0.96rem;
    font-weight: 700;
}

.statusPill.isLoading::before {
    content: "";
    flex: none;
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.intro {
    max-width: 650px;
    margin: 0;
    color: var(--muted);
    line-height: 1.65;
}

.uploadRow {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 20px;
    margin: 18px 0 10px;
}

.settingsBox {
    border-top: 1px solid var(--line);
}

.settingsBox summary,
.exampleBox summary {
    padding: 11px 0;
    color: var(--primary-dark);
    font-weight: 800;
    cursor: pointer;
}

.settingsBox .row {
    margin-top: 6px;
}

.settingsBox .col {
    display: flex;
}

.settingsBox .form-group {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
}

.settingsBox .form-group label {
    flex: 1 0 auto;
}

.row {
    gap: 0;
}

.form-group {
    margin-bottom: 8px;
}

label {
    color: var(--ink);
    font-size: 0.86rem;
    font-weight: 700;
}

.form-control,
textarea {
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    color: var(--ink);
    background: #fcfbff;
    box-shadow: none;
}

.form-control {
    height: 44px;
    padding: 9px 12px;
}

.form-control:focus,
textarea:focus {
    border-color: var(--primary);
}

.form-control.isInvalid {
    border-color: var(--error);
}

.form-control-range {
    accent-color: var(--primary);
}

.btn,
button {
    min-height: 44px;
    padding: 9px 16px;
    border: 1px solid transparent;
    border-radius: 8px;
    font-weight: 800;
    line-height: 1.2;
    cursor: pointer;
    transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.btn:hover,
button:hover {
    transform: translateY(-1px);
}

.btn:disabled,
button:disabled,
.form-control:disabled,
.btn-file.isDisabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.btn:disabled:hover,
button:disabled:hover {
    transform: none;
}

.btn-file.isDisabled {
    pointer-events: none;
}

.btn-primary,
.btn-file {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-file:hover,
.btn-file:focus {
    border-color: var(--primary-dark);
    background: var(--primary-dark);
    color: #fff;
}

.btn-secondary {
    border-color: var(--line-strong);
    background: #ffffff;
    color: var(--ink);
}

.btn-secondary:hover,
.btn-secondary:focus {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--ink);
}

button.linkButton,
button.linkButton:hover {
    margin: 0;
    padding: 9px 0;
    border-color: transparent;
    color: var(--primary-dark);
    background: none;
    font-weight: 700;
    text-decoration: underline;
    transform: none;
}

button.linkButton:hover {
    color: var(--ink);
}

.btn-file {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: normal;
}

.hidden {
    display: none !important;
}

.visuallyHidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    border: 0;
    white-space: nowrap;
}

.formMessage {
    margin: 0 0 14px;
    padding: 10px 12px;
    border: 1px solid var(--accent);
    border-radius: 8px;
    color: var(--ink);
    background: var(--accent-soft);
    font-weight: 700;
}

.center {
    width: 100%;
    margin: 0 auto 22px;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 16px 42px rgba(29, 27, 58, 0.1);
}

.inputoutput {
    color: var(--muted);
}

.caption {
    margin: 0 0 14px;
    color: var(--ink);
    font-size: 1.05rem;
    font-weight: 800;
    line-height: 1.3;
}

.cardHint {
    margin: -8px 0 14px;
}

.progressRow {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 14px;
    margin-bottom: 12px;
}

.progressRow progress {
    flex: 1 1 200px;
    height: 12px;
    accent-color: var(--primary);
}

#drawStatus,
#incrementalCurrentStep {
    color: var(--primary-dark);
    font-weight: 700;
}

#incrementalCurrentStep {
    display: block;
    margin-bottom: 12px;
}

.threadActions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 18px;
}

.threadActions .formMessage {
    flex: 1 1 100%;
    margin: 0;
}

.sequenceLabel {
    display: block;
    margin-bottom: 6px;
}

.sequenceHelp {
    margin: -6px 0 16px;
}

.exampleBox {
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-muted);
}

.exampleBox summary {
    color: var(--ink);
}

.exampleBox p {
    margin: 0 0 12px;
}

.exampleButtons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding-bottom: 14px;
}

.playerHeader {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 14px;
}

.playerHeader .caption {
    margin-bottom: 6px;
}

.playerInstruction {
    display: flex;
    align-items: baseline;
    gap: 14px;
    color: var(--ink);
    font-weight: 850;
    line-height: 1;
}

.playerInstruction span:not(.playerArrow) {
    min-width: 76px;
    text-align: center;
    font-size: clamp(2.8rem, 7vw, 5.5rem);
}

.playerArrow {
    color: var(--muted);
    font-size: 1rem;
    font-weight: 800;
    text-transform: uppercase;
}

/* The nail to go to now, big in the middle, with the two before and the two after it getting smaller. */
.nailWindow {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: baseline;
    column-gap: 40px;
    width: 100%;
}

.geometricApp.isDrawingMode .nailWindow {
    align-items: baseline;
}

.nearNails {
    display: flex;
    align-items: baseline;
    gap: 32px;
}

.nailsBefore {
    justify-self: end;
}

.nailsAfter {
    justify-self: start;
}

.geometricApp.isDrawingMode .nailWindow .nearNails span {
    min-width: 0;
    font-variant-numeric: tabular-nums;
}

.geometricApp.isDrawingMode .nailWindow .nearNails .isNear {
    font-size: 2.3rem;
}

.geometricApp.isDrawingMode .nailWindow .nearNails .isFar {
    font-size: 1.8rem;
}

.nearNails .isEmpty {
    visibility: hidden;
}

.playerStats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.playerStats > div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-muted);
}

.statLabel {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.playerStats strong {
    color: var(--ink);
    font-size: 1.05rem;
}

.centerImage,
.centerCanvasMedium,
.centerCanvasLarge {
    display: block;
    width: 100%;
    margin-right: auto;
    margin-left: auto;
    padding-right: 0;
    padding-left: 0;
    border-radius: 8px;
    background: #fff;
}

.centerImage,
.centerCanvasMedium {
    max-width: 500px;
}

.centerCanvasLarge {
    max-width: 800px;
}

canvas,
.centerImage {
    border: 1px solid var(--line);
    box-shadow: 0 12px 26px rgba(29, 27, 58, 0.08);
}

textarea {
    display: block;
    width: 100%;
    min-height: 180px;
    margin: 0 auto 16px;
    padding: 12px;
    resize: vertical;
}

.cropCanvas {
    max-width: min(500px, calc(100vh - 290px));
    border: 1px solid var(--primary);
    cursor: move;
    touch-action: none;
    background: #fff;
}

.cropControls {
    max-width: 500px;
    margin: 18px auto 0;
}

.cropButtons {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 16px;
}

.playerControls {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 16px;
}

.playerHint {
    margin: 12px 0 0;
    color: var(--muted);
    font-size: 0.86rem;
    text-align: center;
}

#incrementalDrawing .playerHeader {
    position: sticky;
    top: 0;
    z-index: 2;
    margin: -22px -22px 14px;
    padding: 14px 22px 12px;
    border-bottom: 1px solid var(--line);
    border-radius: 8px 8px 0 0;
    background: rgba(255, 255, 255, 0.97);
}

#canvasOutput2 {
    max-width: min(800px, calc(100vh - 250px));
}

#canvasOutput3 {
    max-width: min(800px, calc(100vh - 310px));
}

a:focus-visible,
button:focus-visible,
summary:focus-visible,
.btn:focus-visible,
.form-control:focus-visible,
textarea:focus-visible,
select:focus-visible,
input[type="range"]:focus-visible,
input[type="checkbox"]:focus-visible,
.patternChoice:focus-visible,
.artTile:focus-visible,
.btn-file:focus-within {
    outline: 3px solid var(--ink);
    outline-offset: 2px;
    box-shadow: 0 0 0 2px #fff;
}

.btn:focus:not(:focus-visible) {
    box-shadow: none;
}

@media (hover: none) {
    .playerHint {
        display: none;
    }
}

@media (max-width: 900px) {
    .geometricApp.isDrawingMode .patternWorkbench {
        grid-template-columns: minmax(0, 1fr);
        gap: 10px;
        min-height: 0;
        padding: 10px 12px 104px;
    }

    .geometricApp.isDrawingMode .patternPanel {
        display: contents;
    }

    .geometricApp.isDrawingMode .phaseHeader {
        display: none;
    }

    .geometricApp.isDrawingMode .patternActions {
        grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
        gap: 8px;
        order: 1;
        margin: 0;
    }

    .geometricApp.isDrawingMode .downloadRow {
        gap: 8px;
    }

    .geometricApp.isDrawingMode .patternActions .btn {
        padding: 8px 6px;
        font-size: 0.8rem;
    }

    .geometricApp.isDrawingMode .patternStage {
        position: static;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        order: 2;
        height: auto;
        padding: 0;
    }

    .geometricApp.isDrawingMode .playerSettings {
        order: 3;
    }

    .geometricApp.isDrawingMode .playerInstruction {
        position: sticky;
        top: 0;
        z-index: 3;
        justify-content: center;
        margin: 0 -12px;
        padding: 8px 12px;
        background: rgba(17, 19, 18, 0.94);
    }

    .geometricApp.isDrawingMode .playerInstruction span:not(.playerArrow) {
        min-width: 0;
        font-size: 3.2rem;
    }

    .geometricApp.isDrawingMode #geometricCanvas {
        align-self: center;
        width: min(100%, calc(100vh - 270px));
    }

    .geometricApp.isDrawingMode #geoLineSlider {
        height: 44px;
    }

    .geometricApp.isDrawingMode .playerControls {
        position: fixed;
        right: 12px;
        bottom: 12px;
        left: 12px;
        z-index: 4;
        flex-direction: row;
        justify-content: space-between;
        gap: 8px;
        padding: 10px 14px;
        border-radius: 16px;
        background: #22242d;
    }

    .geometricApp.isDrawingMode .playerControls .btn {
        flex: 1 1 0;
        min-width: 0;
        min-height: 48px;
    }
}

@media (max-width: 767px) {
    .homeShell,
    .geometricApp {
        padding: 24px 12px 36px;
    }

    .artTiles,
    .patternWorkbench,
    .howItWorks ol {
        grid-template-columns: 1fr;
    }

    /* On a phone the buttons open WhatsApp directly, so the QR code is not needed. */
    .kitBand {
        grid-template-columns: 1fr;
        padding: 20px 16px;
    }

    .kitQr {
        display: none;
    }

    .kitButton {
        width: 100%;
    }

    .geometricApp:not(.isDrawingMode) .patternStage {
        position: sticky;
        top: 0;
        z-index: 2;
        order: -1;
        padding: 8px;
    }

    .geometricApp:not(.isDrawingMode) #geometricCanvas {
        width: min(100%, 40vh);
        margin: 0 auto;
    }

    .geometricApp:not(.isDrawingMode) .patternStats {
        margin-top: 6px;
        font-size: 0.85rem;
    }

    .geometricApp:not(.isDrawingMode) .patternChoices {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 6px;
    }

    .geometricApp:not(.isDrawingMode) .patternChoice {
        padding: 5px;
    }

    .appTopbar {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
    }

    .container {
        padding: 18px 12px 36px;
    }

    .settingsBox .row {
        display: block;
    }

    .center {
        padding: 16px;
    }

    .cropButtons,
    .playerControls,
    .threadActions {
        flex-direction: column;
    }

    .playerHeader {
        display: block;
    }

    #incrementalDrawing .playerHeader {
        margin: -16px -16px 14px;
        padding: 12px 16px;
    }

    .playerInstruction {
        justify-content: center;
        margin-top: 14px;
    }

    .geometricApp.isDrawingMode .nailWindow .nearNails .isNear {
        font-size: 1.8rem;
    }

    .geometricApp.isDrawingMode .nailWindow .nearNails .isFar {
        font-size: 1.4rem;
    }

    .nailWindow {
        column-gap: 18px;
    }

    .nearNails {
        gap: 14px;
    }

    .playerStats {
        grid-template-columns: 1fr;
    }

    .btn,
    button,
    .btn-file {
        width: 100%;
    }
}

/* Narrow phones: five three-digit nails still fit across the screen. */
@media (max-width: 400px) {
    .nailWindow {
        column-gap: 12px;
    }

    .nearNails {
        gap: 10px;
    }

    .geometricApp.isDrawingMode .nailWindow .currentNail span {
        font-size: 2.7rem;
    }

    .geometricApp.isDrawingMode .nailWindow .nearNails .isNear {
        font-size: 1.5rem;
    }

    .geometricApp.isDrawingMode .nailWindow .nearNails .isFar {
        font-size: 1.15rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        scroll-behavior: auto !important;
        transition: none !important;
    }

    .statusPill.isLoading::before {
        animation: none;
    }
}
