@font-face {
    font-family: 'AppFont';
    src: url('/fonts/inter.ttf') format('truetype');
    font-weight: 100 900;
    font-style: normal;
    font-display: block;
}

@font-face {
    font-family: 'AppFont';
    src: url('/fonts/inter-italic.ttf') format('truetype');
    font-weight: 100 900;
    font-style: italic;
    font-display: block;
}

:root {
    --primary: #ff473d;
    --primary-dark: #d93028;
    --primary-light: #ff6b63;
    --primary-bg: #fff5f5;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'AppFont', sans-serif;
    background: #f0f2f5;
    color: #1a1a1a;
    min-height: 100vh;
}

/* ── Header ── */
header {
    background: var(--primary);
    padding: 0 32px;
    padding-top: env(safe-area-inset-top);
    height: calc(64px + env(safe-area-inset-top));
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.25);
    position: sticky;
    top: 0;
    z-index: 100;
}

header img {
    height: 40px;
    object-fit: contain;
}

header h1 {
    color: white;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.2px;
}

/* ── Screens ── */
.screen { display: none; }
.screen.active { display: block; }

.container {
    max-width: 720px;
    margin: 0 auto;
    padding: 40px 20px 80px;
}

/* ── Start Screen ── */
.start-hero {
    background: white;
    border-radius: 16px;
    padding: 56px 48px;
    text-align: center;
    box-shadow: 0 4px 24px rgba(0,0,0,0.08);
}

.start-hero .badge {
    display: inline-block;
    background: var(--primary-bg);
    color: var(--primary);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    padding: 6px 14px;
    border-radius: 20px;
    margin-bottom: 20px;
}

.start-hero h2 {
    font-size: 2rem;
    font-weight: 800;
    color: #111;
    line-height: 1.2;
    margin-bottom: 16px;
}

.start-hero p {
    color: #666;
    line-height: 1.7;
    font-size: 1.05rem;
    max-width: 500px;
    margin: 0 auto 32px;
}

.start-meta {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin-bottom: 40px;
}

.start-meta-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.start-meta-item .num {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--primary);
}

.start-meta-item .label {
    font-size: 0.8rem;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-start {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 16px 48px;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.18s, transform 0.18s, box-shadow 0.18s;
    box-shadow: 0 4px 16px rgba(255,71,61,0.35);
}

.btn-start:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255,71,61,0.4);
}

.btn-start:active { transform: translateY(0); }

/* ── Progress Bar ── */
.progress-wrap {
    background: #dde0e5;
    border-radius: 6px;
    height: 6px;
    margin-bottom: 28px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 6px;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Question Card ── */
.question-card {
    background: white;
    border-radius: 16px;
    padding: 36px 40px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.08);
    margin-bottom: 20px;
    position: relative;
    overflow: visible;
}

/* ── Swipe Labels ── */
.swipe-label {
    position: absolute;
    inset: 0;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 5rem;
    font-weight: 900;
    opacity: 0;
    pointer-events: none;
    border: 4px solid;
}

.swipe-agree {
    background: rgba(34, 139, 46, 0.12);
    color: #228b2e;
    border-color: #228b2e;
}

.swipe-reject {
    background: rgba(255, 71, 61, 0.12);
    color: var(--primary);
    border-color: var(--primary);
}

/* ── Swipe Hint ── */
.swipe-hint {
    display: none;
    text-align: center;
    font-size: 0.8rem;
    color: #bbb;
    margin-top: 10px;
    margin-bottom: 4px;
    transition: opacity 0.4s ease;
}

@keyframes card-wiggle {
    0%   { transform: translateX(0)     rotate(0);     }
    20%  { transform: translateX(-32px) rotate(-3deg); }
    45%  { transform: translateX(0)     rotate(0);     }
    70%  { transform: translateX(32px)  rotate(3deg);  }
    90%  { transform: translateX(0)     rotate(0);     }
    100% { transform: translateX(0)     rotate(0);     }
}

.card-wiggle { animation: card-wiggle 1s ease-in-out; }

/* ── Mobile Buttons ── */
.mobile-secondary {
    display: none;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 12px;
}

.mobile-secondary .ans-btn {
    flex: 1 1 calc(50% - 6px);
}

.mobile-nav { display: none; }

/* ── Weight Screen ── */
.weight-header-card {
    background: white;
    border-radius: 16px;
    padding: 36px 40px;
    text-align: center;
    box-shadow: 0 4px 24px rgba(0,0,0,0.08);
    margin-bottom: 20px;
}

.weight-header-card h2 {
    font-size: 1.7rem;
    font-weight: 800;
    color: #111;
    margin-bottom: 12px;
}

.weight-header-card p {
    color: #666;
    font-size: 1rem;
    line-height: 1.6;
    max-width: 480px;
    margin: 0 auto;
}

.weight-item {
    background: white;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    display: flex;
    align-items: center;
    gap: 14px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.15s, background 0.15s;
    user-select: none;
}

.weight-item:hover { background: #fafafa; }

.weight-item.selected {
    border-color: var(--primary);
    background: #fff5f5;
}

.weight-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--primary);
    flex-shrink: 0;
    cursor: pointer;
}

.weight-item-content { flex: 1; }

.weight-item-num {
    font-size: 0.75rem;
    font-weight: 700;
    color: #bbb;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.weight-item-text {
    font-size: 0.95rem;
    font-weight: 600;
    color: #222;
    line-height: 1.4;
}

.weight-actions-top {
    text-align: center;
    margin-bottom: 20px;
}

.q-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.q-counter {
    font-size: 0.82rem;
    font-weight: 700;
    color: #bbb;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.q-text {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.45;
    color: #111;
    margin-bottom: 28px;
}

/* ── Answer Buttons ── */
.answer-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.ans-btn {
    padding: 18px 12px;
    border-radius: 10px;
    border: 2px solid transparent;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 700;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    letter-spacing: 0.1px;
}

.ans-btn .icon { font-size: 1.1rem; }

/* Agree */
.ans-btn.agree {
    background: #f0faf1;
    color: #1e6e28;
    border-color: #b7deba;
}
.ans-btn.agree:hover { background: #d8f3da; border-color: #5cb86a; }
.ans-btn.agree.selected { background: #228b2e; color: white; border-color: #228b2e; }

/* Neutral */
.ans-btn.neutral {
    background: #fff8ec;
    color: #9a5a00;
    border-color: #f5d48a;
}
.ans-btn.neutral:hover { background: #fde9b7; border-color: #e6a817; }
.ans-btn.neutral.selected { background: #d4880a; color: white; border-color: #d4880a; }

/* Reject */
.ans-btn.reject {
    background: #fff0ee;
    color: #b32018;
    border-color: #f4b0ab;
}
.ans-btn.reject:hover { background: #fdd5d3; border-color: #e05a50; }
.ans-btn.reject.selected { background: var(--primary); color: white; border-color: var(--primary); }

/* Skip */
.ans-btn.skip {
    background: #f5f6f8;
    color: #777;
    border-color: #dde0e5;
}
.ans-btn.skip:hover { background: #eaecef; border-color: #bbb; }
.ans-btn.skip.selected { background: #888; color: white; border-color: #888; }

/* ── Keyboard Hints ── */
.kbd-hints {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 20px;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid #f0f2f5;
}

.kbd-hint {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.78rem;
    color: #aaa;
}

kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 5px;
    border-radius: 4px;
    border: 1px solid #dde0e5;
    background: #f5f6f8;
    color: #666;
    font-size: 0.72rem;
    font-family: inherit;
    font-weight: 700;
    box-shadow: 0 1px 0 #ccc;
}

/* ── Nav Buttons ── */
.nav-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.btn-nav {
    padding: 12px 28px;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
    border: 2px solid;
}

.btn-nav.back {
    background: white;
    color: var(--primary);
    border-color: var(--primary);
}
.btn-nav.back:hover { background: var(--primary-bg); }

.btn-nav.forward {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 3px 12px rgba(255,71,61,0.3);
}
.btn-nav.forward:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    box-shadow: 0 4px 16px rgba(255,71,61,0.4);
}

/* ── Hint ── */
.hint {
    display: none;
    background: #fff0ee;
    border: 1px solid #f4b0ab;
    color: #b32018;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 10px 16px;
    border-radius: 8px;
    text-align: center;
    margin-bottom: 12px;
    animation: fadeIn 0.2s ease;
}
.hint.visible { display: block; }

/* ── Results ── */
.results-header {
    text-align: center;
    margin-bottom: 36px;
}

.results-header h2 {
    font-size: 1.9rem;
    font-weight: 800;
    color: #111;
    margin-bottom: 8px;
}

.results-header p { color: #777; font-size: 1rem; }

.group-card {
    background: white;
    border-radius: 14px;
    padding: 22px 28px;
    margin-bottom: 14px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.07);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.15s;
}

.group-card:hover { transform: translateY(-2px); }

.group-card.rank-1 {
    border: 2px solid var(--primary);
    box-shadow: 0 4px 20px rgba(255,71,61,0.15);
}

.rank-badge {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 800;
    flex-shrink: 0;
    background: #f0f2f5;
    color: #aaa;
}

.rank-badge.gold { background: #fff3cc; color: #b8860b; }
.rank-badge.silver { background: #f0f0f0; color: #707070; }
.rank-badge.bronze { background: #fce8d8; color: #9a5020; }

.group-info { flex: 1; min-width: 0; }

.group-name {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 10px;
    color: #111;
}

.bar-wrap {
    background: #eef0f3;
    border-radius: 6px;
    height: 10px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    border-radius: 6px;
    background: var(--primary);
    width: 0%;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.group-card.rank-1 .bar-fill { background: var(--primary); }

.pct {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--primary);
    min-width: 56px;
    text-align: right;
    flex-shrink: 0;
}

.no-answers-msg {
    text-align: center;
    color: #999;
    padding: 24px;
    font-size: 1rem;
}

/* ── Restart & Result-Links ── */
.result-actions {
    text-align: center;
    margin-top: 36px;
}

.result-link-row {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.btn-link-info,
.btn-link-vote {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 13px 28px;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.15s;
    cursor: pointer;
}

.btn-link-info {
    background: white;
    color: #555;
    border: 2px solid #dde0e5;
}
.btn-link-info:hover { background: #f5f6f8; border-color: #bbb; }

.btn-link-vote {
    background: var(--primary);
    color: white;
    border: 2px solid var(--primary);
    box-shadow: 0 3px 12px rgba(255,71,61,0.3);
}
.btn-link-vote:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    box-shadow: 0 4px 16px rgba(255,71,61,0.4);
}

.btn-vote-top {
    display: flex;
    justify-content: center;
    width: 100%;
    padding: 18px;
    font-size: 1.05rem;
    border-radius: 12px;
    margin-bottom: 24px;
    box-shadow: 0 4px 20px rgba(255,71,61,0.35);
    animation: pulse-vote 2s ease-in-out infinite;
}

@keyframes pulse-vote {
    0%, 100% { box-shadow: 0 4px 20px rgba(255,71,61,0.35); }
    50%       { box-shadow: 0 6px 28px rgba(255,71,61,0.55); }
}

.btn-restart {
    background: white;
    color: var(--primary);
    border: 2px solid var(--primary);
    border-radius: 10px;
    padding: 13px 36px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
}
.btn-restart:hover { background: var(--primary-bg); }

/* ── Detail Section ── */
.detail-heading {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 1.1rem;
    font-weight: 700;
    color: #111;
    margin: 40px 0 14px;
}

.detail-heading-sub {
    font-size: 0.8rem;
    font-weight: 600;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-item {
    background: white;
    border-radius: 12px;
    margin-bottom: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    overflow: hidden;
}

.detail-item summary {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    cursor: pointer;
    list-style: none;
    user-select: none;
}

.detail-item summary::-webkit-details-marker { display: none; }
.detail-item[open] > summary { border-bottom: 1px solid #eee; }

.detail-q-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #f0f2f5;
    color: #888;
    font-size: 0.8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.detail-q-text {
    flex: 1;
    font-size: 0.92rem;
    font-weight: 600;
    color: #222;
    line-height: 1.35;
}

.detail-chip {
    font-size: 0.78rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    white-space: nowrap;
    flex-shrink: 0;
}

.detail-chip.agree   { background: #f0faf1; color: #1e6e28; }
.detail-chip.neutral { background: #fff8ec; color: #9a5a00; }
.detail-chip.reject  { background: #fff0ee; color: #b32018; }
.detail-chip.skip      { background: #f5f6f8; color: #777; }
.detail-chip.no-answer { background: #f5f6f8; color: #bbb; font-style: italic; }

.detail-chip.my-answer.agree   { background: #228b2e;        color: white; }
.detail-chip.my-answer.neutral { background: #d4880a;        color: white; }
.detail-chip.my-answer.reject  { background: var(--primary); color: white; }
.detail-chip.my-answer.skip    { background: #888;           color: white; }

.detail-chevron {
    color: #bbb;
    font-size: 0.9rem;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.detail-item[open] .detail-chevron { transform: rotate(180deg); }

.detail-body {
    padding: 12px 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.detail-group-row {
    padding: 12px 14px;
    border-radius: 8px;
    background: #fafafa;
    border: 1px solid #eee;
}

.detail-group-row.match {
    background: #f5fdf6;
    border-color: #b7deba;
}

.detail-group-top {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.detail-group-name {
    font-size: 0.88rem;
    font-weight: 700;
    color: #333;
    flex: 1;
}

.detail-match-badge {
    font-size: 0.7rem;
    font-weight: 700;
    background: #228b2e;
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    letter-spacing: 0.3px;
}

.detail-position-text {
    font-size: 0.85rem;
    color: #666;
    line-height: 1.5;
}

/* ── Gleichstand-Gruppe ── */
.tie-group {
    border: 2px solid #dde0e5;
    border-radius: 18px;
    padding: 4px 8px 8px;
    margin-bottom: 14px;
    background: #f8f9fb;
}

.tie-group-first {
    border-color: var(--primary);
    background: #fff8f8;
}

.tie-label {
    text-align: center;
    font-size: 0.72rem;
    font-weight: 700;
    color: #bbb;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 6px 0 4px;
}

.tie-group-first .tie-label { color: var(--primary-light); }

.tie-group .group-card {
    margin-bottom: 8px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.06);
}

.tie-group .group-card:last-child { margin-bottom: 0; }

/* ── Debug Analytics ── */
.debug-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.debug-pill {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    white-space: nowrap;
}

.debug-pill.match     { background: #f0faf1; color: #1e6e28; }
.debug-pill.partial   { background: #fff8ec; color: #9a5a00; }
.debug-pill.mismatch  { background: #fff0ee; color: #b32018; }
.debug-pill.no-answer { background: #f5f6f8; color: #888;    }

/* ── Shake animation ── */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-5px); }
    80% { transform: translateX(5px); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.shake { animation: shake 0.35s ease; }

/* ── Responsive ── */
@media (max-width: 540px) {
    header { padding: 0 16px; }
    header h1 { font-size: 1rem; }
    .start-hero { padding: 36px 24px; }
    .start-hero h2 { font-size: 1.5rem; }
    .question-card { padding: 24px 20px; }
    .q-text { font-size: 1.1rem; }
    .answer-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .ans-btn { padding: 14px 8px; font-size: 0.85rem; }
    .group-card { padding: 16px 18px; gap: 12px; }
    .pct { font-size: 1.1rem; }
    .detail-item summary { padding: 14px 14px; gap: 8px; }
    .detail-q-text { font-size: 0.85rem; }
    .detail-chip { font-size: 0.72rem; padding: 3px 8px; }
    .weight-header-card { padding: 28px 20px; }
}

/* ── Touch-Geräte: Swipe-UI ── */
@media (hover: none) and (pointer: coarse) {
    .answer-grid  { display: none; }
    .nav-row      { display: none; }
    .kbd-hints    { display: none; }
    .swipe-hint   { display: block; }
    .mobile-secondary { display: flex; }
    .mobile-nav   { display: block; margin-top: 8px; }
    .question-card { touch-action: pan-y; cursor: grab; }
}

/* ── Footer: Impressum & Datenschutz ── */
.site-footer {
    text-align: center;
    padding: 24px 16px 32px;
    font-size: 0.85rem;
    color: #888;
}
.site-footer a {
    color: #888;
    text-decoration: none;
}
.site-footer a:hover {
    color: var(--primary);
    text-decoration: underline;
}
.footer-sep { margin: 0 8px; }
