/* BremerSkyjo — main.css */

:root {
    --bg:        #0f1117;
    --bg2:       #1a1d27;
    --bg3:       #22263a;
    --border:    #2e3348;
    --text:      #e8eaf0;
    --text2:     #9099b0;
    --accent:    #4f7cff;
    --accent2:   #3a5ecc;
    --success:   #3dd68c;
    --danger:    #ff5c5c;
    --warning:   #ffb84d;

    /* Kartenfarben */
    --card-blue:   #3b7dd8;
    --card-green:  #3dd68c;
    --card-yellow: #f5d547;
    --card-orange: #ff8c42;
    --card-red:    #ff4d4d;
    --card-hidden: #2e3348;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    font-size: 16px;
    line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Topbar ───────────────────────────────────────────────── */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}
.topbar-logo { font-size: 18px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar-profile { color: var(--text); font-size: 14px; }
.back-link { color: var(--text2); font-size: 14px; }

/* ── Buttons ──────────────────────────────────────────────── */
.btn-primary {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 10px 20px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.btn-primary:hover { background: var(--accent2); }

.btn-secondary {
    background: var(--bg3);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 20px;
    font-size: 15px;
    cursor: pointer;
    transition: background 0.15s;
}
.btn-secondary:hover { background: var(--border); }

.btn-text {
    background: none;
    border: none;
    color: var(--text2);
    cursor: pointer;
    font-size: 14px;
    padding: 4px 8px;
}
.btn-text:hover { color: var(--text); }

.btn-full { width: 100%; margin-top: 20px; }
.btn-small { padding: 6px 14px; font-size: 13px; }

/* ── Landing Page ─────────────────────────────────────────── */
.landing {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background-color: var(--bg);
    background-image: radial-gradient(ellipse at 50% 0%, rgba(79,124,255,0.15) 0%, transparent 70%);
}

.landing-container {
    width: 100%;
    max-width: 700px;
    padding: 48px 24px;
    text-align: center;
}

.landing-header h1 {
    font-size: 48px;
    font-weight: 800;
    margin-bottom: 8px;
    color: var(--text);
    letter-spacing: -0.5px;
}
.landing-header .subtitle {
    color: var(--text2);
    font-size: 17px;
    margin-bottom: 48px;
    letter-spacing: 0.02em;
}

.profile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 16px;
}

.profile-card {
    background: var(--bg2);
    border: 2px solid var(--border);
    border-radius: 22px;
    padding: 32px 16px 22px;
    width: 100%;
    color: var(--text);
    cursor: pointer;
    transition: transform 0.18s, border-color 0.18s, box-shadow 0.18s, background 0.18s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    position: relative;
}
.profile-card:hover {
    transform: translateY(-6px);
    border-color: var(--accent);
    background: var(--bg3);
    box-shadow: 0 12px 32px rgba(79,124,255,0.25);
}
.profile-card:active {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(79,124,255,0.15);
}

/* Erwachsenen-Profil: Schloss-Badge oben rechts deutlicher */
.profile-adult {
    border-color: rgba(79,124,255,0.35);
}
.profile-adult:hover {
    border-color: var(--accent);
}

.profile-emoji {
    font-size: 56px;
    line-height: 1;
    filter: drop-shadow(0 3px 8px rgba(0,0,0,0.5));
}
.profile-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}
.profile-lock {
    position: absolute;
    top: 12px;
    right: 12px;
    font-size: 14px;
    opacity: 0.7;
    background: rgba(79,124,255,0.15);
    border-radius: 6px;
    padding: 2px 4px;
    line-height: 1;
}

/* ── Modal ────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    animation: fadeIn 0.15s ease-out;
}
.modal-overlay[hidden] { display: none; }

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.modal {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 36px 32px;
    width: 100%;
    max-width: 360px;
    text-align: center;
    box-shadow: 0 24px 60px rgba(0,0,0,0.5);
    animation: modalSlideIn 0.18s ease-out;
}

@keyframes modalSlideIn {
    from { transform: translateY(12px) scale(0.97); opacity: 0; }
    to   { transform: translateY(0)    scale(1);    opacity: 1; }
}

.modal h2 { margin-bottom: 24px; font-size: 22px; }

.pin-input-row { margin-bottom: 16px; }
.pin-input-row input {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-size: 28px;
    letter-spacing: 8px;
    padding: 12px 20px;
    text-align: center;
    width: 100%;
    outline: none;
}
.pin-input-row input:focus { border-color: var(--accent); }

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}
.modal-actions button { flex: 1; }

.error-msg { color: var(--danger); font-size: 14px; margin-bottom: 8px; }

/* ── Seiten-Container ─────────────────────────────────────── */
.page-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 24px 20px;
}

/* ── Cards ────────────────────────────────────────────────── */
.card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 20px;
}
.card h3 { font-size: 16px; margin-bottom: 16px; color: var(--text2); }

/* ── Profil Seite ─────────────────────────────────────────── */
.profile-page { max-width: 560px; margin: 0 auto; }

.profile-header {
    text-align: center;
    margin-bottom: 28px;
}
.profile-emoji-large { font-size: 72px; display: block; margin-bottom: 8px; }
.profile-header h2 { font-size: 26px; }

.role-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    margin-top: 6px;
}
.role-adult { background: rgba(79,124,255,0.2); color: var(--accent); }
.role-child { background: rgba(61,214,140,0.2); color: var(--success); }

/* ── Emoji Picker ─────────────────────────────────────────── */
.emoji-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
    gap: 8px;
    margin-bottom: 12px;
}
.emoji-btn {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 24px;
    padding: 8px;
    cursor: pointer;
    transition: transform 0.1s, border-color 0.1s;
    line-height: 1;
}
.emoji-btn:hover { transform: scale(1.15); border-color: var(--accent); }
.emoji-btn.selected { border-color: var(--accent); background: rgba(79,124,255,0.15); }
.selected-preview { font-size: 14px; color: var(--text2); }

/* ── Stats ────────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
}
.stat-item {
    background: var(--bg3);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
}
.stat-value { display: block; font-size: 28px; font-weight: 700; }
.stat-label { display: block; font-size: 12px; color: var(--text2); margin-top: 4px; }
.stat-good .stat-value { color: var(--success); }
.stat-bad .stat-value { color: var(--danger); }

/* ── Formular ─────────────────────────────────────────────── */
.form-page { max-width: 480px; margin: 0 auto; }
.form-page h2 { margin-bottom: 28px; }

.form-label {
    display: block;
    font-size: 14px;
    color: var(--text2);
    margin-bottom: 6px;
    margin-top: 18px;
}
.form-input {
    width: 100%;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-size: 15px;
    padding: 10px 14px;
    outline: none;
}
.form-input:focus { border-color: var(--accent); }

.radio-group { display: flex; gap: 20px; margin-top: 4px; }
.radio-label { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 15px; }

/* ── Lobby ────────────────────────────────────────────────── */
.lobby-page { }
.lobby-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}
.lobby-header h2 { font-size: 24px; }

.lobby-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}
.lobby-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
    text-align: center;
    transition: border-color 0.15s;
}
.lobby-card:hover { border-color: var(--accent); }
.lobby-new { border-style: dashed; }
.lobby-card-emojis { font-size: 28px; }
.lobby-status { font-size: 13px; color: var(--text2); }
.lobby-hint { color: var(--text2); font-size: 14px; grid-column: 1/-1; text-align: center; padding: 20px; }

/* ── Skyjo Karten ─────────────────────────────────────────── */
.skyjo-card {
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    cursor: pointer;
    transition: transform 0.15s;
    user-select: none;
    border: 2px solid rgba(255,255,255,0.1);
}
.skyjo-card:hover { transform: translateY(-4px); }

.skyjo-card.blue   { background: var(--card-blue);   color: #fff; }
.skyjo-card.green  { background: var(--card-green);  color: #1a1d27; }
.skyjo-card.yellow { background: var(--card-yellow); color: #1a1d27; }
.skyjo-card.orange { background: var(--card-orange); color: #fff; }
.skyjo-card.red    { background: var(--card-red);    color: #fff; }
.skyjo-card.hidden { background: var(--card-hidden); color: var(--text2); }

/* ── WebSocket Status ─────────────────────────────────────── */
.ws-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text2);
    margin-bottom: 20px;
}
.ws-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.ws-dot--connecting { background: var(--warning); animation: pulse 1s infinite; }
.ws-dot--connected  { background: var(--success); }
.ws-dot--disconnected { background: var(--danger); }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.3; }
}

/* ── Lobby Header Actions ─────────────────────────────────── */
.lobby-header-actions { display: flex; gap: 10px; align-items: center; }

/* ── Section Title ────────────────────────────────────────── */
.section-title {
    font-size: 14px;
    color: var(--text2);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 24px 0 12px;
}

/* ── Eigene Lobby Card ────────────────────────────────────── */
.my-lobby-card {
    background: var(--bg2);
    border: 1px solid var(--accent);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 8px;
    position: relative;
}
.lobby-close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: transparent;
    border: none;
    color: var(--text-muted, #888);
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
    padding: 2px 6px;
    border-radius: 6px;
    transition: color 0.2s, background 0.2s;
}
.lobby-close-btn:hover {
    color: #fff;
    background: rgba(255,80,80,0.25);
}
.my-lobby-players {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
    min-height: 44px;
}
.lobby-player-chip {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 6px 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
}
.my-lobby-actions { display: flex; gap: 10px; }
.my-lobby-actions button { flex: 1; }
.my-lobby-hint {
    font-size: 12px;
    color: var(--text2);
    margin-top: 10px;
    text-align: center;
}

/* ── Lobby Grid Cards ─────────────────────────────────────── */
.lobby-card-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: center;
}
.lobby-player-count { font-size: 13px; color: var(--text2); }
.lobby-status-badge {
    font-size: 12px;
    padding: 3px 10px;
    border-radius: 20px;
    font-weight: 600;
}
.badge-waiting { background: rgba(255,184,77,0.15); color: var(--warning); }
.badge-running { background: rgba(61,214,140,0.15); color: var(--success); }

/* ── CPU-Zeile ────────────────────────────────────────────── */
.cpu-add-row {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}
.cpu-label { font-size: 13px; color: var(--text2); }
.cpu-skill-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.cpu-skill-btn {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 12px;
    padding: 4px 8px;
    cursor: pointer;
    transition: border-color 0.15s;
}
.cpu-skill-btn:hover { border-color: var(--accent); }
.chip-cpu { border-color: var(--accent); opacity: 0.8; }
.cpu-remove-btn {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-size: 13px;
    padding: 0 2px;
    line-height: 1;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 600px) {
    /* Topbar kompakter */
    .topbar { padding: 8px 12px; gap: 8px; }
    .topbar-logo { font-size: 15px; }
    .topbar-right { gap: 8px; }
    .topbar-profile { font-size: 13px; max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .back-link { font-size: 13px; }

    /* Landing */
    .landing-header h1 { font-size: 32px; }
    .landing-header .subtitle { font-size: 15px; margin-bottom: 28px; }
    .profile-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
    .profile-card { padding: 20px 10px 14px; gap: 8px; border-radius: 16px; }
    .profile-emoji { font-size: 40px; }
    .profile-name { font-size: 13px; }

    /* Lobby */
    .lobby-header h2 { font-size: 20px; }
    .lobby-grid { grid-template-columns: 1fr; }
    .my-lobby-actions { flex-direction: column; }
    .cpu-skill-btns { gap: 4px; }
    .cpu-skill-btn { padding: 4px 6px; font-size: 11px; }

    /* Seiten-Container */
    .page-container { padding: 16px 12px; }

    /* Modal */
    .modal { padding: 24px 16px; max-width: calc(100vw - 24px); }
}

@media (max-width: 400px) {
    .landing-header h1 { font-size: 26px; }
    .profile-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .profile-card { padding: 20px 12px 14px; }
    .profile-emoji { font-size: 44px; }
    .profile-name { font-size: 14px; }
}
