/* =========================================================
   Memory Spiel – gleiches Theme wie "Farbcode knacken"
=================================================== */

:root {
  --bg: #14111f;
  --bg-glow: radial-gradient(circle at 20% -10%, #2c2247 0%, #14111f 55%);
  --panel: #1c1830;
  --panel-2: #241f3d;
  --border: #382f57;
  --text: #ece8f7;
  --muted: #9d94bd;
  --gold: #e0b054;
  --gold-soft: #f3d38a;
  --teal: #2fd9c2;
  --danger: #ff6b6b;
  --radius: 16px;
  --shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    background: var(--bg-glow);
    color: var(--text);
}
*, *::before, *::after {
    box-sizing: inherit;
}

.logo-text-container {
    display: flex;
    align-items: center;
    padding: 16px 10px;
    justify-content: center;
    gap: 15px;
}
.logo-text-container img {
    width: 100px;
}
.headline-text {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 10px;
}
.headline-text img {
    height: 90px;
    border-radius: 8px;
}

main {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    padding: 10px 20px 40px;
}
.game-wrapper {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 20px;
    flex-wrap: wrap;
}

/* -------- Spielfeld -------- */

#boxcard {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    width: 625px;
    max-width: 100%;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 15px;
    background: var(--panel);
    box-shadow: var(--shadow);
}
#boxcard div {
    aspect-ratio: 1 / 1;
    background: linear-gradient(160deg, var(--panel-2), #1a1730);
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(224, 176, 84, 0.35);
    border-radius: 10px;
    box-shadow:
        inset 0 1px 1px rgba(255, 255, 255, 0.06),
        0 3px 6px rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
#boxcard div::after {
    content: "?";
    position: absolute;
    color: var(--gold);
    opacity: 0.55;
    font-weight: 700;
    font-size: 1.4em;
    transition: opacity 0.15s ease;
}
#boxcard div:hover {
    transform: translateY(-2px);
    box-shadow:
        inset 0 1px 1px rgba(255, 255, 255, 0.08),
        0 6px 14px rgba(0, 0, 0, 0.45);
}
#boxcard div:hover::after {
    opacity: 0.85;
}
#boxcard div img {
    display: none;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    position: relative;
    z-index: 1;
    background: #fff;
    padding: 4px;
    border-radius: 6px;
}

.opacity {
    opacity: 0.55;
    pointer-events: none;
}
#boxcard div:has(img.opacity) {
    border-color: var(--gold);
    box-shadow: 0 0 0 1px var(--gold), 0 3px 10px rgba(224, 176, 84, 0.25);
}
#boxcard div:has(img.opacity)::after {
    display: none;
}

/* -------- Steuerpanel -------- */

#boxbutton {
    padding: 22px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    min-width: 220px;
}

.link, .link2 {
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    padding: 9px 16px;
    border-radius: 10px;
    cursor: pointer;
    display: inline-block;
    border: none;
    transition: transform 0.12s ease, filter 0.15s ease;
}
.link:active, .link2:active { transform: scale(0.96); }

.link {
    background: linear-gradient(180deg, var(--gold-soft), var(--gold));
    color: #23180a;
    box-shadow: 0 4px 12px rgba(224, 176, 84, 0.3);
}
.link:hover {
    filter: brightness(1.08);
}

.link2 {
    background: var(--teal);
    color: #08201c;
    font-size: 18px;
    font-weight: 700;
    text-align: center;
    box-shadow: 0 4px 12px rgba(47, 217, 194, 0.25);
}
.link2:hover {
    filter: brightness(1.08);
}

#msg {
    font-size: 16px;
    font-weight: 600;
    color: var(--gold-soft);
    text-align: center;
    word-break: break-word;
}

select.link {
    padding: 8px 10px;
    font-size: 14px;
    font-weight: 600;
    background: #100d1c;
    color: var(--gold-soft);
    border: 1px solid var(--gold);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5);
}
select.link:hover {
    filter: none;
    background: #17131f;
}

/* -------- Ergebnis-Box -------- */

.results-box {
    background: var(--panel-2);
    border: 1px solid var(--gold);
    border-radius: 12px;
    padding: 15px 18px;
    margin-top: 4px;
    text-align: center;
    font-size: 16px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
    animation: einblenden 0.25s ease;
}
.results-box strong { color: var(--gold-soft); }

@keyframes einblenden {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

#stoppuhr {
    font-weight: 700;
    font-size: 1.2em;
    color: var(--teal);
}

/* Responsive Layout für Tablets & Handys */

@media (max-width: 768px) {
    
    main {
        padding: 10px 16px 40px;
    }
    .game-wrapper {
        flex-direction: column;
        align-items: center;
        gap: 15px;
        width: 100%;
    }
    #boxcard {
        grid-template-columns: repeat(4, 1fr);
        width: 100%;
        max-width: 400px;
        padding: 10px;
        gap: 8px;
    }
    #boxbutton {
        width: 100%;
        max-width: 400px;
        margin-top: 10px;
        padding: 16px;
        gap: 14px;
    }
    .logo-text-container {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    .logo-text-container img {
        width: 100px;
        margin-bottom: 6px;
    }
    .headline-text {
        font-size: 20px;
    }
   .headline-text img {
    height: 90px;
    border-radius: 8px;
}
     .link2 {
        font-size: 16px;
        word-wrap: break-word;
    }
    .link, select.link {
        font-size: 14px;
        padding: 7px 12px;
    }
    #msg {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    #boxcard {
        gap: 6px;
    }
    .logo-text-container img {
        width: 120px;
    }
    .headline-text {
        font-size: 18px;
    }
    .link, select.link {
        font-size: 13px;
        padding: 6px 10px;
    }
    #boxbutton {
        padding: 12px;
    }
}