@import url('https://fonts.googleapis.com/css2?family=VT323&display=swap');

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

body {
    font-family: 'VT323', monospace;
    background: #2d1b00;
    color: #fff;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.game-container {
    max-width: 920px;
    width: 100%;
}

.nav {
    margin-bottom: 1rem;
}

.nav a {
    color: #a08060;
    text-decoration: none;
    font-size: 1.1rem;
    transition: color 0.2s;
}

.nav a:hover {
    color: #5c9e31;
}

.header {
    text-align: center;
    margin-bottom: 1rem;
}

.title {
    font-size: 2.4rem;
    color: #5c9e31;
    text-shadow: 2px 2px 0 #2d5016;
    margin-bottom: 0.4rem;
}

.description {
    font-size: 1.2rem;
    color: #c0a080;
    line-height: 1.6;
    max-width: 640px;
    margin: 0 auto;
}

.hud {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid #5c3a1e;
    padding: 0.6rem 1.2rem;
    margin-bottom: 0.6rem;
    font-size: 1.2rem;
    color: #c0a080;
}

.hud strong {
    color: #5c9e31;
}

.hud-left, .hud-right {
    white-space: nowrap;
}

.hud-center {
    flex: 1;
    text-align: center;
    color: #e0c080;
}

.canvas-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    border: 3px solid #5c3a1e;
    overflow: hidden;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
    cursor: pointer;
}

.canvas-wrapper canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

.controls {
    display: flex;
    gap: 0.8rem;
    justify-content: center;
    margin-top: 0.8rem;
}

.btn {
    font-family: 'VT323', monospace;
    font-size: 1.4rem;
    padding: 0.5rem 1.6rem;
    border: 2px solid #5c3a1e;
    cursor: pointer;
    transition: transform 0.08s, background 0.15s, border-color 0.15s;
    text-transform: uppercase;
    background: #3d2810;
    color: #e0c080;
}

.btn:hover {
    transform: translateY(-2px);
    background: #4a3018;
    border-color: #8b6540;
}

.btn:active {
    transform: translateY(1px);
}

.btn-sail {
    background: #2d5016;
    border-color: #5c9e31;
    color: #a0e860;
}

.btn-sail:hover {
    background: #3d6b20;
}

.btn-undo {
    color: #a08060;
}

.btn-reset {
    color: #cc8866;
    border-color: #6b3020;
}

.btn-reset:hover {
    background: #4a2010;
    border-color: #994433;
}

.rules {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    justify-content: center;
    margin-top: 0.8rem;
    flex-wrap: wrap;
    font-size: 1.1rem;
}

.rule {
    color: #a08060;
}

.rule-sep {
    color: #5c3a1e;
}

.rule-warn {
    color: #cc6644;
}

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: #2d1b00;
    border: 3px solid #5c3a1e;
    padding: 2rem 2.5rem;
    text-align: center;
    max-width: 400px;
    animation: modal-pop 0.3s ease;
}

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

.modal-icon {
    font-size: 2.5rem;
    margin-bottom: 0.6rem;
}

.modal-text {
    font-size: 1.5rem;
    line-height: 1.6;
    margin-bottom: 1.2rem;
    color: #e0c080;
}

.modal.game-over {
    border-color: #cc4444;
}

.modal.game-over .modal-text {
    color: #ff6644;
}

.modal.game-won {
    border-color: #5c9e31;
    box-shadow: 0 0 30px rgba(92, 158, 49, 0.2);
}

.modal.game-won .modal-text {
    color: #a0e860;
}

@media (max-width: 640px) {
    .title { font-size: 1.8rem; }
    .hud { flex-direction: column; gap: 0.3rem; padding: 0.4rem; }
    .controls { flex-wrap: wrap; }
    .btn { font-size: 1.2rem; padding: 0.4rem 1rem; }
    .rules { font-size: 1rem; }
}
