/* ══════════════════════════════════════════════════════════════════
   Dackel-Schatzsuche · style.css
   Kindgerecht · warm · mobile-first
   ══════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900&display=swap');

:root {
    --honey:    #F4A832;
    --honey-dk: #D4881A;
    --sky:      #5BBFDC;
    --sky-dk:   #3A9DBE;
    --grass:    #5EC97C;
    --grass-dk: #3DAA5D;
    --coral:    #F4624A;
    --coral-dk: #D44430;
    --lavender: #A78BFA;
    --cream:    #FFF8EC;
    --sand:     #FFF0D0;
    --brown:    #8B5E3C;
    --text:     #3D2B1A;
    --text-lt:  #7A6050;
    --white:    #FFFFFF;
    --shadow:   0 4px 20px rgba(61,43,26,.12);
    --radius:   18px;
    --radius-sm:10px;
}

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

html { font-size: 16px; }

body {
    font-family: 'Nunito', 'Segoe UI', Arial, sans-serif;
    background: var(--cream);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
}

/* ── Spielhintergrund ─────────────────────────────────────────────────── */
body.game-body {
    background: linear-gradient(160deg, #e8f8ff 0%, #fff4e0 60%, #e8fce8 100%);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ── Admin-Hintergrund ────────────────────────────────────────────────── */
body.admin-body {
    background: #f3f4f6;
}

/* ══════════════════════════════════════════════════════════════════
   LOGIN
   ══════════════════════════════════════════════════════════════════ */

body:not(.game-body):not(.admin-body) {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #fff4d0 0%, #ffe8c0 50%, #ffd4a0 100%);
    padding: 1rem;
}

.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow), 0 0 0 3px var(--honey);
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 400px;
}

.login-card {
    animation: pop-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes pop-in {
    from { transform: scale(0.85); opacity: 0; }
    to   { transform: scale(1);    opacity: 1; }
}

/* ══════════════════════════════════════════════════════════════════
   TYPOGRAFIE & UTILITY
   ══════════════════════════════════════════════════════════════════ */

.game-title {
    font-size: 2.2rem;
    font-weight: 900;
    color: var(--honey-dk);
    text-align: center;
    letter-spacing: -0.5px;
    text-shadow: 2px 2px 0 rgba(212,136,26,.2);
    display: block;
    margin-bottom: 0.25rem;
}

.game-title-small {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--honey-dk);
}

/* ══════════════════════════════════════════════════════════════════
   FORMULARE
   ══════════════════════════════════════════════════════════════════ */

.form-group {
    margin-bottom: 1.1rem;
}

.form-group label {
    display: block;
    font-weight: 700;
    color: var(--brown);
    margin-bottom: 0.35rem;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

input[type="text"],
input[type="password"],
select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e0d4c0;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 1rem;
    color: var(--text);
    background: var(--white);
    transition: border-color .2s, box-shadow .2s;
    outline: none;
}

input[type="text"]:focus,
input[type="password"]:focus,
select:focus {
    border-color: var(--honey);
    box-shadow: 0 0 0 3px rgba(244,168,50,.25);
}

/* ══════════════════════════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════════════════════════ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform .15s, box-shadow .15s, filter .15s;
    text-decoration: none;
    line-height: 1;
}

.btn:active { transform: scale(0.96); }

.btn-primary {
    background: linear-gradient(135deg, var(--honey), var(--honey-dk));
    color: var(--white);
    box-shadow: 0 4px 0 var(--honey-dk), 0 6px 12px rgba(244,168,50,.35);
}
.btn-primary:hover { filter: brightness(1.08); box-shadow: 0 6px 0 var(--honey-dk), 0 8px 16px rgba(244,168,50,.4); }

.btn-secondary {
    background: #e8e0d4;
    color: var(--brown);
    box-shadow: 0 3px 0 #c8b8a4;
}
.btn-secondary:hover { filter: brightness(0.96); }

.btn-success {
    background: linear-gradient(135deg, var(--grass), var(--grass-dk));
    color: var(--white);
    box-shadow: 0 3px 0 var(--grass-dk);
}

.btn-danger {
    background: linear-gradient(135deg, var(--coral), var(--coral-dk));
    color: var(--white);
    box-shadow: 0 3px 0 var(--coral-dk);
}

.btn-sm {
    padding: 0.4rem 0.85rem;
    font-size: 0.82rem;
    border-radius: 8px;
}

.btn-xl {
    font-size: 1.25rem;
    padding: 1rem 2.5rem;
    border-radius: 14px;
    width: 100%;
    max-width: 320px;
}

/* ══════════════════════════════════════════════════════════════════
   ALERTS
   ══════════════════════════════════════════════════════════════════ */

.alert {
    padding: 0.9rem 1.2rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.5;
}

.alert-success { background: #d1f7d9; color: #1a6b2e; border-left: 4px solid var(--grass); }
.alert-error   { background: #fde8e4; color: #8b2010; border-left: 4px solid var(--coral); }
.alert-warn    { background: #fff3cd; color: #7a5c00; border-left: 4px solid var(--honey); }

/* ══════════════════════════════════════════════════════════════════
   SPIEL-LAYOUT
   ══════════════════════════════════════════════════════════════════ */

.game-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: rgba(255,255,255,0.8);
    backdrop-filter: blur(8px);
    border-bottom: 2px solid rgba(244,168,50,.2);
    position: sticky;
    top: 0;
    z-index: 10;
}

.game-nav { display: flex; gap: 0.5rem; align-items: center; }

.nav-link {
    color: var(--brown);
    text-decoration: none;
    font-weight: 700;
    font-size: 0.9rem;
    padding: 0.35rem 0.75rem;
    border-radius: 8px;
    background: rgba(244,168,50,.12);
    transition: background .2s;
}
.nav-link:hover { background: rgba(244,168,50,.28); }

.game-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem 0.75rem 0.5rem;
    gap: 0.75rem;
}

.game-info-bar {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    justify-content: center;
}

.info-chip {
    background: rgba(255,255,255,0.85);
    border: 2px solid rgba(244,168,50,.3);
    border-radius: 50px;
    padding: 0.3rem 0.9rem;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text);
}

.score-chip { border-color: rgba(91,191,220,.5); }
.hs-chip    { border-color: rgba(94,201,124,.5); }

/* ── Canvas ──────────────────────────────────────────────────────────── */

#game-container {
    position: relative;
    width: 100%;
    max-width: 480px;
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow), 0 0 0 3px var(--honey);
    overflow: hidden;
}

#game-canvas {
    display: block;
    width: 100%;
    height: auto;
}

/* ── Overlay-Screens ─────────────────────────────────────────────────── */

.overlay {
    position: absolute;
    inset: 0;
    background: rgba(61,43,26,.55);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 5;
}

.overlay-box {
    background: var(--white);
    border-radius: var(--radius);
    padding: 2rem 1.5rem;
    text-align: center;
    max-width: 340px;
    width: 100%;
    box-shadow: 0 8px 32px rgba(0,0,0,.2);
}

.overlay-box h2 {
    font-size: 1.6rem;
    font-weight: 900;
    color: var(--honey-dk);
    margin-bottom: 0.75rem;
}

.overlay-box p {
    color: var(--text-lt);
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
}

.overlay-box .btn { margin-top: 0.75rem; }

/* ── Touch-Steuerung ─────────────────────────────────────────────────── */

.touch-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    padding: 0.5rem 0;
}

.touch-row {
    display: flex;
    gap: 0.3rem;
    justify-content: center;
}

.touch-btn {
    width: 68px;
    height: 68px;
    border: none;
    border-radius: 14px;
    background: rgba(255,255,255,0.85);
    box-shadow: 0 4px 0 rgba(0,0,0,.12);
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--brown);
    font-weight: 900;
    transition: transform .1s, box-shadow .1s;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}
.touch-btn:active {
    transform: translateY(3px);
    box-shadow: 0 1px 0 rgba(0,0,0,.12);
}
.touch-btn-center { background: rgba(244,168,50,.15); }

/* ══════════════════════════════════════════════════════════════════
   ADMIN-LAYOUT
   ══════════════════════════════════════════════════════════════════ */

.admin-header {
    background: var(--white);
    border-bottom: 2px solid #e8ddd0;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 10;
}

.admin-header-inner {
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
}

.admin-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
}

.admin-page-title {
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--text);
    margin-bottom: 0.25rem;
}

.admin-section {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.75rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 12px rgba(0,0,0,.07);
}

.admin-section h2 {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--brown);
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #f0e8dc;
}

.admin-form .form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

/* ── Admin-Tabellen ──────────────────────────────────────────────────── */

.table-wrap { overflow-x: auto; }

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.admin-table th {
    background: #f7f0e8;
    padding: 0.6rem 0.75rem;
    text-align: left;
    font-weight: 800;
    color: var(--brown);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.admin-table td {
    padding: 0.7rem 0.75rem;
    border-bottom: 1px solid #f0e8dc;
    vertical-align: middle;
}

.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr.row-inactive td { opacity: .5; }

.action-cell { display: flex; gap: 0.4rem; flex-wrap: wrap; align-items: center; }

/* ── Badges ──────────────────────────────────────────────────────────── */

.badge {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
}

.badge-admin   { background: #ede9fe; color: #5b21b6; }
.badge-player  { background: #e0f2fe; color: #0369a1; }
.badge-active  { background: #dcfce7; color: #166534; }
.badge-inactive{ background: #fee2e2; color: #991b1b; }
.badge-you     { background: var(--honey); color: var(--white); font-size: 0.65rem; vertical-align: middle; }

/* ── Modal ───────────────────────────────────────────────────────────── */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 1rem;
}

.modal-box {
    background: var(--white);
    border-radius: var(--radius);
    padding: 2rem;
    max-width: 380px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
}

.modal-box h3 {
    font-size: 1.2rem;
    font-weight: 800;
    margin-bottom: 1.25rem;
    color: var(--brown);
}

/* ══════════════════════════════════════════════════════════════════
   CODE-ELEMENT
   ══════════════════════════════════════════════════════════════════ */

code {
    background: #f0e8dc;
    color: var(--brown);
    padding: 0.1em 0.45em;
    border-radius: 5px;
    font-size: 0.9em;
    font-family: 'Courier New', monospace;
}

/* ══════════════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════════════ */

@media (max-width: 480px) {
    .card { padding: 2rem 1.25rem; }
    .admin-section { padding: 1.25rem; }
    .admin-container { padding: 1.25rem 0.75rem 3rem; }
    .touch-btn { width: 62px; height: 62px; font-size: 1.3rem; }
    .overlay-box { padding: 1.5rem 1.2rem; }
    .btn-xl { font-size: 1.1rem; padding: 0.9rem 1.5rem; }
}

@media (min-width: 600px) {
    .touch-controls { display: none; }
}
