/* ==========================================================================
   COTR Worship — app styles
   One stylesheet for every page. Colors live in the theme tokens below.
   ========================================================================== */

/* ---------- Theme tokens ---------- */

:root,
[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0B1020;
    --surface: #141B2F;
    --surface-2: #1B2440;
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.16);
    --text: #EEF2FA;
    --muted: #A3ACC2;
    --accent-soft: rgba(91, 140, 255, 0.16);
    --accent-soft-hover: rgba(91, 140, 255, 0.26);
    --accent-border: rgba(91, 140, 255, 0.45);
    --accent-text: #8FB0FF;
    --primary: #2F5BEA;
    --primary-hover: #3D69F5;
    --on-primary: #FFFFFF;
    --danger: #FF8A8A;
    --danger-border: rgba(255, 138, 138, 0.45);
    --danger-soft: rgba(255, 138, 138, 0.12);
    --success: #6EE7A8;
    --success-soft: rgba(110, 231, 168, 0.12);
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    --focus: #8FB0FF;
}

[data-theme="light"] {
    color-scheme: light;
    --bg: #F4F6FB;
    --surface: #FFFFFF;
    --surface-2: #EEF2FA;
    --border: #E2E7F1;
    --border-strong: #CDD5E3;
    --text: #0F172A;
    --muted: #556070;
    --accent-soft: #E6EDFF;
    --accent-soft-hover: #D6E1FF;
    --accent-border: #B9CBFF;
    --accent-text: #1D4ED8;
    --primary: #1D4ED8;
    --primary-hover: #1A44C0;
    --on-primary: #FFFFFF;
    --danger: #B42318;
    --danger-border: #F3B8B2;
    --danger-soft: #FEF0EE;
    --success: #0F7A47;
    --success-soft: #E6F6EE;
    --shadow: 0 10px 30px rgba(15, 23, 42, 0.10);
    --focus: #1D4ED8;
}

:root {
    --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
    --radius-sm: 12px;
    --radius: 16px;
    --radius-lg: 20px;
    --radius-xl: 24px;
    --page-x: 20px;
    --nav-height: 72px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ---------- Base ---------- */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    background: var(--bg);
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.25s, color 0.25s;
}

h1, h2, h3, p {
    margin: 0;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    display: block;
}

button,
input,
textarea,
select {
    font: inherit;
    color: inherit;
}

button {
    cursor: pointer;
}

:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
}

[hidden] {
    display: none !important;
}

.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.skip-link {
    position: absolute;
    left: 12px;
    top: -60px;
    z-index: 100;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: var(--primary);
    color: var(--on-primary);
    font-weight: 700;
}

.skip-link:focus {
    top: 12px;
}

.icon {
    flex-shrink: 0;
}

/* ---------- Layout ---------- */

.app {
    width: 100%;
    max-width: 640px;
    margin: 0 auto;
    padding-bottom: 32px;
}

.app--with-nav {
    padding-bottom: calc(var(--nav-height) + var(--safe-bottom) + 40px);
}

.page {
    padding: 12px var(--page-x) 0;
}

.stack-xs > * + * { margin-top: 10px; }
.stack-sm > * + * { margin-top: 12px; }
.stack-md > * + * { margin-top: 18px; }
.stack-lg > * + * { margin-top: 24px; }
.stack-2 { display: flex; flex-direction: column; gap: 2px; }

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

/* ---------- Text ---------- */

.eyebrow {
    display: block;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent-text);
}

.section-label {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}

.page-title {
    font-size: 30px;
    line-height: 1.15;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.muted { color: var(--muted); }
.text { color: var(--text); }
.small { font-size: 13px; }
.strong { font-weight: 700; }

.link {
    font-size: 14px;
    font-weight: 700;
    color: var(--accent-text);
}

.link:hover {
    text-decoration: underline;
}

.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

/* ---------- Headers ---------- */

.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 20px var(--page-x) 8px;
}

.top-bar__title {
    font-size: 15px;
    font-weight: 700;
    color: var(--muted);
}

.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    padding: 24px var(--page-x) 4px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand__logo {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #fff;
    object-fit: cover;
}

.brand__name {
    font-size: 16px;
    font-weight: 800;
    letter-spacing: -0.01em;
}

/* ---------- Cards ---------- */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    transition: background-color 0.25s, border-color 0.2s;
}

a.card:hover {
    border-color: var(--accent-border);
}

.welcome {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    border-radius: var(--radius-xl);
}

.welcome__logo {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: #fff;
    object-fit: cover;
    flex-shrink: 0;
}

.welcome__text {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.welcome__title {
    font-size: 22px;
    line-height: 1.15;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.tile {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-height: 120px;
    padding: 18px;
}

.tile__icon {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-soft);
    color: var(--accent-text);
}

.tile__icon--lg {
    width: 64px;
    height: 64px;
    border-radius: 20px;
}

.tile__text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.tile__title {
    font-size: 17px;
    font-weight: 700;
}

/* ---------- Buttons ---------- */

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 52px;
    padding: 0 20px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    transition: background-color 0.15s, border-color 0.15s, transform 0.1s, opacity 0.15s;
}

.button:active:not(:disabled) {
    transform: scale(0.98);
}

.button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.button--block {
    width: 100%;
}

.button--primary {
    background: var(--primary);
    color: var(--on-primary);
}

.button--primary:hover:not(:disabled) {
    background: var(--primary-hover);
}

.button--soft {
    background: var(--accent-soft);
    color: var(--accent-text);
}

.button--soft:hover:not(:disabled) {
    background: var(--accent-soft-hover);
}

.button--ghost {
    background: transparent;
    border-color: var(--border-strong);
}

.button--ghost:hover {
    background: var(--surface-2);
}

.button--danger {
    background: transparent;
    border-color: var(--danger-border);
    color: var(--danger);
}

.button--danger:hover {
    background: var(--danger-soft);
}

.icon-button,
.square-button {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    transition: background-color 0.15s, border-color 0.15s;
}

.square-button {
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    font-size: 22px;
    font-weight: 600;
}

.icon-button:hover,
.square-button:hover {
    border-color: var(--accent-border);
}

.icon-button--ghost {
    border-color: transparent;
    background: transparent;
    color: var(--accent-text);
}

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

.fab {
    position: fixed;
    z-index: 20;
    right: max(20px, calc(50% - 320px + 20px));
    bottom: calc(var(--nav-height) + var(--safe-bottom) + 18px);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 54px;
    padding: 0 22px;
    border-radius: 27px;
    background: var(--primary);
    color: var(--on-primary);
    font-size: 15px;
    font-weight: 700;
    box-shadow: 0 8px 24px rgba(29, 78, 216, 0.35);
}

.fab:hover {
    background: var(--primary-hover);
}

/* Theme toggle: show the sun in dark mode and the moon in light mode. */
.theme-icon-light { display: none; }
[data-theme="light"] .theme-icon-dark { display: none; }
[data-theme="light"] .theme-icon-light { display: inline-flex; }
.theme-icon-dark { display: inline-flex; }

/* ---------- Bottom menu ---------- */

.bottom-nav {
    position: fixed;
    z-index: 30;
    left: 0;
    right: 0;
    bottom: 0;
    display: grid;
    grid-template-columns: repeat(var(--nav-items, 4), minmax(0, 1fr));
    height: calc(var(--nav-height) + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    background: var(--surface);
    border-top: 1px solid var(--border);
}

@media (min-width: 680px) {
    .bottom-nav {
        left: 50%;
        right: auto;
        width: 640px;
        transform: translateX(-50%);
        border: 1px solid var(--border);
        border-bottom: 0;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    }
}

.bottom-nav__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    transition: color 0.15s;
}

.bottom-nav__item:hover {
    color: var(--text);
}

.bottom-nav__item.is-active {
    color: var(--accent-text);
    font-weight: 700;
}

/* ---------- Songs ---------- */

.key-badge {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: var(--accent-soft);
    color: var(--accent-text);
    line-height: 1;
}

.key-badge--lg {
    width: 48px;
    height: 48px;
    border-radius: 14px;
}

.key-badge__key {
    font-family: var(--font-mono);
    font-size: 15px;
    font-weight: 700;
}

.key-badge--lg .key-badge__key {
    font-size: 17px;
}

.key-badge__label {
    margin-top: 3px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.list {
    overflow: hidden;
}

.song-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    transition: background-color 0.15s, border-color 0.15s;
}

.list .song-row + .song-row {
    border-top: 1px solid var(--border);
}

.list .song-row:hover {
    background: var(--surface-2);
}

.song-row--card {
    padding: 14px;
    border-radius: 18px;
    background: var(--surface);
    border: 1px solid var(--border);
}

.song-row--card:hover {
    border-color: var(--accent-border);
}

.song-row__text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.song-row__title {
    font-size: 16px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.song-row__meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--muted);
}

.song-row__photo {
    display: inline-flex;
}

.song-row__chevron {
    display: inline-flex;
    color: var(--muted);
}

.search__field {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 52px;
    padding: 0 16px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--muted);
    transition: border-color 0.15s;
}

.search__field:focus-within {
    border-color: var(--accent-border);
}

.search__field input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: none;
    background: transparent;
    font-size: 16px;
    color: var(--text);
}

.search__field input::placeholder {
    color: var(--muted);
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 36px 20px;
    text-align: center;
    color: var(--muted);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-lg);
}

.empty-state[hidden] {
    display: none;
}

.empty-state--flat {
    border: 0;
    padding: 28px 12px;
}

.empty-state--hero {
    gap: 14px;
    padding: 48px 24px;
    border-style: solid;
    border-color: var(--border);
}

.empty-state__title {
    font-size: 20px;
    font-weight: 800;
    color: var(--text);
}

/* ---------- Song details ---------- */

.song-hero {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.song-hero__title {
    font-size: 28px;
    line-height: 1.15;
    font-weight: 800;
    letter-spacing: -0.02em;
    overflow-wrap: anywhere;
}

.transpose {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
}

.transpose__info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.transpose__controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.transpose__key {
    min-width: 56px;
    height: 44px;
    padding: 0 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: var(--primary);
    color: var(--on-primary);
    font-family: var(--font-mono);
    font-size: 20px;
    font-weight: 700;
}

/* All sections together in one box */
.chord-sheet {
    padding: 6px 18px;
}

.chord-block {
    padding: 14px 0;
}

.chord-block + .chord-block {
    border-top: 1px solid var(--border);
}

.chord-block__label {
    margin-bottom: 4px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
}

.chord-block--chorus .chord-block__label {
    color: var(--accent-text);
}

.chord-block--chorus .chord-block__label::before {
    content: "";
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 8px;
    border-radius: 50%;
    background: var(--accent-text);
    vertical-align: 1px;
}

.chords {
    margin: 0;
    font-family: var(--font-mono);
    font-size: 18px;
    font-weight: 500;
    line-height: 1.65;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    color: var(--text);
}

.photo-card {
    overflow: hidden;
}

.photo-card__image {
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    background: var(--surface-2);
}

.photo-card__image img {
    width: 100%;
    height: 190px;
    object-fit: cover;
    transition: opacity 0.15s;
}

.photo-card__image:hover img {
    opacity: 0.9;
}

.photo-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
}

/* Full-screen picture viewer */
.viewer {
    width: 100vw;
    height: 100dvh;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    background: rgba(5, 8, 18, 0.96);
    color: #fff;
}

.viewer::backdrop {
    background: rgba(5, 8, 18, 0.8);
}

.viewer__bar {
    position: fixed;
    z-index: 2;
    top: 0;
    right: 0;
    display: flex;
    gap: 8px;
    padding: 16px;
}

.viewer__bar .icon-button {
    background: rgba(255, 255, 255, 0.12);
    border-color: transparent;
    color: #fff;
}

.viewer__stage {
    width: 100%;
    height: 100%;
    overflow: auto;
    display: flex;
}

.viewer__stage img {
    margin: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transform-origin: center center;
}

.viewer__stage.is-zoomed img {
    max-width: none;
    max-height: none;
}

/* ---------- Line ups ---------- */

.date-badge {
    width: 52px;
    height: 56px;
    flex-shrink: 0;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    border-radius: 14px;
    background: var(--accent-soft);
    color: var(--accent-text);
    line-height: 1;
}

.date-badge__month {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.date-badge__day {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.date-badge--lg {
    width: 68px;
    height: 72px;
    border-radius: 18px;
}

.date-badge--lg .date-badge__day {
    font-size: 30px;
}

.lineup-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    border-radius: 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    transition: border-color 0.15s, background-color 0.15s;
}

.lineup-row:hover {
    border-color: var(--accent-border);
}

.lineup-row--next {
    border-color: var(--accent-border);
    background: linear-gradient(0deg, var(--accent-soft), var(--accent-soft)), var(--surface);
}

.lineup-row--next .date-badge {
    background: var(--primary);
    color: var(--on-primary);
}

.lineup-hero {
    display: flex;
    align-items: center;
    gap: 16px;
}

.info-list {
    padding: 4px 18px;
}

.info-list__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 0;
}

.info-list__row + .info-list__row {
    border-top: 1px solid var(--border);
}

.info-list__row--stack {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
}

.setlist {
    margin: 0;
    padding-left: 22px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 16px;
    font-weight: 600;
}

.setlist li::marker {
    color: var(--accent-text);
    font-weight: 800;
}

.photo-card__image--full img {
    height: auto;
    max-height: none;
    object-fit: contain;
}

input[type="date"].input {
    min-height: 50px;
}

/* ---------- Accounts ---------- */

.auth {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 20px;
    padding: 32px var(--page-x);
}

.auth__brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
}

.auth__logo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #fff;
    object-fit: cover;
    margin-bottom: 4px;
}

.auth__title {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.auth__card {
    padding: 22px;
}

.auth__switch {
    font-size: 15px;
    color: var(--muted);
}

.center { text-align: center; }
.center .tile__icon { margin: 0 auto; }
.right { text-align: right; }

.badge {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent-text);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.badge--off {
    background: var(--surface-2);
    color: var(--muted);
}

.avatar {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent-text);
    font-weight: 800;
}

.person {
    overflow: hidden;
}

.person__summary {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    cursor: pointer;
    list-style: none;
}

.person__summary::-webkit-details-marker {
    display: none;
}

.person__summary:hover {
    background: var(--surface-2);
}

.person[open] .person__summary {
    border-bottom: 1px solid var(--border);
}

.person__body {
    padding: 16px;
}

.member-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.member-row > span {
    display: flex;
    flex-direction: column;
}

.inline-form {
    display: flex;
    gap: 8px;
    flex: 1 1 220px;
}

.inline-form .input {
    min-height: 44px;
    padding: 8px 12px;
}

.inline-form .button {
    min-height: 44px;
}

.check {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    cursor: pointer;
}

.check input {
    width: 20px;
    height: 20px;
    accent-color: var(--primary);
}

select.input {
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
    background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%;
    background-size: 6px 6px;
    background-repeat: no-repeat;
    padding-right: 40px;
}

/* ---------- Offline + app ---------- */

.offline-banner {
    position: sticky;
    top: 0;
    z-index: 60;
    padding: 8px 16px;
    padding-top: calc(8px + env(safe-area-inset-top, 0px));
    background: #B45309;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    text-align: center;
}

.offline-card {
    padding: 18px;
}

.offline-card__head {
    display: flex;
    align-items: center;
    gap: 12px;
}

.js-offline-status.is-busy::before {
    content: "";
    display: inline-block;
    width: 10px;
    height: 10px;
    margin-right: 6px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    vertical-align: -1px;
    animation: spin 0.8s linear infinite;
}

.app-icon {
    width: 88px;
    height: 88px;
    border-radius: 22px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.steps {
    margin: 0;
    padding-left: 22px;
    display: grid;
    gap: 10px;
    font-size: 15px;
    line-height: 1.5;
}

.inline-icon {
    display: inline-flex;
    vertical-align: -3px;
    color: var(--primary);
}

/* ---------- Forms ---------- */

.form-card {
    padding: 20px;
}

.form-card__title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 17px;
    font-weight: 800;
}

.step {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    background: var(--accent-soft);
    color: var(--accent-text);
    font-size: 14px;
    font-weight: 800;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-inline: 0;
    margin-bottom: 0;
    padding: 0;
    border: 0;
    min-width: 0;
}

.field__label {
    padding: 0;
    font-size: 14px;
    font-weight: 700;
}

.input {
    width: 100%;
    min-height: 50px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong);
    background: var(--surface-2);
    font-size: 16px;
    color: var(--text);
    transition: border-color 0.15s, background-color 0.15s;
}

.input::placeholder {
    color: var(--muted);
    opacity: 0.85;
}

.input:hover {
    border-color: var(--accent-border);
}

.input:focus {
    outline: none;
    border-color: var(--focus);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.input--chords {
    font-family: var(--font-mono);
    font-size: 16px;
    line-height: 1.6;
    resize: vertical;
}

.input--chords.is-filled {
    animation: filled 1.2s ease-out;
}

@keyframes filled {
    from { box-shadow: 0 0 0 4px var(--accent-border); }
    to { box-shadow: 0 0 0 0 transparent; }
}

.key-picker {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 8px;
}

.key-picker__option {
    position: relative;
}

.key-picker__option input {
    position: absolute;
    opacity: 0;
    inset: 0;
    margin: 0;
    cursor: pointer;
}

.key-picker__option span {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 44px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong);
    background: var(--surface-2);
    font-family: var(--font-mono);
    font-size: 15px;
    font-weight: 700;
    transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.key-picker__option:hover span {
    border-color: var(--accent-border);
}

.key-picker__option input:checked + span {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--on-primary);
}

.key-picker__option input:focus-visible + span {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
}

.dropzone {
    position: relative;
    display: block;
    border-radius: var(--radius);
    border: 1.5px dashed var(--border-strong);
    background: var(--surface-2);
    cursor: pointer;
    overflow: hidden;
    transition: border-color 0.15s;
}

.dropzone:hover,
.dropzone:focus-within {
    border-color: var(--accent-border);
}

.dropzone__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 28px 16px;
    text-align: center;
}

.dropzone__preview {
    width: 100%;
    max-height: 320px;
    object-fit: contain;
    background: var(--surface-2);
}

.dropzone__change {
    display: none;
    position: absolute;
    right: 10px;
    bottom: 10px;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(5, 8, 18, 0.75);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
}

.dropzone.has-image {
    border-style: solid;
}

.dropzone.has-image .dropzone__empty {
    display: none;
}

.dropzone.has-image .dropzone__change {
    display: inline-flex;
}

.scan {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.scan__status.is-error {
    color: var(--danger);
}

.scan__status.is-success {
    color: var(--success);
}

.button.is-loading .icon {
    animation: spin 1s linear infinite;
}

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

.form-actions {
    position: sticky;
    bottom: calc(var(--nav-height) + var(--safe-bottom) + 12px);
    z-index: 10;
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 12px;
    padding: 12px;
    border-radius: var(--radius-lg);
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

/* ---------- Alerts & toasts ---------- */

.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
}

.alert--error {
    background: var(--danger-soft);
    color: var(--danger);
    border: 1px solid var(--danger-border);
}

.toast {
    position: fixed;
    z-index: 50;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 10px;
    width: max-content;
    max-width: calc(100% - 32px);
    padding: 12px 16px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    box-shadow: var(--shadow);
    font-size: 14px;
    font-weight: 700;
    transition: opacity 0.3s, transform 0.3s;
}

.toast--success { color: var(--success); }
.toast--error { color: var(--danger); }

.toast span { color: var(--text); }

.toast.is-hidden {
    opacity: 0;
    transform: translate(-50%, -12px);
    pointer-events: none;
}

/* ---------- Motion preference ---------- */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }
}
