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

html, body {
  height: 100%;
  background: #0d0f12;
  color: #e8e6df;
  font-family: 'Consolas', 'Menlo', 'Courier New', monospace;
  overflow: hidden;
  user-select: none;
}

#game-wrap {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: grid;
  place-items: center;
}

#game {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: #1a1d23;
  box-shadow: 0 0 0 2px #2a2f38, 0 20px 60px rgba(0,0,0,0.6);
  max-width: 100vw;
  max-height: 100vh;
}

#overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px;
}

#hud-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

#hud-left {
  display: flex;
  gap: 8px;
  align-items: stretch;
  flex-wrap: wrap;
}

.hud-badge,
.hud-bar {
  background: rgba(20,22,28,0.85);
  border: 1px solid #3a4150;
  border-radius: 6px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

#money-value {
  color: #ffd166;
  font-size: 18px;
  font-weight: bold;
  min-width: 36px;
  text-align: right;
}

/* Bundle 2 (sessione 029) — HUD avatar attivo: pillola con badge ruolo + nome. */
.user-badge {
  padding: 6px 10px 6px 6px;
  gap: 8px;
}
.user-badge .user-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-weight: bold;
  font-size: 13px;
  color: #1a1d23;
  background: #cbd1de;
  letter-spacing: 0;
}
.user-badge .user-name {
  color: #e8e6df;
  font-size: 13px;
  letter-spacing: 0.4px;
}
/* Palette per ruolo: corrispondono a window.PLAYER_PALETTES.accent. */
.user-badge.user-valerio { border-color: #d4af37; }
.user-badge.user-valerio .user-mark { background: #d4af37; }
.user-badge.user-patrizio { border-color: #5cb8e8; }
.user-badge.user-patrizio .user-mark { background: #5cb8e8; }
.user-badge.user-mattia { border-color: #c0c0c0; }
.user-badge.user-mattia .user-mark { background: #c0c0c0; }

#rep-value {
  color: #6ee7b7;
  font-size: 16px;
  font-weight: bold;
  min-width: 24px;
  text-align: right;
}

.hud-bar .bar-track {
  width: 90px;
  height: 10px;
  background: #2a303c;
  border: 1px solid #3a4150;
  border-radius: 3px;
  overflow: hidden;
}

.hud-bar .bar-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #6ee7b7, #ffd166);
  transition: width 120ms linear, background 200ms linear;
}

.hud-bar .bar-fill.low {
  background: #ff6b6b;
}

#energy-value {
  color: #cbd1de;
  font-size: 12px;
  min-width: 28px;
  text-align: right;
}

#date-box {
  background: rgba(20,22,28,0.85);
  border: 1px solid #3a4150;
  border-radius: 6px;
  padding: 8px 14px;
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 14px;
}

.hud-label {
  color: #8a93a6;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 1px;
}

#date-value {
  color: #ffd166;
  font-size: 20px;
  font-weight: bold;
}

#day-of-week {
  color: #cbd1de;
}

#clock-value {
  color: #6ee7b7;
  font-size: 16px;
  font-weight: bold;
  margin-left: 6px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.5px;
}

#work-bar {
  position: absolute;
  bottom: 140px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20,22,28,0.92);
  border: 1px solid #6ee7b7;
  border-radius: 6px;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: #cbd1de;
  box-shadow: 0 4px 20px rgba(110,231,183,0.15);
}

#work-bar .work-label {
  color: #6ee7b7;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  font-size: 11px;
}

#work-bar .work-track {
  width: 160px;
  height: 10px;
  background: #2a303c;
  border: 1px solid #3a4150;
  border-radius: 3px;
  overflow: hidden;
}

#work-bar .work-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #6ee7b7, #ffd166);
}

#work-bar .work-hint {
  color: #6a7286;
  font-size: 11px;
  letter-spacing: 0.5px;
}

/* F-001 — colore work-bar per modalità lavoro scelta. */
#work-bar.mode-rush {
  border-color: #ff9f6b;
  box-shadow: 0 4px 20px rgba(255,159,107,0.18);
}
#work-bar.mode-rush .work-label { color: #ff9f6b; }
#work-bar.mode-rush .work-fill {
  background: linear-gradient(90deg, #ff9f6b, #ffd166);
}
#work-bar.mode-quality {
  border-color: #6ec6ff;
  box-shadow: 0 4px 20px rgba(110,198,255,0.18);
}
#work-bar.mode-quality .work-label { color: #6ec6ff; }
#work-bar.mode-quality .work-fill {
  background: linear-gradient(90deg, #6ec6ff, #6ee7b7);
}

#prompt-box {
  position: absolute;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20,22,28,0.92);
  border: 1px solid #ffd166;
  border-radius: 6px;
  padding: 10px 18px;
  font-size: 14px;
  color: #ffd166;
  box-shadow: 0 4px 20px rgba(255,209,102,0.15);
  animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-3px); }
}

#dialog {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: grid;
  place-items: center;
  pointer-events: auto;
}

#dialog[hidden] {
  display: none;
}

.dialog-inner {
  background: #1c2028;
  border: 1px solid #4a5266;
  border-radius: 8px;
  padding: 24px 30px;
  min-width: 360px;
  max-width: 520px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}

#dialog-title {
  color: #ffd166;
  font-size: 18px;
  margin-bottom: 14px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

#dialog-body {
  color: #cbd1de;
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 20px;
}

#dialog-body .big {
  font-size: 28px;
  color: #e8e6df;
  display: block;
  margin: 8px 0;
}

#dialog-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.dialog-btn {
  background: #2a303c;
  border: 1px solid #4a5266;
  color: #e8e6df;
  padding: 8px 16px;
  font-family: inherit;
  font-size: 13px;
  border-radius: 4px;
  cursor: pointer;
}

.dialog-btn.primary {
  background: #ffd166;
  color: #1c2028;
  border-color: #ffd166;
  font-weight: bold;
}

.dialog-btn.selected {
  outline: 2px solid #ffd166;
  outline-offset: 2px;
}

.dialog-btn.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: #20242c;
  color: #6a7286;
  border-color: #3a4150;
}

.dialog-btn.disabled.primary {
  background: #20242c;
  color: #6a7286;
  border-color: #3a4150;
}

#dialog-body .hint {
  display: block;
  margin-top: 10px;
  color: #ff9f6b;
  font-size: 12px;
  letter-spacing: 0.3px;
}

#footer-hint {
  display: flex;
  gap: 18px;
  justify-content: center;
  font-size: 11px;
  color: #6a7286;
  letter-spacing: 0.5px;
}

/* Toast stack (T16) — top-right, sotto al date-box dell'HUD. */
#toast-stack {
  position: absolute;
  top: 80px;
  right: 20px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
  max-width: 280px;
  z-index: 5;
}

.toast {
  background: rgba(20,22,28,0.94);
  border: 1px solid #4a5266;
  border-left-width: 4px;
  border-radius: 5px;
  padding: 10px 14px;
  font-size: 13px;
  color: #e8e6df;
  letter-spacing: 0.3px;
  line-height: 1.35;
  box-shadow: 0 4px 14px rgba(0,0,0,0.45);
  opacity: 0;
  transform: translateX(20px);
  transition: opacity 200ms ease-out, transform 200ms ease-out;
  word-wrap: break-word;
  max-width: 100%;
}

.toast.toast-in {
  opacity: 1;
  transform: translateX(0);
}

.toast.toast-out {
  opacity: 0;
  transform: translateX(20px);
  transition: opacity 400ms ease-in, transform 400ms ease-in;
}

.toast-info    { border-left-color: #6ec6ff; }
.toast-success { border-left-color: #6ee7b7; }
.toast-warn    { border-left-color: #ffd166; }
.toast-error   { border-left-color: #ff6b6b; }

#pad-status.connected {
  color: #6ee7b7;
}
