@import url('../global.css');

:root {
  --title-color: #f2c96f;
  --camel-sand: #dcae5a;
  --camel-sand-light: #f1d58b;
  --camel-night: #263f43;
  --camel-ink: #4d3522;
  --camel-brass: #c38d38;
}

.camel-up-board[data-visual-theme='arcade'] {
  --camel-sand: #ff4fd8;
  --camel-sand-light: #ff9ce8;
  --camel-night: #1a0f22;
  --camel-ink: #2a1330;
  --camel-brass: #e660b2;
}

.camel-up-board[data-visual-theme='midnight'] {
  --camel-sand: #38bdf8;
  --camel-sand-light: #93d9fb;
  --camel-night: #0b1220;
  --camel-ink: #111927;
  --camel-brass: #5b8aa8;
}

.camel-up-board[data-visual-theme='daylight'] {
  --camel-sand: #a78bfa;
  --camel-sand-light: #e4d7fd;
  --camel-night: #2b1f4a;
  --camel-ink: #3c2e5c;
  --camel-brass: #7c3aed;
}

.camel-up-board[data-visual-theme='amber'] {
  --camel-sand: #fbbf24;
  --camel-sand-light: #fde3a0;
  --camel-night: #1f1305;
  --camel-ink: #2b1a06;
  --camel-brass: #a16b20;
}

.camel-up-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 15rem;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  gap: clamp(0.45rem, 1.1vw, 0.9rem);
}

/* A desert race board: two legs of a caravan road instead of generic columns. */
.camel-up-board {
  display: grid;
  grid-template-columns: repeat(8, minmax(3rem, 1fr));
  grid-auto-rows: minmax(0, 1fr);
  align-content: stretch;
  min-height: 0;
  height: 100%;
  padding: clamp(0.35rem, 1vw, 0.8rem);
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 15%, rgb(255 228 135 / 25%), transparent 21%),
    radial-gradient(circle at 84% 84%, rgb(81 48 21 / 24%), transparent 27%),
    repeating-linear-gradient(0deg, rgb(255 240 183 / 8%) 0 1px, transparent 1px 1.2rem),
    linear-gradient(135deg, #936334, #c28a42 45%, #724727);
  border: 0.18rem solid #6b4426;
  border-radius: 1rem;
  box-shadow:
    0 1rem 2rem rgb(0 0 0 / 38%),
    inset 0 0 0 0.12rem rgb(255 224 139 / 42%);
}

.camel-up-cell {
  display: flex;
  position: relative;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.12rem;
  min-height: 0;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 70% 18%, rgb(255 244 184 / 44%) 0 3%, transparent 4%),
    repeating-linear-gradient(145deg, transparent 0 0.82rem, rgb(128 79 37 / 13%) 0.86rem 0.92rem),
    linear-gradient(145deg, var(--camel-sand-light), var(--camel-sand));
  border: 0.13rem solid #81502b;
  border-radius: 0.5rem;
  box-shadow:
    inset 0 0 0 1px rgb(255 245 193 / 44%),
    inset 0 -0.2rem 0.3rem rgb(94 55 26 / 16%);
}

.camel-up-cell::after {
  content: '';
  position: absolute;
  inset: 0.17rem;
  pointer-events: none;
  border: 1px dashed rgb(110 67 31 / 28%);
  border-radius: 0.32rem;
}

.camel-up-cell:nth-child(8n + 1) {
  box-shadow:
    inset 0 0 0 0.14rem rgb(255 243 171 / 56%),
    inset 0 -0.2rem 0.3rem rgb(94 55 26 / 16%);
}

.camel-up-number {
  z-index: 1;
  align-self: flex-start;
  margin: 0.28rem 0 0 0.34rem;
  color: #5b3b22;
  font-family: Georgia, serif;
  font-size: clamp(0.65rem, 1.25vw, 0.82rem);
  font-weight: 800;
  line-height: 1;
  text-shadow: 0 1px rgb(255 239 174 / 74%);
}

.camel-up-token {
  --camel-color: #d97706;
  z-index: 1;
  display: grid;
  width: clamp(1.65rem, 3vw, 2.45rem);
  height: clamp(1.65rem, 3vw, 2.45rem);
  place-items: center;
  margin-top: -0.25rem;
  border: 0.15rem solid color-mix(in srgb, var(--camel-color) 68%, #fff0b2);
  border-radius: 50% 50% 42% 42%;
  background:
    radial-gradient(circle at 33% 23%, rgb(255 255 238 / 67%) 0 9%, transparent 10%),
    linear-gradient(145deg, color-mix(in srgb, var(--camel-color) 82%, white), var(--camel-color));
  color: initial;
  font-size: clamp(1.05rem, 2.3vw, 1.75rem);
  line-height: 1;
  text-shadow: 0 0.1rem 0.1rem rgb(51 28 11 / 55%);
  box-shadow:
    0 0.14rem 0.2rem rgb(72 39 15 / 34%),
    inset 0 0 0 1px rgb(255 245 203 / 42%);
  transform: translateY(0);
}

.camel-up-token + .camel-up-token {
  margin-top: -0.65rem;
  transform: translateX(0.22rem);
}

.camel-up-panel {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-height: 0;
  padding: 0.38rem;
  background: linear-gradient(145deg, rgb(255 229 145 / 12%), transparent 38%), #243b3a;
  border: 0.16rem solid #8f6434;
  border-radius: 0.75rem;
  box-shadow: inset 0 0 0 1px rgb(255 223 135 / 14%);
}

.camel-up-actions {
  display: grid;
  gap: 0.34rem;
}

.camel-up-actions button {
  min-height: 2.75rem;
  padding: 0.45rem 0.58rem;
  border: 0.13rem solid #b98a48;
  border-radius: 0.45rem;
  background: linear-gradient(135deg, rgb(255 226 139 / 12%), transparent 52%), #3c3027;
  color: #f7e5ae;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition:
    transform 140ms ease,
    filter 140ms ease,
    box-shadow 140ms ease;
}

.camel-up-actions button:first-child {
  border-color: #ffe18b;
  background: linear-gradient(180deg, #f5c85c, #bd7930);
  color: #342313;
  box-shadow: 0 0.22rem 0.35rem rgb(0 0 0 / 26%);
}

.camel-up-actions button:not(:disabled):hover {
  filter: brightness(1.1);
  box-shadow: 0 0 0 0.12rem rgb(255 218 122 / 22%);
  transform: translateY(-1px);
}

.camel-up-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.camel-up-log {
  flex: 1 1 auto;
  min-height: 0;
  max-height: 14rem;
  padding: 0.38rem;
  overflow: auto;
  border: 1px solid rgb(198 154 79 / 42%);
  border-radius: 0.4rem;
  background: rgb(27 45 43 / 55%);
  color: #dcc48d;
  font-size: 0.78rem;
}

@media (min-width: 768px) and (max-height: 520px) {
  .camel-up-layout {
    grid-template-columns: minmax(0, 1fr) 15rem;
    gap: 0.4rem;
  }

  .camel-up-board {
    padding: 0.3rem;
  }

  .camel-up-cell {
    border-radius: 0.38rem;
  }

  .camel-up-number {
    margin: 0.16rem 0 0 0.22rem;
    font-size: 0.62rem;
  }

  .camel-up-token {
    width: 1.72rem;
    height: 1.72rem;
    font-size: 1.18rem;
  }

  .camel-up-token + .camel-up-token {
    margin-top: -0.58rem;
  }

  .camel-up-panel {
    gap: 0.28rem;
    padding: 0.28rem;
  }

  .camel-up-actions {
    gap: 0.22rem;
  }

  .camel-up-actions button {
    min-height: 2.75rem;
    padding: 0.26rem 0.4rem;
    font-size: 0.76rem;
  }
}

@media (max-width: 700px) {
  .camel-up-layout {
    grid-template-columns: 1fr;
  }

  .camel-up-board {
    height: auto;
    grid-template-columns: repeat(4, 1fr);
  }
}
