@import url('https://fonts.googleapis.com/css2?family=Nova+Square&family=Caveat:wght@400;700&display=swap');

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  font-family: 'Nova Square', monospace;
  background-color: #1a0f08;
  background-image: url('resources/images/background.png');
  background-size: cover;
  background-position: center;
  touch-action: none;
  color: #2e2e2e;
}

/* Allow normal touch interactions on UI overlays and buttons */
.title-overlay, .pause-overlay, .player-config-overlay,
.game-info, .pause-button, button, input, select {
  touch-action: auto;
}

canvas {
  display: block;
}




/* loading banner */
.loadingclass {
  background-color: black;
  color: white;
  text-align: center;
  font-size: x-large;
  padding: 25px;
  position: absolute;
  width:500px;
  left: 50%;
  top: 50%;
  -webkit-transform: translate(-50%, -50%);
  transform: translate(-50%, -50%);
}

/* Loading animations */
progress {
  border-radius: 7px;
  width: 100%;
  height: 20px;
  /* margin-left: -11.5%; */
  
}

progress::-webkit-progress-bar {
  background-color: white;
  border-radius: 50px;
  box-shadow: inset 25px 25px 25px -25px rgba(0,0,0,0.85);
  border: darkslategrey solid 2px
}

progress::-webkit-progress-value {
  background-color: lime;
  border-radius: 50px;
}

.title-overlay {
  position: fixed;
  inset: 0;
  background: transparent;
  z-index: 99;
  display: flex;
  justify-content: center;
  align-items: center;
}

.pause-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 5, 2, 0.65);
  z-index: 99;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Lined paper card — matches the in-game paper aesthetic */
.title-card,
.pause-card {
  background-color: #fdf9f2;
  background-image:
    /* Edge vignette — matches canvas paper inset shadow */
    linear-gradient(to bottom, rgba(0,0,0,0.13) 0px, transparent 55px),
    linear-gradient(to top,    rgba(0,0,0,0.13) 0px, transparent 55px),
    linear-gradient(to right,  rgba(0,0,0,0.13) 0px, transparent 55px),
    linear-gradient(to left,   rgba(0,0,0,0.13) 0px, transparent 55px),
    /* Ruled lines */
    linear-gradient(rgba(100, 132, 210, 0.36) 1px, transparent 1px),
    linear-gradient(to right,
      transparent 46px,
      rgba(198, 70, 70, 0.38) 46px,
      rgba(198, 70, 70, 0.38) 48px,
      transparent 48px);
  background-size: 100% 100%, 100% 100%, 100% 100%, 100% 100%, 100% 40px, 100% 100%;
  background-position: 0 0, 0 0, 0 0, 0 0, 0 20px, 0 0;
  border: none;
  border-radius: 0;
  /* Shadow matches canvas paper: offset down-right like lifted paper */
  filter:
    drop-shadow(8px 32px 40px rgba(0,0,0,0.90))
    drop-shadow(3px 6px 8px rgba(0,0,0,0.60));
  /* Rough torn-paper edge — baked polygon with ~12 points per side */
  clip-path: polygon(
    0%    1.0%,  8%  0.2%,  17%  1.4%,  25%  0.5%,  34%  1.1%,
    42%   0.1%,  50%  1.6%,  58%  0.4%,  67%  1.2%,  75%  0.0%,
    83%   1.5%,  91%  0.6%,  100% 0.9%,
    99.3% 9%,   100% 18%,  99.1% 27%,  100% 36%,
    99.4% 45%,  100% 54%,  99.2% 63%,  100% 72%,
    99.5% 81%,  99.1% 90%,
    100%  99.1%, 91%  100%, 83%  99.2%, 75%  99.8%,
    67%   99.0%, 58%  99.6%, 50%  100%, 42%  99.3%,
    34%   99.8%, 25%  99.1%, 17%  99.7%, 8%   99.2%, 0%   100%,
    0.8%  91%,  0.0%  82%,  1.4%  73%,  0.3%  64%,
    1.1%  55%,  0.0%  46%,  1.2%  37%,  0.4%  28%,
    1.5%  19%,  0.2%  10%
  );
  padding: 20px 28px 24px 62px;
  width: min(400px, calc(100vw - 40px));
  max-width: 400px;
  color: #1e1a16;
  font-family: 'Caveat', cursive;
  font-size: 20px;
  text-align: left;
  line-height: 40px;
  box-sizing: border-box;
}

.title-card h1 {
  font-family: 'Caveat', cursive;
  font-size: 58px;
  font-weight: 700;
  color: #111;
  margin: 0;
  line-height: 80px;
  letter-spacing: -1px;
}

.pause-card h2 {
  font-family: 'Caveat', cursive;
  font-size: 42px;
  font-weight: 700;
  color: #111;
  margin: 0;
  line-height: 40px;
}

.game-info {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(253, 250, 242, 0.97);
  border: 1px solid rgba(160, 130, 90, 0.5);
  border-radius: 4px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.45), 2px 2px 0 rgba(0,0,0,0.08);
  padding: 10px 12px;
  z-index: 98;
  width: auto;
  text-align: left;
  font-family: 'Caveat', cursive;
  font-size: 16px;
}

/* Control rows sit on the ruled lines */
.title-card .control-row,
.pause-card .control-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  min-height: 40px;
  justify-content: flex-start;
}

/* Labels look like pencil annotations */
.title-card label {
  font-family: 'Caveat', cursive;
  font-size: 20px;
  color: #3a3228;
  font-weight: 400;
  white-space: nowrap;
}

/* Inputs and selects look like values written into the form */
.title-card input,
.title-card select {
  background: transparent;
  border: none;
  border-bottom: 1.5px solid rgba(30, 60, 160, 0.45);
  border-radius: 0;
  font-family: 'Caveat', cursive;
  font-size: 22px;
  font-weight: 700;
  color: #1a3fc0;
  padding: 0 4px;
  min-width: 0;
  width: auto;
  box-shadow: none;
  outline: none;
  cursor: pointer;
}

/* Todo-list style pickers */
.todo-picker {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.todo-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: transparent;
  border: none;
  padding: 0;
  height: 40px;
  font-family: 'Caveat', cursive;
  font-size: 20px;
  font-weight: 400;
  color: #1e1a16;
  cursor: pointer;
  text-align: left;
  touch-action: auto;
  transition: color 0.1s;
}

/* Hand-drawn checkbox */
.todo-item::before {
  content: '';
  width: 16px;
  height: 16px;
  border: 2px solid rgba(0, 0, 0, 0.35);
  border-radius: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 12px;
  line-height: 1;
  color: transparent;
  transition: border-color 0.1s, background 0.1s, color 0.1s;
}

.todo-item.active {
  color: #1e1a16;
  font-weight: 700;
}

.todo-item.active::before {
  content: '✓';
  border-color: rgba(0, 0, 0, 0.70);
  color: #1e1a16;
  background: rgba(0, 0, 0, 0.04);
}

.todo-item:hover {
  color: #000;
}

/* Todo items override the general .title-card button border */
.title-card .todo-item {
  border: none;
  height: 40px;
  padding: 0;
  min-width: 0;
  font-weight: 400;
  color: #1e1a16;
}

.title-card .todo-item.active {
  color: #1e1a16;
}

/* Buttons look like hand-drawn boxes — felt-tip outline */
.title-card button,
.pause-card button {
  background: transparent;
  border: 2px solid rgba(25, 55, 170, 0.65);
  border-radius: 3px;
  font-family: 'Caveat', cursive;
  font-size: 20px;
  font-weight: 700;
  color: #1a3fc0;
  padding: 0 20px;
  height: 36px;
  cursor: pointer;
  min-width: 90px;
  box-shadow: none;
  transition: background 0.12s;
}

.title-card button:hover,
.pause-card button:hover {
  background: rgba(25, 55, 170, 0.08);
}

/* Hint text — pencil grey */
.title-overlay small {
  display: block;
  font-family: 'Caveat', cursive;
  font-size: 16px;
  color: #7a6e62;
  line-height: 40px;
  margin: 0;
}

/* Subtitle paragraph */
.title-card p {
  font-family: 'Caveat', cursive;
  font-size: 19px;
  color: #5a4e44;
  margin: 0;
  line-height: 40px;
}

@media (max-width: 768px) {
  .title-card,
  .pause-card {
    width: calc(100vw - 30px);
    padding: 16px 20px 20px 52px;
  }
}

.pause-button {
  position: fixed;
  bottom: 12px;
  right: 12px;
  z-index: 100;
  padding: 0 20px;
  height: 36px;
  background: rgba(253, 250, 242, 0.95);
  border: 2px solid rgba(25, 55, 170, 0.65);
  border-radius: 3px;
  font-family: 'Caveat', cursive;
  font-size: 20px;
  font-weight: 700;
  color: #1a3fc0;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.35);
  transition: background 0.12s;
}

.pause-button:hover {
  background: rgba(240, 236, 220, 0.98);
}


.game-info {
  display: none;
  top: 12px;
  left: auto;
  right: 12px;
  width: auto;
  padding: 8px;
}

@media (max-width: 768px) {
  .title-overlay,
  .pause-overlay,
  .game-info {
    width: calc(100vw - 20px);
    left: 10px;
    right: 10px;
  }

  .pause-button {
    bottom: 10px;
    right: 10px;
  }
}

/* Per-player config overlay */
.player-config-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 5, 2, 0.72);
  z-index: 110;
  display: flex;
  justify-content: center;
  align-items: center;
}

.player-config-card {
  background-color: #fdf9f2;
  background-image:
    /* Edge vignette — matches canvas paper inset shadow */
    linear-gradient(to bottom, rgba(0,0,0,0.13) 0px, transparent 55px),
    linear-gradient(to top,    rgba(0,0,0,0.13) 0px, transparent 55px),
    linear-gradient(to right,  rgba(0,0,0,0.13) 0px, transparent 55px),
    linear-gradient(to left,   rgba(0,0,0,0.13) 0px, transparent 55px),
    /* Ruled lines */
    linear-gradient(rgba(100, 132, 210, 0.36) 1px, transparent 1px),
    linear-gradient(to right,
      transparent 46px,
      rgba(198, 70, 70, 0.38) 46px,
      rgba(198, 70, 70, 0.38) 48px,
      transparent 48px);
  background-size: 100% 100%, 100% 100%, 100% 100%, 100% 100%, 100% 40px, 100% 100%;
  background-position: 0 0, 0 0, 0 0, 0 0, 0 20px, 0 0;
  filter:
    drop-shadow(8px 32px 40px rgba(0,0,0,0.90))
    drop-shadow(3px 6px 8px rgba(0,0,0,0.60));
  clip-path: polygon(
    0%    1.0%,  8%  0.2%,  17%  1.4%,  25%  0.5%,  34%  1.1%,
    42%   0.1%,  50%  1.6%,  58%  0.4%,  67%  1.2%,  75%  0.0%,
    83%   1.5%,  91%  0.6%,  100% 0.9%,
    99.3% 9%,   100% 18%,  99.1% 27%,  100% 36%,
    99.4% 45%,  100% 54%,  99.2% 63%,  100% 72%,
    99.5% 81%,  99.1% 90%,
    100%  99.1%, 91%  100%, 83%  99.2%, 75%  99.8%,
    67%   99.0%, 58%  99.6%, 50%  100%, 42%  99.3%,
    34%   99.8%, 25%  99.1%, 17%  99.7%, 8%   99.2%, 0%   100%,
    0.8%  91%,  0.0%  82%,  1.4%  73%,  0.3%  64%,
    1.1%  55%,  0.0%  46%,  1.2%  37%,  0.4%  28%,
    1.5%  19%,  0.2%  10%
  );
  padding: 20px 28px 28px 62px;
  width: min(340px, calc(100vw - 40px));
  font-family: 'Caveat', cursive;
  color: #1e1a16;
  line-height: 40px;
  box-sizing: border-box;
}

.player-config-card h2 {
  font-family: 'Caveat', cursive;
  font-size: 42px;
  font-weight: 700;
  color: #111;
  margin: 0;
  line-height: 40px;
}

.player-config-card label {
  font-family: 'Caveat', cursive;
  font-size: 20px;
  color: #3a3228;
  white-space: nowrap;
}

.player-config-card button:not(.color-swatch) {
  background: transparent;
  border: 2px solid rgba(25, 55, 170, 0.65);
  border-radius: 3px;
  font-family: 'Caveat', cursive;
  font-size: 20px;
  font-weight: 700;
  color: #1a3fc0;
  padding: 0 24px;
  height: 36px;
  cursor: pointer;
  min-width: 90px;
}

.player-config-card button:not(.color-swatch):hover {
  background: rgba(25, 55, 170, 0.08);
}

.config-swatch-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(3, 40px);
  column-gap: 6px;
  row-gap: 0;
  margin: 0;
  justify-items: center;
  align-items: center;
}

.color-swatch {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  outline: none;
  box-sizing: border-box;
  transition: transform 0.1s;
}

.color-swatch:hover:not(:disabled) {
  transform: scale(1.2);
}

.color-swatch.selected {
  border-color: #fff;
  box-shadow: 0 0 0 2.5px #333;
  transform: scale(1.18);
}

.color-swatch.taken {
  opacity: 0.2;
  cursor: not-allowed;
}

.initials-input {
  background: transparent;
  border: none;
  border-bottom: 1.5px solid rgba(30, 60, 160, 0.45);
  border-radius: 0;
  font-family: 'Caveat', cursive;
  font-size: 22px;
  font-weight: 700;
  color: #1a3fc0;
  width: 52px;
  padding: 0 4px;
  text-align: center;
  outline: none;
  text-transform: uppercase;
}

.hidden {
  display: none !important;
}

.menu-overlay h1 {
  margin: 0 0 10px;
  font-size: 18px;
}

.control-row {
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.control-row label {
  font-weight: 700;
}

.control-row input,
.control-row select,
.control-row button {
  font-size: 14px;
  min-height: 32px;
}

.scoreboard {
  margin-bottom: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.player-chip {
  padding: 4px 10px;
  border-radius: 6px;
  color: #fff;
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  opacity: 0.65;
  transition: opacity 0.2s, transform 0.2s, box-shadow 0.2s;
  font-family: 'Caveat', cursive;
  font-weight: 700;
}

.player-chip.active-player {
  opacity: 1;
  transform: scale(1.08);
  box-shadow: 0 0 0 3px rgba(255,255,255,0.9), 0 3px 8px rgba(0,0,0,0.35);
}

.player-chip .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255,255,255,0.85);
}

.status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-family: 'Caveat', cursive;
  font-size: 15px;
  color: #3a2e26;
}

.status-row button {
  flex: 1;
  min-width: 80px;
}
@media (max-width: 768px) {
  .menu-overlay,
  .game-info {
    width: calc(100vw - 20px);
    padding: 8px;
    font-size: 13px;
  }

  .control-row {
    gap: 6px;
  }
}
