/* Americano Padel Tracker — стилі.
   Мінімальний utility-CSS (щоб не тягти Tailwind Play CDN). */

:root {
    --bg: #0a0e17;
    --surface: #151b2e;
    --surface2: #1e2642;
    --border: #2a3352;
    --lime: #d4ff3a;
    --orange: #ff6b35;
    --text: #fafafa;
    --muted: #94a3b8;
    --dim: #64748b;
    --font-display: 'Anton', sans-serif;
    --font-body: 'Geist', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-image:
        radial-gradient(ellipse at top, rgba(212, 255, 58, 0.08), transparent 55%),
        radial-gradient(ellipse at bottom right, rgba(255, 107, 53, 0.05), transparent 50%);
    background-attachment: fixed;
}

button, input {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}

button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

button:disabled { cursor: not-allowed; }

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }

.loading {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
}

/* Container */
.page { padding: 32px 20px 96px; }
.page-tight { padding: 24px 20px 96px; }
.container { max-width: 28rem; margin: 0 auto; }

/* Layout utils */
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.grid { display: grid; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.shrink-0 { flex-shrink: 0; }
.flex-1 { flex: 1 1 0; min-width: 0; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: 1fr 1fr 1fr; }

/* Spacing */
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-5 { margin-bottom: 1.25rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-16 { margin-top: 4rem; }
.mx-auto { margin-left: auto; margin-right: auto; }
.space-y-1 > * + * { margin-top: 0.25rem; }
.space-y-2 > * + * { margin-top: 0.5rem; }

/* Text */
.text-center { text-align: center; }
.uppercase { text-transform: uppercase; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Shapes / visuals */
.rounded-md { border-radius: 0.375rem; }
.rounded-lg { border-radius: 0.5rem; }
.rounded-xl { border-radius: 0.75rem; }
.rounded-2xl { border-radius: 1rem; }
.rounded-full { border-radius: 9999px; }

/* Taps */
.tap:active { transform: scale(0.96); }
.tap { transition: transform 0.1s ease; }

/* Progress */
.progress {
    background: var(--surface);
    height: 3px;
    border-radius: 9999px;
    overflow: hidden;
}
.progress > span {
    display: block;
    background: var(--lime);
    height: 100%;
    transition: width 0.4s ease;
}

/* Cards */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 1.25rem;
}

.chip {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-weight: 700;
}
.chip-sm { width: 28px; height: 28px; font-size: 11px; }
.chip-md { width: 36px; height: 48px; font-size: 13px; }

/* Inputs */
.input {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 16px;
    height: 48px;
    border-radius: 0.5rem;
    padding: 0 16px;
    outline: none;
    width: 100%;
    transition: border-color 0.15s;
}
.input:focus { border-color: var(--lime); }

.score-input {
    background: var(--surface);
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 42px;
    text-align: center;
    height: 96px;
    width: 100%;
    border-radius: 0.75rem;
    outline: none;
    border: 2px solid var(--border);
    color: var(--text);
}
.score-input.is-a { border-color: var(--lime); color: var(--lime); }
.score-input.is-b { border-color: var(--orange); color: var(--orange); }

/* Labels */
.label {
    color: var(--muted);
    font-size: 11px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    display: block;
    margin-bottom: 0.75rem;
}
.label-sm { font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; }

/* Buttons */
.btn {
    width: 100%;
    padding: 16px;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 15px;
    font-weight: 500;
    transition: transform 0.1s, background 0.15s, color 0.15s;
}
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn-primary {
    background: var(--lime);
    color: var(--bg);
    font-family: var(--font-display);
    font-size: 22px;
    letter-spacing: 0.1em;
    border: 1px solid var(--lime);
}
.btn-primary:disabled {
    background: var(--surface);
    color: var(--dim);
    border-color: var(--border);
}
.btn-primary-sm {
    background: var(--lime);
    color: var(--bg);
    font-family: var(--font-display);
    font-size: 20px;
    letter-spacing: 0.1em;
    border: 1px solid var(--lime);
}
.btn-primary-sm:disabled {
    background: var(--surface);
    color: var(--dim);
    border-color: var(--border);
}
.btn-ghost {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}
.btn-muted {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--muted);
    padding: 12px;
    font-size: 13px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.icon-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--muted);
    width: 40px;
    height: 40px;
    border-radius: 0.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.1s;
}
.icon-btn:active { transform: scale(0.95); }

.stepper-btn {
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--lime);
    width: 56px;
    height: 56px;
    border-radius: 0.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.1s;
}
.stepper-btn:active { transform: scale(0.95); }
.stepper-btn:disabled {
    color: var(--dim);
    opacity: 0.4;
}

/* Typography */
.display-h1 {
    font-family: var(--font-display);
    font-size: 56px;
    line-height: 0.9;
    letter-spacing: -0.02em;
    color: var(--lime);
}
.display-hero {
    font-family: var(--font-display);
    font-size: 48px;
    line-height: 0.9;
    letter-spacing: -0.02em;
    white-space: nowrap;
}
.display-hero .hero-main { color: var(--lime); }
.display-hero .hero-sub  { color: var(--orange); }

/* Менші екрани — трохи зменшити шрифт, щоб точно влізло в одну строку */
@media (max-width: 380px) {
    .display-hero { font-size: 42px; }
}
.display-h2 {
    font-family: var(--font-display);
    font-size: 48px;
    line-height: 0.9;
    letter-spacing: -0.02em;
}
.display-sm {
    font-family: var(--font-display);
    font-size: 40px;
    line-height: 0.9;
    letter-spacing: -0.02em;
}
.display-num {
    font-family: var(--font-display);
    font-size: 52px;
    line-height: 1;
    letter-spacing: 0.02em;
    color: var(--lime);
}
.mono { font-family: var(--font-mono); font-weight: 700; }

/* Specific UI bits */
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.lime { color: var(--lime); }
.orange { color: var(--orange); }

.hr-vs {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0;
}
.hr-vs > span { flex: 1; height: 1px; background: var(--border); }
.hr-vs > em {
    font-style: normal;
    font-family: var(--font-display);
    font-size: 18px;
    color: var(--orange);
    letter-spacing: 0.1em;
}

.dashed-box {
    border: 1px dashed var(--border);
    border-radius: 0.75rem;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--muted);
    font-size: 13px;
}

/* History row */
.history-row {
    width: 100%;
    padding: 8px 12px;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    gap: 12px;
    background: transparent;
    text-align: left;
    color: var(--text);
}
.history-row.is-editing { background: rgba(212,255,58,0.08); }
.history-row:active { transform: scale(0.98); }

/* Leaderboard */
.lb-item {
    padding: 8px 12px;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    gap: 12px;
}
.lb-item.is-first { background: rgba(212,255,58,0.08); }

.podium-gold {
    background: linear-gradient(135deg, rgba(212,255,58,0.12), rgba(212,255,58,0.03));
    border: 1px solid var(--lime);
}

/* Modal */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.72);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-sheet {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.72);
    z-index: 50;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}
@media (min-width: 640px) {
    .modal-sheet { align-items: center; }
}
.modal-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 20px;
    width: 100%;
    max-width: 28rem;
}
.modal-sheet .modal-card {
    border-top-left-radius: 1rem;
    border-top-right-radius: 1rem;
}

/* Share url display */
.url-box {
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 12px;
    word-break: break-all;
    border-radius: 0.5rem;
    padding: 12px;
}
