/* Grundlayout – modernes, schlichtes UI */
:root {
    --ff-bg: #050816;
    --ff-bg-card: rgba(15, 23, 42, 0.95);
    --ff-accent: #22c55e;
    --ff-accent-soft: rgba(34, 197, 94, 0.15);
    --ff-text: #e5e7eb;
    --ff-text-muted: #9ca3af;
    --ff-danger: #f97373;
    --ff-border: rgba(148, 163, 184, 0.35);
    --ff-radius-lg: 18px;
    --ff-radius-md: 12px;
    --ff-radius-pill: 999px;
    --ff-shadow-soft: 0 24px 40px rgba(15, 23, 42, 0.6);
    --ff-transition-fast: 0.18s ease-out;
}

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

body.ff-body {
    margin: 0;
    min-height: 100vh;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
    color: var(--ff-text);
    background:
        radial-gradient(circle at 0% 0%, rgba(56, 189, 248, 0.18), transparent 55%),
        radial-gradient(circle at 100% 100%, rgba(16, 185, 129, 0.2), transparent 55%),
        radial-gradient(circle at 0% 100%, rgba(239, 68, 68, 0.2), transparent 55%),
        var(--ff-bg);
}

.ff-page {
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: stretch;
    justify-content: center;
    padding: 24px 16px;
}

.ff-page--centered {
    align-items: center;
}

.ff-card {
    width: 100%;
    max-width: 420px;
    padding: 28px 24px 24px;
    background: var(--ff-bg-card);
    border-radius: var(--ff-radius-lg);
    border: 1px solid rgba(148, 163, 184, 0.35);
    box-shadow: var(--ff-shadow-soft);
    backdrop-filter: blur(24px);
}

.ff-card--welcome {
    text-align: center;
}

.ff-welcome-logo {
    width: min(82%, 300px);
    height: auto;
    display: block;
    margin: 0 auto 8px;
    object-fit: contain;
}

.ff-title {
    margin: 0;
    font-size: 2.1rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.ff-subtitle {
    margin: 8px 0 24px;
    font-size: 0.98rem;
    color: var(--ff-text-muted);
}

.ff-button-row {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.ff-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    border-radius: var(--ff-radius-pill);
    font-weight: 600;
    font-size: 0.95rem;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    background: rgba(15, 23, 42, 0.85);
    transition: background var(--ff-transition-fast),
                border-color var(--ff-transition-fast),
                transform var(--ff-transition-fast),
                box-shadow var(--ff-transition-fast);
}

.ff-btn--primary {
    background: radial-gradient(circle at 0 0, #4ade80, #16a34a);
    border-color: rgba(34, 197, 94, 0.8);
    box-shadow: 0 14px 28px rgba(22, 163, 74, 0.45);
}

.ff-btn--outline {
    background: transparent;
    border-color: rgba(148, 163, 184, 0.5);
}

.ff-btn--danger {
    background: radial-gradient(circle at 0 0, #fb7185, #ef4444);
    border-color: rgba(248, 113, 113, 0.85);
    box-shadow: 0 14px 28px rgba(248, 113, 113, 0.45);
}

.ff-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 18px 32px rgba(15, 23, 42, 0.8);
}

.ff-btn:active {
    transform: translateY(0);
    box-shadow: 0 10px 18px rgba(15, 23, 42, 0.7);
}

.ff-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 12px;
}

.ff-field-label {
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--ff-text-muted);
}

.ff-input {
    width: 100%;
    padding: 9px 11px;
    border-radius: 10px;
    border: 1px solid var(--ff-border);
    background: rgba(15, 23, 42, 0.85);
    color: var(--ff-text);
    font-size: 0.96rem;
    outline: none;
    transition: border-color var(--ff-transition-fast),
                box-shadow var(--ff-transition-fast),
                background var(--ff-transition-fast);
}

.ff-input:focus {
    border-color: var(--ff-accent);
    box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.6);
    background: rgba(15, 23, 42, 0.98);
}

.ff-input-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ff-input-addon {
    padding: 9px 11px;
    border-radius: 10px;
    border: 1px solid var(--ff-border);
    background: rgba(15, 23, 42, 0.9);
    font-size: 0.9rem;
    color: var(--ff-text-muted);
    white-space: nowrap;
}

.ff-helper {
    font-size: 0.8rem;
    color: var(--ff-text-muted);
}

.ff-message {
    margin-top: 10px;
    padding: 9px 11px;
    border-radius: var(--ff-radius-md);
    font-size: 0.86rem;
    border: 1px solid rgba(148, 163, 184, 0.5);
}

.ff-message--error {
    border-color: rgba(248, 113, 113, 0.7);
    background: rgba(239, 68, 68, 0.1);
}

.ff-message--success {
    border-color: rgba(34, 197, 94, 0.7);
    background: rgba(34, 197, 94, 0.12);
}

/* Hauptbildschirm */
.ff-layout-main {
    width: 100%;
    max-width: 540px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.ff-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Desktop: gesamte Topbar so breit wie die Karte (420px), dann schließen Buttons bündig ab */
@media (min-width: 640px) {
    .ff-topbar {
        max-width: 420px;
    }
}

.ff-topbar-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    position: relative;
}

.ff-topbar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ff-topbar-logo-img {
    /*height: 38px;*/
    height: 100px;
    width: auto;
    display: block;
    object-fit: contain;
}

.ff-logo-small {
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    font-size: 0.9rem;
}

.ff-user-label {
    font-size: 0.82rem;
    color: var(--ff-text-muted);
}

.ff-menu-button {
    width: 38px;
    height: 38px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.7);
    background: rgba(15, 23, 42, 0.9);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background var(--ff-transition-fast),
                transform var(--ff-transition-fast),
                box-shadow var(--ff-transition-fast);
}

.ff-menu-button:hover {
    background: rgba(15, 23, 42, 1);
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.8);
}

.ff-menu-icon {
    width: 18px;
    height: 14px;
    position: relative;
}

.ff-menu-icon span {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    border-radius: 999px;
    background: var(--ff-text);
    transition: transform var(--ff-transition-fast),
                opacity var(--ff-transition-fast),
                top var(--ff-transition-fast),
                bottom var(--ff-transition-fast);
}

.ff-menu-icon span:nth-child(1) {
    top: 0;
}
.ff-menu-icon span:nth-child(2) {
    top: 6px;
}
.ff-menu-icon span:nth-child(3) {
    bottom: 0;
}

.ff-menu-open .ff-menu-icon span:nth-child(1) {
    top: 6px;
    transform: rotate(45deg);
}

.ff-menu-open .ff-menu-icon span:nth-child(2) {
    opacity: 0;
}

.ff-menu-open .ff-menu-icon span:nth-child(3) {
    bottom: 6px;
    transform: rotate(-45deg);
}

.ff-menu-panel {
    position: absolute;
    top: 64px;
    right: 16px;
    width: 220px;
    background: rgba(15, 23, 42, 0.98);
    border-radius: var(--ff-radius-lg);
    border: 1px solid var(--ff-border);
    box-shadow: var(--ff-shadow-soft);
    padding: 10px;
    z-index: 40;
}

.ff-menu-item {
    width: 100%;
    padding: 9px 10px;
    border-radius: 10px;
    border: none;
    background: transparent;
    color: var(--ff-text);
    text-align: left;
    font-size: 0.92rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background var(--ff-transition-fast),
                color var(--ff-transition-fast);
}

.ff-menu-item span {
    font-size: 0.78rem;
    color: var(--ff-text-muted);
}

.ff-menu-item:hover {
    background: rgba(15, 23, 42, 0.9);
}

/* Modal für CONNECT / CREATE GROUP */
.ff-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 50;
}

.ff-modal {
    width: 100%;
    max-width: 400px;
    background: var(--ff-bg-card);
    border-radius: var(--ff-radius-lg);
    border: 1px solid var(--ff-border);
    padding: 20px 18px 16px;
    box-shadow: var(--ff-shadow-soft);
}

.ff-modal-title {
    margin: 0 0 8px;
    font-size: 1.05rem;
}

.ff-modal-text {
    margin: 0 0 12px;
    font-size: 0.9rem;
    color: var(--ff-text-muted);
}

.ff-modal-text--warning {
    color: var(--ff-danger);
    font-weight: 600;
    margin-bottom: 4px;
}

.ff-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 6px;
}

.ff-card--weight {
    margin-top: 6px;
}

.ff-weight-title {
    margin: 0 0 6px;
    font-size: 1.05rem;
}

.ff-weight-history {
    margin-top: 10px;
    font-size: 0.86rem;
    color: var(--ff-text-muted);
}

.ff-weight-history ul {
    list-style: none;
    padding-left: 0;
    margin: 4px 0 0;
}

.ff-weight-history li {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    border-bottom: 1px dashed rgba(55, 65, 81, 0.6);
}

/* Runder Icon-Button (Logout / Chart) */
.ff-icon-button {
    width: 38px;
    height: 38px;
    border-radius: 999px;
    border: 2px solid rgba(148, 163, 184, 0.7);
    background: rgba(15, 23, 42, 0.9);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    text-decoration: none;
    color: var(--ff-text);
    transition: background var(--ff-transition-fast),
                transform var(--ff-transition-fast),
                box-shadow var(--ff-transition-fast),
                border-color var(--ff-transition-fast);
}

.ff-icon-button svg {
    width: 18px;
    height: 18px;
    display: block;
}

.ff-icon-button:hover {
    background: rgba(15, 23, 42, 1);
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.8);
}

.ff-icon-button:active {
    transform: translateY(0);
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.7);
}

.ff-icon-button--logout {
    border-color: rgba(34, 197, 94, 0.95);
}

.ff-icon-button--chart {
    border-color: rgba(34, 197, 94, 0.95);
}

/* Wenn Logout-Link sowohl ff-btn als auch ff-icon-button hat,
   auf exakt runde Größe wie der Menübutton zwingen */
.ff-icon-button.ff-btn {
    width: 38px;
    height: 38px;
    min-width: 38px;
    padding: 0;
    border-radius: 999px;
    box-sizing: border-box;
}

/* Chart-Icon optisch näher am Menubutton, mit klar erkennbarem Rand */
.ff-icon-button--chart {
    border-width: 2px;
    border-color: rgba(34, 197, 94, 0.95);
    background: rgba(15, 23, 42, 0.85);
    color: rgba(134, 239, 172, 0.95);
}

.ff-icon-button--linechart {
    border-width: 2px;
    border-color: rgba(34, 197, 94, 0.95);
    background: rgba(15, 23, 42, 0.85);
    color: rgba(134, 239, 172, 0.95);
}

/* Aktiver Seiten-Button: Inhalt blau, Rand bleibt grün */
.ff-icon-button--active {
    color: rgba(59, 130, 246, 0.95);
}

/* Klickbares Logo für Navigation */
.ff-logo-small--clickable {
    cursor: pointer;
}

.ff-topbar-logo.ff-logo-small--clickable:hover {
    opacity: 0.9;
}

.ff-topbar-logo.ff-logo-small--clickable:hover .ff-logo-small {
    text-decoration: underline;
}

/* Chart-Karte und Canvas */
.ff-card--chart {
    margin-top: 6px;
}

.ff-chart-wrapper {
    margin-top: 10px;
    position: relative;
    width: 100%;
    height: 260px;
}

@media (min-width: 640px) {
    .ff-chart-wrapper {
        height: 320px;
    }
}

@media (min-width: 640px) {
    .ff-card {
        padding: 32px 28px 26px;
    }
}

/* Legende unter dem Diagramm (Usernamen in Linienfarben) */
.ff-chart-legend {
    margin-top: 8px;
    text-align: center;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px 20px;
}

.ff-chart-legend-name,
.ff-chart-legend-item {
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.ff-chart-legend-name {
    color: #3b82f6;
}

/* Create Group Optionen */
.ff-plan-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.ff-plan-option {
    border: 1px solid var(--ff-border);
    border-radius: 10px;
    padding: 10px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    background: rgba(15, 23, 42, 0.65);
}

.ff-plan-option small {
    color: var(--ff-text-muted);
}

/* Race View */
.ff-race-track {
    position: relative;
    margin-top: 12px;
    padding-right: 8px;
}

.ff-race-finish-line {
    position: absolute;
    top: 0;
    bottom: 0;
    right: 0;
    width: 2px;
    background: repeating-linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0.85) 0,
        rgba(255, 255, 255, 0.85) 6px,
        rgba(15, 23, 42, 0.95) 6px,
        rgba(15, 23, 42, 0.95) 12px
    );
}

.ff-race-time-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background: rgba(226, 232, 240, 0.9);
    z-index: 2;
    pointer-events: none;
}

.ff-race-row {
    margin-bottom: 14px;
}

.ff-race-name {
    font-weight: 700;
    margin-bottom: 4px;
}

.ff-race-bar-bg {
    width: 100%;
    height: 16px;
    border-radius: 999px;
    background: rgba(30, 41, 59, 0.9);
    border: 1px solid rgba(71, 85, 105, 0.6);
    overflow: hidden;
}

.ff-race-bar-fill {
    height: 100%;
    min-width: 1%;
    border-radius: 999px;
    transition: width 0.35s ease-out;
}


.ff-name-title {
    margin: 0;
    line-height: 1.05;
}

.ff-vs-title {
    margin: 2px 0 4px;
    font-size: 0.9rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--ff-text-muted);
    font-weight: 700;
    line-height: 1;
    text-align: center;
}

.ff-icon-button--chart svg {
    width: 22px;
    height: 22px;
}

.ff-icon-button--linechart svg {
    width: 22px;
    height: 22px;
}
