:root {
    --bg-color: #f4f7f6;
    --panel-bg: #ffffff;
    --primary: #4a90e2;
    --primary-hover: #357abd;
    --text-dark: #333333;
    --text-light: #777777;
    --cube-bg: #fffbe6;
    --border: #e0e0e0;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

html,
body {
    background-color: var(--bg-color);
    color: var(--text-dark);
    overscroll-behavior-y: none;
}

.app-container {
    display: flex;
    flex-direction: column;
    max-width: 1200px;
    margin: 0 auto;
    min-height: 100vh;
}

/* Vezérlőpult */
.controls {
    background-color: var(--panel-bg);
    padding: 20px;
    border-bottom: 2px solid var(--border);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    z-index: 10;
}

/* ÚJ: Címsor és Súgó gomb elrendezése */
.header-title-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.header-title-row h1 {
    margin-bottom: 0;
    font-size: 1.8rem;
    color: var(--primary);
}

.help-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    transition: transform 0.2s;
    opacity: 0.8;
}

.help-btn:hover {
    transform: scale(1.15);
    opacity: 1;
}

.control-group {
    margin-bottom: 15px;
    background: var(--bg-color);
    padding: 10px;
    border-radius: 8px;
}

.control-group label {
    display: block;
    font-weight: bold;
    margin-bottom: 5px;
}

select {
    width: 100%;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid var(--border);
    font-size: 1rem;
}

.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkbox-wrapper label {
    margin: 0;
    font-weight: normal;
}

/* Számlálók */
.counter-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.counter-row:last-child {
    border-bottom: none;
}

.counter-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.counter-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background-color: var(--primary);
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    line-height: 1;
}

.counter-btn:active {
    background-color: var(--primary-hover);
}

.counter-value {
    font-weight: bold;
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

#roll-btn {
    width: 100%;
    padding: 15px;
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.2rem;
    font-weight: bold;
    margin-top: 15px;
    cursor: pointer;
    box-shadow: 0 4px 0 #357abd;
    transition: all 0.1s;
}

#roll-btn:active {
    transform: translateY(4px);
    box-shadow: 0 0 0 #357abd;
}

/* Játéktér */
.board {
    padding: 20px;
    flex-grow: 1;
}

h2 {
    font-size: 1.3rem;
    margin-bottom: 15px;
    color: var(--text-light);
    border-bottom: 2px solid var(--border);
    padding-bottom: 5px;
}

.history-header {
    cursor: pointer;
    user-select: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: color 0.2s, border-bottom-color 0.2s;
    margin-top: 30px;
}

.history-header:hover {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

#history-toggle-icon {
    font-size: 0.9rem;
    transition: transform 0.3s ease;
}

.history-header.open #history-toggle-icon {
    transform: rotate(180deg);
}

.kocka-tarolo {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 30px;
    justify-content: center;
}

/* A Kockák stílusa */
.cube {
    background-color: var(--cube-bg);
    border: 2px solid #f0e68c;
    border-radius: 15px;
    width: 120px;
    height: 140px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
    text-align: center;
    padding: 10px;
    transition: all 0.3s;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    transform: translateZ(0);
}

.cube .emoji {
    font-size: 3rem;
    margin-bottom: 5px;
    transition: all 0.3s ease;
}

.cube .szoveg {
    font-weight: bold;
    font-size: 0.9rem;
    line-height: 1.1;
    transition: all 0.3s ease;
}

.cube .kategoria-cimke {
    font-size: 0.7rem;
    color: var(--text-light);
    margin-top: 5px;
    text-transform: uppercase;
    transition: all 0.3s ease;
}

/* CSAK EMOJI MÓD BEÁLLÍTÁSAI ÉS BUBORÉK */
.board.csak-emoji-aktiv .cube .szoveg,
.board.csak-emoji-aktiv .cube .kategoria-cimke {
    display: none;
}

.board.csak-emoji-aktiv .cube .emoji,
.board.csak-emoji-aktiv .cube .content-reveal .emoji {
    font-size: 4.5rem;
    margin-bottom: 0;
}

.board.csak-emoji-aktiv .history-tarolo .cube .emoji {
    font-size: 3.5rem;
}

.board.csak-emoji-aktiv .cube {
    position: relative;
}

.board.csak-emoji-aktiv .cube:not(.hidden-cube):hover::after {
    content: attr(data-szoveg);
    position: absolute;
    bottom: 105%;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(30, 30, 30, 0.95);
    color: #ffffff;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: bold;
    white-space: pre-wrap;
    width: max-content;
    max-width: 150px;
    text-align: center;
    z-index: 100;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    pointer-events: none;
}

.board.csak-emoji-aktiv .cube:not(.hidden-cube):hover::before {
    content: '';
    position: absolute;
    bottom: calc(105% - 6px);
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px 6px 0 6px;
    border-style: solid;
    border-color: rgba(30, 30, 30, 0.95) transparent transparent transparent;
    z-index: 100;
    pointer-events: none;
}

/* Rejtett kocka */
.cube.hidden-cube {
    background-color: var(--primary);
    border-color: var(--primary-hover);
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 0 var(--primary-hover);
}

.cube.hidden-cube .emoji {
    font-size: 4rem;
}

.cube.hidden-cube:active {
    transform: translateY(4px);
    box-shadow: 0 0 0;
}

.board.csak-emoji-aktiv .cube.hidden-cube .emoji {
    font-size: 4rem;
}

/* Kocka Pörgés Animáció */
.anim-roll {
    animation: rollIn 0.6s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

@keyframes rollIn {
    0% {
        transform: scale(0) rotate(-360deg);
        opacity: 0;
    }

    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

.content-reveal {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    opacity: 0;
    animation: revealInner 0.6s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

@keyframes revealInner {

    0%,
    30% {
        opacity: 0;
        transform: scale(0.5);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Előzmények */
.history-tarolo .cube {
    width: 90px;
    height: 110px;
    opacity: 0.7;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.history-tarolo .cube .emoji {
    font-size: 2rem;
}

.history-tarolo .cube .szoveg {
    font-size: 0.7rem;
}

.hidden {
    display: none !important;
}

/* ÚJ: Felugró ablak (Modal) Stílusok */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(3px);
    /* Kellemes homályosítás a háttéren */
}

.modal-content {
    background-color: #ffffff;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
    transition: color 0.2s;
}

.close-btn:hover {
    color: var(--primary);
}

.modal-content h2 {
    border-bottom: none;
    color: var(--primary);
    font-size: 1.5rem;
    margin-top: 0;
}

.modal-content h3 {
    color: var(--text-dark);
    margin-top: 20px;
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.modal-content p,
.modal-content ul {
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--text-dark);
    margin-bottom: 10px;
}

.modal-content ul {
    padding-left: 20px;
}

.modal-content li {
    margin-bottom: 6px;
}

/* Asztali nézet */
@media (min-width: 768px) {
    .app-container {
        flex-direction: row;
    }

    .controls {
        width: 350px;
        height: 100vh;
        position: sticky;
        top: 0;
        overflow-y: auto;
        border-right: 2px solid var(--border);
        border-bottom: none;
    }

    .board {
        width: calc(100% - 350px);
    }

    .kocka-tarolo {
        justify-content: flex-start;
    }
}