/* filename: style.css */
:root {
  font-size: clamp(12px, 2.2vmin, 24px);
  --green-dark: #1a2e28;
  --gold: #fcd34d;
  --gold-transparent: rgba(252, 211, 77, 0.1);
  --shadow-color: rgba(252, 211, 77, 0.2);
}
html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--green-dark);
  color: var(--gold);
  font-family: 'Silkscreen';
  font-smooth: never;
  -webkit-font-smoothing: none;
  display: flex;
  justify-content: center;
  align-items: center;
}
canvas {
  image-rendering: -moz-crisp-edges;
  image-rendering: -webkit-crisp-edges;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
#game-container {
  position: relative;
}
#game-canvas, #ui-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}
#ui-overlay {
  pointer-events: none;
  text-shadow: 0.1rem 0.1rem #00000066;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  font-family: 'Silkscreen';
}
.ui-element { pointer-events: auto; }

.menu-container::-webkit-scrollbar,
.modal-container::-webkit-scrollbar,
.placar-overlay::-webkit-scrollbar {
    display: none;
}
.menu-container, .modal-container, .placar-overlay {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

@keyframes slideUpFadeIn {
  from { opacity: 0; transform: translateY(1rem) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes titleLetterPop {
    0% { transform: scale(0); opacity: 0; }
    80% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}
@keyframes elementFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes fadeOutOnly {
    from { opacity: 1; }
    to { opacity: 0; }
}
.animated-entry { animation: slideUpFadeIn 0.5s ease-out forwards; }
.temp-message.fade-out { animation: fadeOutOnly 0.5s ease-in forwards; }

.loading-container {
    width: 60%;
    max-width: 20rem;
    height: 0.5rem;
    background-color: var(--gold-transparent);
    border-radius: 0.25rem;
    overflow: hidden;
    border: 1px solid var(--gold-transparent);
}
.loading-bar {
    width: 100%;
    height: 100%;
    background-color: var(--gold);
    animation: loading-indeterminate 2s infinite cubic-bezier(0.65, 0, 0.35, 1);
    transform-origin: left;
}
@keyframes loading-indeterminate {
    0% { transform: translateX(-100%) scaleX(0.1); }
    50% { transform: translateX(0%) scaleX(0.8); }
    100% { transform: translateX(100%) scaleX(0.1); }
}

.button {
    font-family: 'Silkscreen';
    background-color: transparent;
    color: var(--gold);
    border: 2px solid var(--gold);
    border-radius: 5px;
    padding: 0.7rem 1.5rem;
    cursor: pointer;
    font-weight: bold;
    font-size: clamp(0.9rem, 2.5vw, 1.2rem);
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.2s ease-in-out;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    text-shadow: 1px 1px 2px var(--green-dark);
    display: inline-flex;
    justify-content: center;
    align-items: center;
}
.button:hover {
    background-color: var(--gold);
    color: var(--green-dark);
    box-shadow: 0 4px 15px var(--shadow-color);
    transform: translateY(-2px);
}
.button:active {
    transform: scale(0.98) translateY(1px);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.btn-icon {
    margin-right: 0.5em;
}

.modal-container, .placar-overlay {
    background-color: rgba(26, 46, 40, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 2px solid var(--gold-transparent);
    box-shadow: 0 0 30px var(--shadow-color);
    padding: 2rem;
    width: 90%;
    max-width: 30rem;
    max-height: 90vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    border-radius: 15px;
    pointer-events: auto;
    transition: border-color 0.3s ease;
}
.modal-container:hover, .placar-overlay:hover {
    border-color: var(--gold);
}
.modal-container h2, .placar-overlay h2 {
    font-family: 'Silkscreen';
    font-size: clamp(1.1rem, 3.5vw, 1.6rem);
    margin: 0;
}

.menu-container {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    height: 100%;
    padding: 4rem 1rem 2rem;
    box-sizing: border-box;
    overflow-y: auto;
    gap: 1.5rem;
    pointer-events: auto;
}

.menu-title-zone, .menu-record-zone, .menu-status-zone {
    width: 100%;
}

.menu-title-zone h1 {
    font-family: 'Silkscreen';
    font-size: clamp(1rem, 6.2vw, 3.5rem);
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    line-height: 1.1;
}
.menu-title-zone h1 span {
    display: inline-block;
    opacity: 0;
    animation: titleLetterPop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.menu-title-zone h1 span:nth-child(1) { animation-delay: 0.05s; }
.menu-title-zone h1 span:nth-child(2) { animation-delay: 0.1s; }
.menu-title-zone h1 span:nth-child(3) { animation-delay: 0.15s; }
.menu-title-zone h1 span:nth-child(4) { animation-delay: 0.2s; }
.menu-title-zone h1 span:nth-child(5) { animation-delay: 0.25s; }
.menu-title-zone h1 span:nth-child(6) { animation-delay: 0.3s; }
.menu-title-zone h1 span:nth-child(7) { animation-delay: 0.35s; }
.menu-title-zone h1 span:nth-child(9) { animation-delay: 0.4s; }
.menu-title-zone h1 span:nth-child(10) { animation-delay: 0.45s; }
.menu-title-zone h1 span:nth-child(11) { animation-delay: 0.5s; }
.menu-title-zone h1 span:nth-child(12) { animation-delay: 0.55s; }
.menu-title-zone h1 span:nth-child(13) { animation-delay: 0.6s; }
.menu-title-zone h1 span:nth-child(14) { animation-delay: 0.65s; }
.menu-title-zone h1 span:nth-child(15) { animation-delay: 0.7s; }
.menu-title-zone h1 span:nth-child(16) { animation-delay: 0.75s; }
.menu-title-zone h1 span:nth-child(17) { animation-delay: 0.8s; }
.menu-title-zone h1 span:nth-child(18) { animation-delay: 0.85s; }

.menu-record-zone { 
    font-size: clamp(1rem, 3.5vw, 1.5rem);
    font-weight: bold; 
    letter-spacing: 1px;
    opacity: 0;
    animation: elementFadeIn 0.5s ease-out 0.8s forwards;
}
.menu-buttons-zone {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 80%;
    max-width: 20rem;
}
.menu-buttons-zone .button {
    opacity: 0;
    animation: elementFadeIn 0.5s ease-out forwards;
}
.menu-buttons-zone .button:nth-child(1) { animation-delay: 0.9s; }
.menu-buttons-zone .button:nth-child(2) { animation-delay: 1.0s; }
.menu-buttons-zone .button:nth-child(3) { animation-delay: 1.1s; }
.menu-buttons-zone .button:nth-child(4) { animation-delay: 1.2s; }
.menu-buttons-zone .button:nth-child(5) { animation-delay: 1.3s; }

.menu-status-zone {
    font-size: clamp(0.8rem, 2vw, 1rem);
    letter-spacing: 0.5px;
    opacity: 0;
    animation: elementFadeIn 0.5s ease-out 1.4s forwards;
}
.menu-status-zone .status-text {
    margin: 0;
    font-weight: bold;
}

.placar-content { display: flex; flex-direction: column; gap: 1.5rem; }
.placar-list {
    list-style: none; padding: 0; margin: 0;
    display: flex; flex-direction: column; gap: 0.5rem;
}
.placar-list li {
    display: flex; 
    justify-content: space-between;
    align-items: baseline;
    padding: 0.5rem; border-radius: 4px;
    background: var(--gold-transparent);
    font-size: clamp(0.8rem, 2.2vw, 1rem);
}
.placar-position { font-weight: bold; margin-right: 1em; }
.placar-name { flex-grow: 1; text-align: left; }
.placar-score { font-family: 'Silkscreen'; font-size: clamp(0.8rem, 3vw, 1.2rem); }

.logout-button { background-color: transparent; border-color: #aaa; color: #aaa; }
.logout-button:hover { background-color: #aaa; color: var(--green-dark); border-color: #aaa; }

.placar-form { display: flex; flex-direction: column; gap: 1.2rem; margin-top: 1rem; }
.placar-form h3 { margin: 0 0 0.5rem 0; font-size: clamp(0.8rem, 2.8vw, 1.3rem); }

.input-field {
    font-family: 'Silkscreen';
    background: transparent; border: none;
    border-bottom: 2px solid rgba(252, 211, 77, 0.5);
    color: var(--gold);
    padding: 0.5rem 0.2rem;
    font-size: clamp(0.9rem, 2.5vw, 1.2rem);
    transition: border-color 0.2s ease;
}
.input-field::placeholder { color: rgba(252, 211, 77, 0.6); }
.input-field:focus {
    outline: none;
    border-bottom-color: var(--gold);
}

.button-group { display: flex; gap: 1rem; }
.button-group .button { flex: 1; }

.placar-message { height: 1.2em; font-weight: bold; transition: color 0.3s ease; }
.placar-message.error { color: #ff8a8a; }
.placar-message.success { color: #b2ffb2; }

.placar-timestamp {
    font-size: 0.8rem;
    color: rgba(252, 211, 77, 0.7);
    margin: 0.5rem 0;
    font-style: italic;
    height: 1em;
}

.top-left, .top-right { position: absolute; margin: 0; pointer-events: auto; }
.top-right { top: 1rem; right: 1rem; font-size: clamp(1.1rem, 3.5vw, 1.6rem); }
.top-left { 
    top: 1.5rem; 
    left: 1.5rem;
    padding: 0.5rem;
    cursor: pointer;
    transition: transform 0.2s ease;
    z-index: 10;
}
.top-left:hover {
    transform: scale(1.15);
}
.back-arrow-visual {
    width: 1rem;
    height: 1rem;
    border-top: 0.25rem solid var(--gold);
    border-left: 0.25rem solid var(--gold);
    transform: rotate(-45deg);
}

.skin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(5rem, 1fr));
    gap: 2rem;
    padding: 1rem 0;
    width: 100%;
    justify-items: center;
}
.skin-preview {
    height: clamp(5rem, 18vmin, 10rem); width: auto;
    image-rendering: pixelated; border: 3px solid transparent;
    cursor: pointer; border-radius: 5px; transition: all 0.2s ease;
}
.skin-preview:hover { transform: scale(1.05); }
.skin-preview.selected { border-color: var(--gold); box-shadow: 0 0 15px var(--shadow-color); }

.credits-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    font-size: clamp(1rem, 3vw, 1.5rem);
}
.credits-content .heart {
    color: #f00;
    display: inline-block;
    animation: heart-beat 1.5s infinite;
    font-size: clamp(1.5rem, 5vw, 2.5rem);
}
.credits-content .creator-name {
    font-family: 'Silkscreen';
    font-size: clamp(1rem, 3vw, 1.5rem);
    font-weight: bold;
    color: var(--gold);
}
@keyframes heart-beat {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

.temp-message {
    position: absolute;
    bottom: 5%;
    left: 50%;
    transform: translateX(-50%);
    font-size: clamp(0.9rem, 2.5vw, 1.2rem);
    background-color: rgba(26, 46, 40, 0.9);
    padding: 0.7rem 1.2rem;
    border-radius: 5px;
    border: 2px solid var(--gold);
    pointer-events: none;
    animation: elementFadeIn 0.5s ease-out;
    z-index: 100;
    box-shadow: 0 0 15px var(--shadow-color);
    color: var(--gold);
    text-shadow: 1px 1px 2px var(--green-dark);
}
.temp-message.success {
    border-color: var(--gold);
    color: var(--gold);
    box-shadow: 0 0 15px var(--gold);
}
.temp-message.error {
    border-color: #ff8a8a;
    color: #ff8a8a;
    box-shadow: 0 0 15px #ff8a8a80;
}