@import url('https://fonts.googleapis.com/css2?family=Archivo+Black&family=Nunito:wght@600;700;800;900&display=swap');

:root {
  --coral: #ff4b48;
  --coral-dark: #a52d29;
  --cream: #fff1cf;
  --ink: #3a1f22;
  --aqua: #00a6a6;
  --yellow: #ffd43b;
  --panel: rgba(56, 27, 30, 0.9);
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #83dbdd;
  color: var(--cream);
  font-family: 'Nunito', system-ui, sans-serif;
}

button, input { font: inherit; }
button { cursor: pointer; }

#game-shell, #game {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
}

#game { display: block; image-rendering: pixelated; }

.screen {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  background: radial-gradient(circle at 68% 35%, rgba(255, 222, 98, 0.15), transparent 32%), rgba(46, 18, 23, 0.48);
  backdrop-filter: blur(8px);
  z-index: 20;
}

.screen.active { display: grid; }

#loading { z-index: 40; background: #ef604d; }
#loading p { font-size: 0.8rem; font-weight: 900; letter-spacing: 0.18em; text-transform: uppercase; }

.loader-mark {
  width: 94px;
  height: 94px;
  display: grid;
  place-items: center;
  border: 5px solid var(--cream);
  border-radius: 32% 68% 54% 46%;
  font-family: 'Archivo Black', sans-serif;
  font-size: 2rem;
  animation: bob 1.2s ease-in-out infinite alternate;
}

@keyframes bob { to { transform: translateY(-12px) rotate(4deg); } }

#start-screen {
  background: linear-gradient(120deg, rgba(55, 24, 25, 0.88), rgba(67, 23, 26, 0.38)), url('/assets/yanni-expresion.png') center / cover;
}

.start-card {
  width: min(1040px, calc(100vw - 48px));
  min-height: 570px;
  display: grid;
  grid-template-columns: 1.1fr 0.75fr 0.9fr;
  gap: 34px;
  align-items: center;
  padding: 48px;
  background: rgba(62, 29, 29, 0.88);
  border: 2px solid rgba(255,255,255,0.17);
  border-radius: 34px;
  box-shadow: 0 34px 90px rgba(48, 8, 13, 0.46), inset 0 0 0 8px rgba(255,255,255,0.03);
}

.eyebrow {
  color: var(--yellow);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1 {
  margin: 8px 0 -10px;
  color: var(--coral);
  font-family: 'Archivo Black', sans-serif;
  font-size: clamp(3.4rem, 7vw, 6rem);
  line-height: 0.9;
  letter-spacing: -0.07em;
  text-shadow: 5px 5px 0 var(--cream);
}

.subtitle {
  margin: 18px 0 24px;
  color: var(--cream);
  font-family: 'Archivo Black', sans-serif;
  font-size: 1.45rem;
  text-transform: uppercase;
}

.intro { color: #f6d9c4; line-height: 1.55; font-weight: 700; }

.portrait-wrap {
  position: relative;
  height: 360px;
  align-self: end;
}

.portrait-wrap img {
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: 0;
  width: 270px;
  max-height: 360px;
  object-fit: contain;
  transform: translateX(-50%);
  filter: drop-shadow(0 18px 14px rgba(37, 5, 8, .3));
}

.sun-disc {
  position: absolute;
  left: 50%;
  top: 20px;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: var(--yellow);
  transform: translateX(-50%);
}

.portrait-wrap > span {
  position: absolute;
  z-index: 4;
  right: -12px;
  top: 48px;
  padding: 9px 14px;
  color: var(--ink);
  background: white;
  border: 3px solid var(--ink);
  border-radius: 18px 18px 18px 2px;
  font-weight: 900;
  transform: rotate(5deg);
}

.join-form { display: grid; gap: 16px; }
.join-form label > span, legend { display: block; margin-bottom: 6px; color: #efc3ac; font-size: .68rem; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.join-form input {
  width: 100%;
  padding: 13px 14px;
  color: var(--ink);
  background: var(--cream);
  border: 0;
  border-radius: 12px;
  outline: 3px solid transparent;
  font-weight: 900;
  text-transform: uppercase;
}
.join-form input:focus { outline-color: var(--yellow); }
fieldset { margin: 0; padding: 0; border: 0; }
.color-picker { display: flex; gap: 9px; }
.color-picker button { width: 32px; height: 32px; padding: 0; border: 3px solid transparent; border-radius: 50%; background: var(--swatch); }
.color-picker button:nth-child(1) { --swatch: #ff4b48; }
.color-picker button:nth-child(2) { --swatch: #00a6a6; }
.color-picker button:nth-child(3) { --swatch: #ffd43b; }
.color-picker button:nth-child(4) { --swatch: #8a5cff; }
.color-picker button.selected { border-color: white; box-shadow: 0 0 0 3px var(--swatch); }

.primary-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 16px 18px;
  color: white;
  background: var(--coral);
  border: 0;
  border-radius: 13px;
  box-shadow: 0 7px 0 var(--coral-dark);
  font-family: 'Archivo Black', sans-serif;
  letter-spacing: .04em;
  transition: transform .15s, box-shadow .15s;
}
.primary-button:hover { transform: translateY(-2px); box-shadow: 0 9px 0 var(--coral-dark); }
.primary-button:active { transform: translateY(5px); box-shadow: 0 2px 0 var(--coral-dark); }
.primary-button b { font-size: 1.4rem; }
.connection-message { margin: 4px 0 0; color: #d9ab98; font-size: .75rem; text-align: center; }

.hud { display: none; position: fixed; inset: 0; pointer-events: none; z-index: 10; }
.hud.active { display: block; }
.top-bar { position: absolute; top: 22px; left: 22px; display: flex; gap: 10px; }
.mission-card, .stats-card, .players-panel, .objective-card, .speedometer, .context-action, .controls-tip {
  background: var(--panel);
  border: 1px solid rgba(255,255,255,.14);
  box-shadow: 0 8px 24px rgba(35, 11, 14, .22);
  backdrop-filter: blur(8px);
}
.mission-card { width: 245px; padding: 12px 15px; border-radius: 13px; }
.mini-label, .objective-card small { color: var(--yellow); font-size: .58rem; font-weight: 900; letter-spacing: .13em; }
.mission-card strong { display: block; margin: 2px 0 8px; font-family: 'Archivo Black', sans-serif; font-size: .8rem; }
.progress-track { height: 5px; overflow: hidden; background: rgba(255,255,255,.16); border-radius: 9px; }
.progress-track i { display: block; width: 0; height: 100%; background: var(--yellow); transition: width .2s; }
.stats-card { display: flex; align-items: center; border-radius: 13px; }
.stats-card div { min-width: 85px; padding: 10px 14px; text-align: center; }
.stats-card div + div { border-left: 1px solid rgba(255,255,255,.14); }
.stats-card span { display: block; color: var(--yellow); font-family: 'Archivo Black', sans-serif; font-size: 1.12rem; }
.stats-card small { display: block; font-size: .48rem; letter-spacing: .11em; }

.players-panel { position: absolute; top: 22px; right: 22px; display: grid; grid-template-columns: auto auto; align-items: center; column-gap: 7px; padding: 11px 14px; border-radius: 13px; }
.players-panel span { font-family: 'Archivo Black', sans-serif; font-size: .82rem; }
.players-panel small { grid-column: 2; color: #e9bba7; font-size: .52rem; letter-spacing: .1em; }
.online-dot { width: 8px; height: 8px; grid-row: 1 / 3; background: #71ed78; border-radius: 50%; box-shadow: 0 0 10px #71ed78; }

.objective-card { position: absolute; top: 112px; left: 50%; display: flex; align-items: center; gap: 12px; min-width: 330px; padding: 11px 14px; border-radius: 14px; transform: translateX(-50%); }
.objective-card > div { flex: 1; }
.objective-card strong { display: block; font-size: .82rem; }
.objective-icon { display: grid; place-items: center; width: 34px; height: 34px; color: var(--ink); background: var(--yellow); border-radius: 10px; font-size: 1.25rem; font-weight: 900; }
#objective-distance { color: #f4c7ad; font-family: 'Archivo Black', sans-serif; font-size: .72rem; }

.health { position: absolute; bottom: 27px; left: 24px; display: flex; gap: 4px; font-size: 1.7rem; filter: drop-shadow(0 3px 0 var(--coral-dark)); }
.health span.empty { color: rgba(255,255,255,.25); filter: none; }
.speedometer { position: absolute; right: 25px; bottom: 25px; display: grid; place-items: center; width: 92px; height: 92px; border-radius: 50%; border: 4px solid var(--yellow); }
.speedometer strong { margin-bottom: -11px; font-family: 'Archivo Black', sans-serif; font-size: 2rem; }
.speedometer span { color: var(--yellow); font-size: .55rem; font-weight: 900; }
.context-action { position: absolute; left: 50%; bottom: 104px; display: none; align-items: center; gap: 9px; padding: 9px 13px; border-radius: 12px; transform: translateX(-50%); font-size: .78rem; font-weight: 900; }
.context-action.visible { display: flex; }
kbd { min-width: 27px; padding: 4px 7px; color: var(--ink); background: var(--cream); border: 0; border-radius: 6px; box-shadow: 0 3px 0 #bc9e78; font-family: inherit; font-size: .7rem; font-weight: 900; text-align: center; }
.controls-tip { position: absolute; bottom: 23px; left: 50%; display: flex; gap: 15px; padding: 9px 13px; border-radius: 12px; transform: translateX(-50%); font-size: .62rem; font-weight: 800; }
.controls-tip span { display: flex; align-items: center; gap: 6px; }

.toast { position: absolute; top: 184px; left: 50%; padding: 9px 15px; color: var(--ink); background: var(--yellow); border-radius: 8px; font-weight: 900; opacity: 0; transform: translate(-50%, -8px); transition: .25s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.compact-screen { background: rgba(36, 13, 16, .56); }
.pause-card { width: min(390px, calc(100vw - 40px)); padding: 34px; background: #4c2527; border: 2px solid rgba(255,255,255,.14); border-radius: 28px; box-shadow: 0 28px 80px rgba(30,0,3,.45); text-align: center; }
.pause-card h2 { margin: 8px 0 28px; font-family: 'Archivo Black', sans-serif; font-size: 2rem; line-height: 1; }
.pause-card p { color: #deb4a0; font-size: .8rem; }
.finish-icon { display: block; margin-bottom: 8px; font-size: 3rem; }

@media (max-width: 850px) {
  .start-card { grid-template-columns: 1fr 1fr; min-height: auto; padding: 32px; }
  .portrait-wrap { display: none; }
  h1 { font-size: 4.2rem; }
  .stats-card { display: none; }
  .controls-tip span:nth-child(-n+3) { display: none; }
}

@media (max-width: 570px) {
  .start-card { grid-template-columns: 1fr; width: calc(100vw - 24px); padding: 26px; }
  .brand-block .intro { display: none; }
  h1 { font-size: 3.8rem; }
  .top-bar { left: 12px; top: 12px; }
  .mission-card { width: 200px; }
  .players-panel { right: 12px; top: 12px; }
  .objective-card { top: 84px; min-width: 290px; }
}
