/* Retro 16-bit Filter CSS */

@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

body.hq, .hq button, .hq input, .hq h1, .hq h2, .hq h3, .hq h4, .hq h5, .hq h6, .hq p, .hq label, .hq div, .hq span, .hq td, .hq th {
    font-family: 'Press Start 2P', cursive !important;
    text-shadow: 2px 2px 0px #000 !important;
    -webkit-font-smoothing: none;
    -moz-osx-font-smoothing: grayscale;
}

body.hq {
    image-rendering: pixelated;
    filter: saturate(1.5) contrast(1.2) brightness(0.9);
    position: relative;
    background-color: #222;
}

body.hq.monochrome {
    filter: grayscale(100%) saturate(1.5) contrast(1.2) brightness(0.9);
    background-image: none;
}

body.hq::after {
    content: " ";
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
    z-index: 2;
    background-size: 100% 2px, 3px 100%;
    pointer-events: none;
}

.hq #main-container {
    width: 95%;
    max-width: 800px;
    margin: auto;
}

.hq .modal-content, .hq .player-card, .hq .player-controls, .hq #game-info-bar, .hq .achievement, .hq #highscore-table td {
    border: 4px solid #000;
    border-radius: 0 !important;
    width: 100%;
    box-sizing: border-box;
    box-shadow: inset 0 0 0 4px #555;
    background: #888 !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    transform: none !important;
    animation: none !important;
}

.hq .heading-style-1, .hq .heading-style-2 {
    color: var(--primary-pink) !important;
}

.hq .heading-style-3, .hq .heading-style-4 {
    color: var(--primary-blue) !important;
}

.hq .game-logo, .hq .snek-avatar, .hq .element-icon, .hq .achievement-icon {
    image-rendering: pixelated;
}

.hq .btn, .hq button {
    border-radius: 0 !important;
    border: 2px solid #000 !important;
    box-shadow: 4px 4px 0px #000 !important;
    text-transform: uppercase;
    transition: transform 0.1s, box-shadow 0.1s !important;
    animation: none !important;
    background-image: none !important;
    background-color: #ccc !important;
    color: #000 !important;
}

.hq .btn:hover, .hq button:hover {
    transform: translate(2px, 2px) !important;
    box-shadow: 2px 2px 0px #000 !important;
}

.hq .btn:active, .hq button:active {
    transform: translate(4px, 4px) !important;
    box-shadow: 0px 0px 0px #000 !important;
}

.hq .tab-link.active {
    background: #aaa !important;
}

.hq .player-card:hover, .hq .achievement:hover {
    transform: none !important;
    box-shadow: inset 0 0 0 4px #555 !important;
}

.hq .snek-option.selected .snek-avatar {
    outline: 4px solid yellow;
    border-color: yellow !important;
    box-shadow: none !important;
    transform: scale(1.1) !important;
}

.hq .player-name-input {
    border-radius: 0;
    border: 2px solid #000;
}

.hq .player-name-input:focus {
    box-shadow: none !important;
    outline: 4px solid yellow;
}

.hq .health-bar-container {
    border: 2px solid #000;
    border-radius: 0;
    background-color: #555;
    padding: 2px;
}

.hq .health-bar {
    background-color: #00ff00 !important;
    border-radius: 0 !important;
}

.hq .player-controls {
}

.hq .player-controls.active {
    animation: none;
    border-color: #000 !important;
    box-shadow: inset 0 0 0 4px #555, 0 0 20px yellow !important;
}

.hq #canvas-container {
    border-radius: 0;
    border: 4px solid #000;
}

.hq canvas {
    image-rendering: pixelated;
}

.hq .tooltip {
    display: none !important; /* Hiding tooltips as they don't fit the retro style well */
}

.hq #highscore-table th {
    color: #fff !important;
}

.hq .options-container input[type="range"]::-webkit-slider-thumb {
    border-radius: 0;
    background: #fff;
    border: 2px solid #000;
    width: 16px;
    height: 24px;
}

.hq .options-container input[type="checkbox"] {
    border-radius: 0;
}

.hq .turn-change-banner {
    border-radius: 0;
    border: 4px solid #000;
    box-shadow: none !important;
}

.hq #pause-screen {
    border-radius: 0;
}

/* Achievements layout tuning for High-Quality mode */
.hq .achievements-container { max-width: 960px; width: 100%; }
.hq .achievement-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
.hq .achievement-card { border: 4px solid #000 !important; border-radius: 0 !important; padding: 8px !important; grid-template-columns: 44px 1fr auto; background: #888 !important; box-shadow: inset 0 0 0 4px #555 !important; }
.hq .achievement-icon { width: 44px !important; height: 44px !important; background: #777 !important; }
.hq .achievement-content h4 { font-size: 1rem !important; }
.hq .achievement-content p { font-size: 0.85rem !important; }
.hq .achievement-badge { border: 2px solid #000 !important; background: #bbb !important; color: #000 !important; }
.hq .achievement-badge.rarity-rare { background: #a9cce6 !important; }
.hq .achievement-badge.rarity-epic { background: #c9a0dc !important; }
.hq .achievement-date { color: #000 !important; opacity: 1 !important; }
.hq .achievement-card:hover { transform: none !important; box-shadow: inset 0 0 0 4px #555 !important; }
.hq .achievement-legend { background: #999; border: 2px solid #000; padding: 6px 8px; border-radius: 0; }

/* Summary table in HQ mode */
.hq .achievement-summary { background: #999 !important; border: 2px solid #000 !important; border-radius: 0 !important; }
.hq .achievement-summary thead th { background: #aaa !important; color: #000 !important; }
.hq .achievement-summary tbody tr:nth-child(odd) td { background: #909090 !important; }
.hq .achievement-summary th, .hq .achievement-summary td { color: #000 !important; }

/* Compact mode in HQ */
.hq .achievements-compact .achievement-card { padding: 6px !important; }
.hq .achievements-compact .achievement-icon { width: 40px !important; height: 40px !important; }

@media (max-width: 700px) {
  .hq .achievement-grid { grid-template-columns: 1fr; }
}
/* Responsive tweaks for High-Quality mode */
@media (max-width: 900px) {
  .hq #main-container { max-width: 680px; width: 96%; }
  .hq .modal-content, .hq .player-card, .hq .player-controls, .hq #game-info-bar, .hq .achievement { padding: 10px; }
  .hq .btn, .hq button { padding: 10px 18px !important; font-size: 1rem !important; }
}

@media (max-width: 600px) {
  /* Soften scanlines on small screens */
  body.hq::after {
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.18) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.04), rgba(0, 255, 0, 0.015), rgba(0, 0, 255, 0.04));
    background-size: 100% 1.5px, 2px 100%;
  }
  /* Reduce heavy shadows and text thickness for readability */
  .hq, .hq h1, .hq h2, .hq h3, .hq h4, .hq h5, .hq h6, .hq p, .hq label, .hq button { text-shadow: 1px 1px 0 #000 !important; }
  .hq #main-container { max-width: 100%; width: 98%; padding: 10px; }
  .hq .modal-content { width: 92%; max-width: 560px; }
  .hq .player-controls { grid-template-columns: 1fr; }
  .hq .btn, .hq button { padding: 9px 14px !important; font-size: 0.95rem !important; }
  .hq .heading-style-1 { font-size: clamp(1.4rem, 6vw, 1.8rem) !important; }
  .hq .heading-style-2 { font-size: clamp(1.1rem, 4.5vw, 1.35rem) !important; }
  .hq .heading-style-3 { font-size: clamp(1rem, 4vw, 1.2rem) !important; }
}

@media (max-width: 400px) {
  .hq .btn, .hq button { padding: 8px 12px !important; font-size: 0.9rem !important; }
  .hq .modal-content { width: 94%; max-width: 520px; padding: 12px; }
}
