/* Kirche bewegt! – Zeiterfassung
   Farbwelt der kirche-bewegt.de (Sommer-Theme) */

:root {
    --primary: #ffd534;
    --primary-dark: #dbb110;
    --primary-light: #ffeeae;
    --primary-soft: #fffae7;
    --accent: #6a0d59;
    --accent-dark: #4d0940;
    --accent-soft: #e1cfde;
    --beige: #f5ede0;
    --beige-dark: #e8dbc3;
    --cream: #fbf7f0;
    --ink: #2a1e24;
    --ink-soft: #5a4a52;
    --white: #ffffff;
    --danger: #c62828;
    --font-display: 'Archivo Black', 'Archivo', Impact, sans-serif;
    --font-body: 'Archivo', -apple-system, BlinkMacSystemFont, sans-serif;
    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 28px;
    --shadow-soft: 0 4px 20px rgba(42, 30, 36, 0.08);
    --shadow-pop: 0 10px 30px rgba(42, 30, 36, 0.16);
    --transition: 0.2s ease;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font-body);
    background: var(--cream);
    color: var(--ink);
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ------------------------------------------------ Navigation */

.nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 12px clamp(12px, 4vw, 32px);
    padding-top: calc(12px + env(safe-area-inset-top));
    background: var(--primary);
    box-shadow: var(--shadow-soft);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: var(--ink);
    line-height: 1.1;
}

.nav-wordmark {
    font-family: var(--font-display);
    font-size: 1.25rem;
    letter-spacing: 0.01em;
}

.nav-wordmark em {
    font-style: italic;
    color: var(--accent);
}

.nav-sub {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--ink-soft);
}

.nav-links {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.nav-links a {
    text-decoration: none;
    color: var(--ink);
    font-weight: 700;
    font-size: 0.9rem;
    padding: 8px 14px;
    border-radius: 999px;
    transition: background var(--transition);
}

.nav-links a:hover { background: var(--primary-light); }

.nav-links a.active {
    background: var(--accent);
    color: var(--white);
}

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

.main {
    flex: 1;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: clamp(12px, 3vw, 32px);
    padding-bottom: 48px;
}

.page-head {
    text-align: center;
    margin: 8px 0 20px;
}

.page-head h1 {
    font-family: var(--font-display);
    font-size: clamp(1.6rem, 5vw, 2.6rem);
    margin: 0 0 6px;
}

.page-head-badge {
    display: inline-block;
    vertical-align: middle;
    background: var(--accent);
    color: var(--white);
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    border-radius: 999px;
    padding: 4px 14px;
    margin-left: 8px;
}

.page-head p {
    margin: 0;
    color: var(--ink-soft);
    font-size: 1rem;
}

/* ------------------------------------------------ Timer */

.timer-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    padding: clamp(16px, 3vw, 28px);
    margin: 0 auto 20px;
    max-width: 720px;
    text-align: center;
    border-bottom: 6px solid var(--primary);
}

.timer-label {
    display: inline-block;
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--ink-soft);
    background: var(--beige);
    border-radius: 999px;
    padding: 5px 16px;
    margin-bottom: 8px;
}

.timer-label.running {
    background: var(--accent);
    color: var(--white);
}

.timer-display {
    font-family: var(--font-display);
    font-size: clamp(2.4rem, 9vw, 4.5rem);
    font-variant-numeric: tabular-nums;
    line-height: 1.05;
    color: var(--ink);
}

/* ------------------------------------------------ Buttons & Controls */

.controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
    margin-bottom: 20px;
}

.controls-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.btn {
    font-family: var(--font-body);
    font-weight: 800;
    font-size: 1rem;
    border: none;
    border-radius: 999px;
    padding: 14px 26px;
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition), filter var(--transition);
    box-shadow: var(--shadow-soft);
}

.btn:hover { filter: brightness(1.05); transform: translateY(-1px); }
.btn:active { transform: scale(0.96); }

.btn-lg { font-size: 1.2rem; padding: 18px 40px; }

.btn-primary { background: var(--primary); color: var(--ink); }
.btn-dark { background: var(--ink); color: var(--white); }
.btn-accent { background: var(--accent); color: var(--white); }
.btn-danger { background: var(--white); color: var(--danger); border: 2px solid var(--danger); }

/* ------------------------------------------------ Suche & Filter */

.filter-bar {
    background: var(--white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-soft);
    padding: 14px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

#number-search {
    font-family: var(--font-body);
    font-size: 1.2rem;
    font-weight: 600;
    text-align: center;
    padding: 12px 20px;
    border: 2px solid var(--beige-dark);
    border-radius: 999px;
    width: min(360px, 100%);
    background: var(--cream);
    color: var(--ink);
    -webkit-user-select: text;
    user-select: text;
}

#number-search:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(255, 213, 52, 0.35);
}

.filter-chips {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.chip {
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 0.9rem;
    padding: 9px 18px;
    border-radius: 999px;
    border: 2px solid var(--beige-dark);
    background: var(--white);
    color: var(--ink);
    cursor: pointer;
    transition: all var(--transition);
}

.chip:hover { border-color: var(--primary-dark); }

.chip.active {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--white);
}

/* ------------------------------------------------ Läufer-Grid */

.runner-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}

.start-number {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    aspect-ratio: 1 / 1;
    padding: 12px 8px;
    border: none;
    border-top: 8px solid var(--beige-dark);
    border-radius: var(--radius-md);
    background: var(--white);
    color: var(--ink);
    box-shadow: var(--shadow-soft);
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition);
    overflow: hidden;
    text-align: center;
    font-family: var(--font-body);
}

.start-number:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-pop);
}

.start-number:active { transform: scale(0.96); }

.start-number .number {
    font-family: var(--font-display);
    font-size: clamp(1.9rem, 5vw, 2.6rem);
    line-height: 1;
}

.start-number .name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--ink-soft);
    line-height: 1.15;
    max-width: 100%;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.start-number .category {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ink-soft);
    opacity: 0.8;
}

.start-number .elapsed-time {
    font-size: 1.05rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: var(--accent);
    min-height: 1.2em;
    line-height: 1.2;
}

/* Kategorie-Akzente */
.start-number.kat-5k { border-top-color: var(--primary); }
.start-number.kat-walk { border-top-color: var(--accent-soft); }
.start-number.kat-10k { border-top-color: var(--accent); }

/* Erledigte Läufer */
.start-number.time-set {
    background: linear-gradient(150deg, var(--accent), var(--accent-dark));
    color: var(--white);
}

.start-number.time-set .name,
.start-number.time-set .category { color: var(--accent-soft); }

.start-number.time-set .elapsed-time { color: var(--primary); }

.start-number.hidden,
.start-number.search-hidden,
.start-number.category-hidden { display: none; }

.start-number.highlight {
    animation: pulse 1s infinite;
    box-shadow: 0 0 0 4px rgba(255, 213, 52, 0.55), var(--shadow-pop);
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.04); }
    100% { transform: scale(1); }
}

/* ------------------------------------------------ Dialog */

.dialog {
    display: none;
    position: fixed;
    z-index: 1000;
    inset: 0;
    background: rgba(42, 30, 36, 0.55);
    backdrop-filter: blur(3px);
}

.dialog-content {
    background: var(--cream);
    margin: 12vh auto 0;
    padding: 24px;
    width: min(520px, calc(100% - 32px));
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-pop);
    text-align: center;
}

.dialog-content h2 {
    font-family: var(--font-display);
    font-size: 1.4rem;
    margin: 0 0 18px;
}

.dialog-button {
    display: block;
    width: 100%;
    margin: 10px 0;
    padding: clamp(18px, 4vh, 28px);
    font-family: var(--font-body);
    font-size: 1.2rem;
    font-weight: 800;
    border: none;
    border-radius: var(--radius-md);
    background: var(--primary);
    color: var(--ink);
    cursor: pointer;
    transition: transform var(--transition);
}

.dialog-button:active { transform: scale(0.98); }

.dialog-button.accent { background: var(--accent); color: var(--white); }
.dialog-button.cancel { background: var(--white); color: var(--ink-soft); border: 2px solid var(--beige-dark); }
.dialog-button.danger { background: var(--white); color: var(--danger); border: 2px solid var(--danger); }

/* ------------------------------------------------ Rangliste */

.rang-card {
    background: var(--white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-soft);
    padding: 18px;
    margin: 0 auto 18px;
    max-width: 860px;
    overflow-x: auto;
}

.rang-card h2 {
    font-family: var(--font-display);
    font-size: 1.2rem;
    margin: 0 0 12px;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    background: var(--beige);
}

.rang-card.kat-5k h2 { background: var(--primary-light); }
.rang-card.kat-walk h2 { background: var(--accent-soft); }
.rang-card.kat-10k h2 { background: var(--accent); color: var(--white); }

.rang-card table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.98rem;
}

.rang-card th {
    text-align: left;
    padding: 8px 10px;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ink-soft);
    border-bottom: 2px solid var(--beige-dark);
}

.rang-card td {
    padding: 9px 10px;
    border-bottom: 1px solid var(--beige);
}

.rang-card .t-right { text-align: right; }

.rang-card .zeit {
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: var(--accent);
}

.rang-card .platz { font-size: 1.05rem; }

tr.platz-1 { background: var(--primary-soft); font-weight: 700; }

.rang-stats {
    margin: 12px 0 0;
    font-size: 0.88rem;
    color: var(--ink-soft);
}

.rang-empty {
    text-align: center;
    color: var(--ink-soft);
    padding: 40px 18px;
}

/* ------------------------------------------------ Starterverwaltung */

/* Formular-Card exakt so breit wie die Liste darunter */
.filter-bar-narrow {
    max-width: 860px;
    margin-left: auto;
    margin-right: auto;
    padding: 18px;
    gap: 14px;
}

.starter-form {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
}

.starter-form input,
.starter-form select {
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 600;
    padding: 11px 14px;
    border: 2px solid var(--beige-dark);
    border-radius: var(--radius-sm);
    background: var(--cream);
    color: var(--ink);
    -webkit-user-select: text;
    user-select: text;
}

.starter-form select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235a4a52' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 14px;
    padding-right: 36px;
    cursor: pointer;
}

.starter-form input:focus,
.starter-form select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(255, 213, 52, 0.35);
}

#f-num { width: 90px; }
#f-name { flex: 1; min-width: 180px; }

.starter-hint {
    margin: 0;
    font-size: 0.85rem;
    color: var(--ink-soft);
    text-align: center;
}

.starter-tools {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    width: 100%;
}

#starter-search {
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 600;
    padding: 11px 16px;
    border: 2px solid var(--beige-dark);
    border-radius: 999px;
    background: var(--cream);
    color: var(--ink);
    flex: 1;
    min-width: 160px;
    max-width: 300px;
    -webkit-user-select: text;
    user-select: text;
}

.btn-file { display: inline-block; text-align: center; }

.chip-delete {
    border-color: var(--danger);
    color: var(--danger);
    font-size: 0.78rem;
    padding: 6px 12px;
}

#starter-table tbody tr { cursor: pointer; }
#starter-table tbody tr:hover { background: var(--primary-soft); }

/* ------------------------------------------------ Footer */

.footer {
    text-align: center;
    padding: 18px;
    padding-bottom: calc(18px + env(safe-area-inset-bottom));
    font-size: 0.82rem;
    color: var(--ink-soft);
}

.footer a { color: var(--accent); font-weight: 700; text-decoration: none; }

/* ------------------------------------------------ Mobile */

@media (max-width: 700px) {
    .nav { padding-left: 12px; padding-right: 12px; }
    .nav-links a { font-size: 0.82rem; padding: 7px 10px; }
    .runner-grid { grid-template-columns: repeat(2, 1fr); gap: 9px; }
    .btn-lg { flex: 1; }
    .controls-row { width: 100%; }
    .page-erfassung .runner-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1100px) {
    .runner-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
}
