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

html {
    font: 10pt 'Press Start 2P', cursive;
    color: #ddd;
}

body {
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: #5d9c59;
    background-image: url('https://i.ibb.co/bH3JY30/IE1G7Lr.png');
    background-size: cover;
    background-position: center;
    position: relative;
    padding-top: 60px;
    padding-bottom: 40px;
    overflow: hidden;
    image-rendering: pixelated;
}

/* === Верхнее меню === */
.top-menu {
    position: absolute;
    top: 16px;
    display: flex;
    gap: 8px;
    --btn-size: 20pt;
}

.top-menu .mc-link {
    height: var(--btn-size);
    width: auto;
    min-width: calc(var(--btn-size) * 6);
    background: #999 url('https://i.ibb.co/rb2TWXL/bgbtn.png') center / cover;
    image-rendering: pixelated;
    border: 2px solid #000;
    text-decoration: none;
    display: block;
    cursor: pointer;
}

.top-menu .mc-link .title {
    font-size: 8pt;
    padding: 0 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    color: #DDD;
    text-shadow: 1px 1px rgba(0, 0, 0, 0.65);
    box-shadow: inset -1px -2px rgba(0, 0, 0, 0.38), inset 1px 1px rgba(255, 255, 255, 0.47);
}

.top-menu .mc-link:hover .title {
    background-color: rgba(100, 100, 255, 0.45);
    color: #FFFFA0;
    text-shadow: 1px 1px rgba(32, 32, 19, 0.8);
}

.top-menu .mc-link:active .title {
    box-shadow: inset -1px -2px rgba(0, 0, 0, 0.25), inset 1px 1px rgba(255, 255, 255, 0.33);
}

/* === Основное меню === */
.mc-menu {
    --btn-size: 30pt;
    display: grid;
    grid-template-columns: var(--btn-size) calc(var(--btn-size) * 10) var(--btn-size);
    grid-template-rows: repeat(5, var(--btn-size));
    grid-template-areas:
    '. play .'
    '. rules .'
    '. settings .'
    '. servers .'
    '. exit .';
    grid-gap: 10px;
    width: calc(var(--btn-size) * 12 + 20px);
}

.mc-menu > .mc-button:nth-child(1) { grid-area: play; }
.mc-menu > .mc-button:nth-child(2) { grid-area: rules; }
.mc-menu > .mc-button:nth-child(3) { grid-area: settings; }
.mc-menu > .mc-button:nth-child(4) { grid-area: servers; }
.mc-menu > .mc-button:nth-child(5) { grid-area: exit; }

.mc-button {
    height: var(--btn-size);
    width: calc(var(--btn-size) * 10);
    cursor: pointer;
    overflow: hidden;
    white-space: nowrap;
    user-select: none;
    background: #999 url('https://i.ibb.co/rb2TWXL/bgbtn.png') center / cover;
    image-rendering: pixelated;
    border: 2px solid #000;
    position: relative;
}

.mc-button:hover .title {
    background-color: rgba(100, 100, 255, 0.45);
    text-shadow: 2px 2px rgba(32, 32, 19, 0.8);
    color: #FFFFA0;
}

.mc-button:active .title {
    box-shadow: inset -2px -4px rgba(0, 0, 0, 0.25), inset 2px 2px rgba(255, 255, 255, 0.33);
}

.mc-button .title {
    width: 100%;
    height: 100%;
    padding-bottom: 0.3em;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #DDD;
    text-shadow: 2px 2px rgba(0, 0, 0, 0.65);
    box-shadow: inset -2px -4px rgba(0, 0, 0, 0.38), inset 2px 2px rgba(255, 255, 255, 0.47);
}

/* === Копирайт === */
.copyright {
    position: absolute;
    bottom: 12px;
    width: 100%;
    text-align: center;
    font-size: 8pt;
    color: #aaa;
    text-shadow: 1px 1px #000;
    opacity: 0.8;
}

/* === Модальные окна === */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: #8b5a2b url('https://i.ibb.co/rb2TWXL/bgbtn.png') repeat;
    border: 4px solid #000;
    padding: 20px;
    text-align: center;
    image-rendering: pixelated;
    box-shadow: 0 0 16px rgba(0, 0, 0, 0.8);
    font-family: 'Press Start 2P', cursive;
    color: #ddd;
    text-shadow: 1px 1px #000;
}

/* === Модальные окна: все пять — адаптивная ширина === */
.rules-modal,
.news-modal,
.about-modal,
.settings-modal,
.servers-info-modal {
    width: auto;
    min-width: 320px;
    max-width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
    padding: 20px;
    text-align: left;
    display: inline-block;
}

.rules-content,
.news-content,
.about-content,
.settings-content,
.servers-info-content {
    font-size: 8pt;
    line-height: 1.4;
    white-space: nowrap;
    word-wrap: break-word;
}

.rules-content br,
.news-content br,
.about-content br,
.settings-content br,
.servers-info-content br {
    display: block;
    margin: 8px 0;
}

/* === Кнопки в модалках === */
.modal h2 {
    font-size: 10pt;
    color: #ffd700;
    margin-bottom: 16px;
    text-shadow: 1px 1px #000;
}

.modal p {
    font-size: 8pt;
    margin-bottom: 20px;
    line-height: 1.4;
}

.modal-buttons {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.modal-btn {
    height: 24px;
    min-width: 80px;
    background: #999 url('https://i.ibb.co/rb2TWXL/bgbtn.png') center / cover;
    border: 2px solid #000;
    color: #DDD;
    font-family: 'Press Start 2P', cursive;
    font-size: 6pt;
    cursor: pointer;
    image-rendering: pixelated;
    text-shadow: 1px 1px rgba(0, 0, 0, 0.65);
    box-shadow: inset -1px -2px rgba(0, 0, 0, 0.38), inset 1px 1px rgba(255, 255, 255, 0.47);
    text-decoration: none;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-btn:hover {
    background-color: rgba(100, 100, 255, 0.45);
    color: #FFFFA0;
}

.modal-btn:active {
    box-shadow: inset -1px -2px rgba(0, 0, 0, 0.25), inset 1px 1px rgba(255, 255, 255, 0.33);
}
