* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  image-rendering: pixelated;
  user-select: none;
  cursor: url("./assets/artwork/cursor.png"), auto !important;
}

@font-face {
  font-family: HeatSans;
  src: url("assets/fonts/heat_sans.ttf");
}

@font-face {
  font-family: Basis;
  src: url("assets/fonts/basis33.ttf");
}

body {
  font-family: HeatSans, Basis;
  font-size: small;
  text-transform: uppercase;
  background-image: url("assets/artwork/bricks.png");
  background-size: cover;
  text-shadow:
    rgb(0, 0, 0) 4px 0px 0px,
    rgb(0, 0, 0) 3.87565px 0.989616px 0px,
    rgb(0, 0, 0) 3.51033px 1.9177px 0px,
    rgb(0, 0, 0) 2.92676px 2.72656px 0px,
    rgb(0, 0, 0) 2.16121px 3.36588px 0px,
    rgb(0, 0, 0) 1.26129px 3.79594px 0px,
    rgb(0, 0, 0) 0.282949px 3.98998px 0px,
    rgb(0, 0, 0) -0.712984px 3.93594px 0px,
    rgb(0, 0, 0) -1.66459px 3.63719px 0px,
    rgb(0, 0, 0) -2.51269px 3.11229px 0px,
    rgb(0, 0, 0) -3.20457px 2.39389px 0px,
    rgb(0, 0, 0) -3.69721px 1.52664px 0px,
    rgb(0, 0, 0) -3.95997px 0.56448px 0px,
    rgb(0, 0, 0) -3.97652px -0.432781px 0px,
    rgb(0, 0, 0) -3.74583px -1.40313px 0px,
    rgb(0, 0, 0) -3.28224px -2.28625px 0px,
    rgb(0, 0, 0) -2.61457px -3.02721px 0px,
    rgb(0, 0, 0) -1.78435px -3.57996px 0px,
    rgb(0, 0, 0) -0.843183px -3.91012px 0px,
    rgb(0, 0, 0) 0.150409px -3.99717px 0px,
    rgb(0, 0, 0) 1.13465px -3.8357px 0px,
    rgb(0, 0, 0) 2.04834px -3.43574px 0px,
    rgb(0, 0, 0) 2.83468px -2.82216px 0px,
    rgb(0, 0, 0) 3.44477px -2.03312px 0px,
    rgb(0, 0, 0) 3.84068px -1.11766px 0px,
    rgb(0, 0, 0) 3.9978px -0.132717px 0px;
  color: #fff;
  overflow: hidden;
  height: 100vh;
}

.error-dialog {
  min-width: 350px;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
}

.error-dialog .title {
  color: #ef4444;
  font-size: 21px;
}

.error-dialog .message {
  color: #000;
  font-family: Basis;
  font-size: 21px;
  text-shadow: none;
  text-transform: none;
}

.dialog-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.error-dialog button {
  width: 200px;
}

.logo {
  align-items: center;
  justify-content: center;
}

#final {
  background-image: url("assets/artwork/performanceScreen.gif");
  background-size: cover;
}

input,
button,
textarea {
  font-family: Basis;
  font-size: 21px;
  color: #000;
  cursor: url("/assets/artwork/cursor.png") !important;
}

/* Screen management */
.screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

#editing {
  justify-content: flex-start;
  padding-top: 32px;
  overflow-y: auto;
}

.screen.active {
  opacity: 1;
  visibility: visible;
}

.oven {
  background-image: url("assets/artwork/oven.png") !important;
  background-size: cover;
}

.party {
  background-image: url("assets/artwork/performanceScreen.gif") !important;
  background-size: cover;
}

.overlay {
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  z-index: 1000;
}

/* Main Menu */
.menu-container,
.lobby-container {
  text-align: center;
  max-width: 700px;
  padding: 32px;
}

.menu-container h1 {
  font-size: 48px;
  margin-bottom: 16px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.menu-container .subtitle {
  font-size: 16px;
  margin-bottom: 32px;
}

.menu-buttons,
.lobby-buttons {
  display: flex;
  flex-direction: column;
  gap: 16px;
  justify-content: center;
}

/* Tutorial */
.tutorial-content {
  background: rgba(255, 255, 255, 0.1);
  padding: 32px;
  backdrop-filter: blur(15px);
  max-width: 700px;
  margin: 0 16px;
}

.tutorial-content h2 {
  text-align: center;
  margin-bottom: 24px;
  font-size: 32px;
}

.tutorial-steps {
  margin-bottom: 32px;
}

.step {
  margin-bottom: 24px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.1);
}

.step h3 {
  color: #ffd700;
  margin-bottom: 8px;
}

.tutorial-buttons {
  display: flex;
  gap: 16px;
  justify-content: center;
  min-width: 200px;
}

/* Buttons */
.primary-button,
.secondary-button {
  padding: 12px 24px;
  cursor: pointer;
  transition: all 0.3s ease;
}

/* Selection Screen */
.selection-header {
  display: flex;
  align-items: center;
  gap: 32px;
  margin-bottom: 32px;
}

.selection-header h2 {
  font-size: 32px;
}

.countdown {
  background: #ff4757;
  padding: 8px 16px;
  font-size: 24px;
  font-weight: bold;
  min-width: 120px;
  text-align: center;
}

.sound-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 24px;
  margin-bottom: 32px;
  max-width: 600px;
}

.sound-option {
  position: relative;
  width: 100px;
  height: 100px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  cursor: pointer;
  transition: all 0.3s ease;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.sound-option:hover {
  border-color: #ffd700;
  transform: scale(1.05);
}

.sound-option.selected {
  border-color: #4caf50;
  background: rgba(76, 175, 80, 0.3);
}

.sound-option.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.sound-option img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sound-skeleton {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #f0f0f0 25%, transparent 37%, #f0f0f0 63%);
  background-size: 400% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
}

@keyframes skeleton-loading {
  0% {
    background-position: 100% 50%;
  }
  100% {
    background-position: -100% 50%;
  }
}

.selection-footer {
  display: flex;
  align-items: center;
  gap: 32px;
}

.selected-count {
  font-size: 19.2px;
}

/* Sound Replacement Screen */
.replacement-container {
  text-align: center;
  max-width: 800px;
  width: 100%;
  padding: 0 32px;
}

.replacement-info {
  margin-bottom: 32px;
}

.replacement-info h2 {
  font-size: 32px;
  margin-bottom: 16px;
}

.replacement-info p {
  font-size: 19.2px;
  margin-bottom: 16px;
}

.replacement-target {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 16px;
  font-size: 19.2px;
}

.current-sound {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.1);
  padding: 8px 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  cursor: pointer;
  transition: all 0.3s ease;
}

.current-sound:hover {
  transform: scale(1.05);
  background: rgba(255, 255, 255, 0.2);
}

.current-sound .sound-icon {
  width: 40px;
  height: 40px;
}

.replacement-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-bottom: 32px;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

.replacement-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  width: 100%;
  max-width: 400px;
}

.replacement-selected {
  font-size: 19.2px;
}

/* Performance/Editing Screens */
.phase-header {
  display: flex;
  align-items: center;
  gap: 32px;
  margin-bottom: 32px;
  width: 100%;
  justify-content: center;
}

.phase-header h2 {
  font-size: 32px;
}

/* Sound selection display (used in performance and editing phases) */
.phase-sounds {
  display: flex;
  gap: 32px;
  margin-bottom: 32px;
  justify-content: center;
}

.sound-key {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.key {
  background-color: transparent;
  color: #fff;
  width: 100%;
  height: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19.2px;
  font-weight: bold;
}

.key img {
  width: 100%;
  height: auto;
}

.sound-icon {
  position: relative;
  display: inline-block;
  width: 80px;
  height: 80px;
  object-fit: cover;
  animation: spin 3s linear infinite;
}

.bg-image,
.over-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.over-img {
  z-index: 1;
}

.bg-image {
  overflow: hidden;
  border-radius: 50%;
  background: #000;
  z-index: 0;
  backdrop-filter: brightness(0);
  mask-image: radial-gradient(circle at center, transparent 13%, black 13%);
  -webkit-mask-image: radial-gradient(
    circle at center,
    transparent 13%,
    black 13%
  );
}

/* Phase Container (used by performance, editing, preview, showcase) */
.phase-container,
.preview-container,
.showcase-container {
  text-align: center;
  max-width: 800px;
  width: 100%;
}

/* Timeline and Canvas */
.timeline-container,
.preview-timeline-container,
.showcase-timeline-container {
  margin-bottom: 32px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  overflow: hidden;
  max-width: 800px;
}

/* Editing interface */
.phase-sound-selectable {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 8px;
  transition: background-color 0.2s ease;
}

.phase-sound-selectable:hover {
  background: rgba(255, 255, 255, 0.1);
}

.phase-sound-selectable.selected {
  background: rgba(74, 175, 79, 0.3);
  border: 2px solid #4caf50;
}

canvas {
  display: block;
  background: rgba(0, 0, 0, 0.3);
  cursor: crosshair;
}

#editing-canvas {
  cursor: grab;
}

#editing-canvas:active {
  cursor: grabbing;
}

/* Transport Controls */
.transport-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: rgba(0, 0, 0, 0.3);
  padding: 16px;
  flex-wrap: wrap;
  max-width: 800px;
}

.control-button {
  border: none;
  padding: 12px;
  font-size: 19.2px;
}

.control-button:hover {
  filter: brightness(80%);
}

.control-button.is-disabled,
.control-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(100%);
}

.control-button.is-disabled:hover,
.control-button:disabled:hover {
  filter: grayscale(100%);
}

.play-pause-btn {
  background-image: url("assets/artwork/play.png");
  background-repeat: no-repeat;
  background-position: center center;
  background-size: contain;
  aspect-ratio: 1 / 1;
  width: 48px;
  height: 48px;
  border: none;
  padding: 0;
  background-color: transparent;
}

.play-pause-btn.playing {
  background-image: url("assets/artwork/pauseButton.png");
}

.rewind-btn {
  background-image: url("assets/artwork/rewind.png");
  background-repeat: no-repeat;
  background-position: center center;
  background-size: contain;
  aspect-ratio: 1 / 1;
  width: 48px;
  height: 48px;
  border: none;
  padding: 0;
  background-color: transparent;
}
.progress-container {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
}

#progress-bar,
#edit-progress-bar,
#preview-progress-bar,
#showcase-progress-bar,
#final-progress-bar {
  flex: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.3);
  outline: none;
  cursor: url("./assets/artwork/cursor.png"), auto;
}

#progress-bar::-webkit-slider-thumb,
#edit-progress-bar::-webkit-slider-thumb,
#preview-progress-bar::-webkit-slider-thumb,
#showcase-progress-bar::-webkit-slider-thumb,
#final-progress-bar::-webkit-slider-thumb {
  appearance: none;
  width: 20px;
  height: 20px;
  background: #4caf50;
  cursor: url("./assets/artwork/cursor.png"), auto;
}

#time-display,
#edit-time-display,
#preview-time-display,
#showcase-time-display,
#final-time-display {
  font-family: Basis;
  font-size: 20px;
  min-width: 80px;
}

/* Final Screen */
.final-buttons {
  margin-top: 32px;
  display: flex;
  gap: 16px;
}

/* Responsive Design */
@media (max-width: 768px) {
  .menu-container h1 {
    font-size: 32px;
  }

  .menu-buttons {
    flex-direction: column;
    gap: 16px;
  }

  .sound-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
  }

  .sound-option {
    width: 80px;
    height: 80px;
  }

  canvas {
    width: 100%;
    max-width: 600px;
  }

  .transport-controls {
    flex-wrap: wrap;
  }

  .phase-sounds {
    gap: 16px;
  }
}

/* Key press animations */
.key.pressed {
  transform: scale(0.92);
  transition: all 0.1s ease;
}

/* Lobby-specific styles */
.form-group {
  margin-bottom: 24px;
  text-align: left;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: bold;
}

.form-group input {
  width: 100%;
  padding: 12px;
  background: rgba(255, 255, 255, 0.9);
  color: #333;
}

.form-group input:focus {
  outline: none;
  background: rgba(255, 255, 255, 1);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3);
}

.connection-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 32px;
  font-size: 14.4px;
  opacity: 0.8;
}

.connection-status .connected {
  color: #4ade80;
}

.connection-status .disconnected {
  color: #ef4444;
}

.players-list {
  background: rgba(255, 255, 255, 0.1);
  padding: 24px;
  margin-bottom: 32px;
}

.players-list h3 {
  margin-bottom: 16px;
}

.player-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  margin-bottom: 8px;
  background: rgba(255, 255, 255, 0.1);
}

.player-name {
  font-weight: bold;
}

.player-status {
  font-size: 14.4px;
  opacity: 0.8;
}

.player-status.ready {
  color: #4ade80;
}

.lobby-info {
  background: rgba(255, 255, 255, 0.1);
  padding: 16px;
  margin-bottom: 32px;
  font-size: 14.4px;
}

.lobby-info p {
  margin-bottom: 8px;
}

.lobby-info strong {
  user-select: all;
}

.lobby-info p:last-child {
  margin-bottom: 0;
}

.game-starting {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.9);
  padding: 32px;
  text-align: center;
  z-index: 1001;
}

.countdown-circle {
  width: 80px;
  height: 80px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 16px auto 0;
  font-size: 32px;
  font-weight: bold;
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
  }
}

/* Waiting for Players Screen */
.waiting-container {
  text-align: center;
  max-width: 600px;
  width: 100%;
  padding: 32px;
}

.waiting-info {
  margin-bottom: 32px;
}

.waiting-info p {
  font-size: 17.5px;
  margin-bottom: 16px;
  opacity: 0.9;
}

.round-info {
  padding: 8px 16px;
  display: inline-block;
  font-weight: bold;
}

.loading-spinner {
  margin-top: 32px;
}

.spinner {
  background-image: url(assets/artwork/loading1.png);
  background-size: cover;
  width: 80px;
  height: 80px;
  animation: spin 1s linear infinite;
  margin: 0 auto;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Phase info sections */
.phase-info {
  margin-bottom: 32px;
}

.phase-info p {
  font-size: 17.6px;
  margin-bottom: 8px;
  opacity: 0.9;
}

/* Phase instruction text */
.phase-instructions {
  font-size: 17.6px;
  margin-bottom: 32px;
  opacity: 0.9;
}

/* Phase buttons */
.phase-buttons {
  margin-top: 32px;
}

.song-navigation {
  background: rgba(255, 255, 255, 0.1);
  padding: 16px;
  margin-bottom: 16px;
}

.song-info {
  margin-top: 8px;
  font-size: 14.4px;
  opacity: 0.8;
}

.nes-btn {
  cursor: url("assets/artwork/cursor.png");
}

.nes-btn :hover {
  cursor: url("assets/artwork/cursor.png");
}

/* Notification System using Toastify */
.toastify {
  padding: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  cursor: url("assets/artwork/cursor.png") !important;
  font-family: Basis;
}

.toastify .message {
  display: inline-block;
  pointer-events: auto;
  transition: transform 0.2s ease;
}

.toastify:hover .message {
  transform: translateX(-5px);
}

.toastify .nes-balloon {
  font-family: Basis;
  font-size: 18px;
  margin-bottom: 15px;
  text-shadow: none;
  text-transform: none;
  color: #212529;
  max-width: 350px;
  word-wrap: break-word;
  pointer-events: auto;
  cursor: pointer;
}

.toastify.on {
  opacity: 1;
}

@media (max-width: 768px) {
  .toastify .nes-balloon {
    max-width: calc(100vw - 60px);
  }
}
