/* azul.css — Azul-specific styling (loaded after the shared styles.css). */

:root {
  --c-B: #2f7bd6;   /* blue   */
  --c-Y: #e8c33a;   /* yellow */
  --c-R: #d64545;   /* red    */
  --c-K: #30343d;   /* black  */
  --c-W: #eef1f5;   /* white  */
  --tile: 30px;
  --tile-sm: 22px;
}

/* ------------------------------------------------------------ lobby extras */
.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
  color: var(--muted);
  font-size: 0.9rem;
  margin: 14px 0;
}
.text-input {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--panel-2);
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
}
.count-row { display: flex; gap: 8px; }
.count-btn {
  flex: 1;
  background: var(--panel-2);
  color: var(--text);
  padding: 10px 0;
  font-weight: 700;
  border: 2px solid transparent;
}
.count-btn.selected { border-color: var(--accent); color: var(--accent); }
.mode-btn {
  flex: 1;
  background: var(--panel-2);
  color: var(--text);
  padding: 10px 0;
  font-weight: 600;
  border: 2px solid transparent;
}
.mode-btn.selected { border-color: var(--accent); color: var(--accent); }
.mode-hint { font-size: 0.75rem; color: var(--muted); margin-top: 2px; }
.name-row { display: flex; gap: 8px; }
.name-row .text-input { flex: 1; }
.name-row .ghost { flex: 0 0 auto; font-size: 1.1rem; }

/* --------------------------------------------------------------- layout */
.topbar { justify-content: space-between; }
.azul-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* -------------------------------------------------------------- tiles */
.tile {
  width: var(--tile);
  height: var(--tile);
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.35);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.25);
  flex: none;
}
.tile.tsm { width: var(--tile-sm); height: var(--tile-sm); border-radius: 5px; padding: 0; }
.tile.c-B { background: var(--c-B); }
.tile.c-Y { background: var(--c-Y); }
.tile.c-R { background: var(--c-R); }
.tile.c-K { background: var(--c-K); border-color: #000; }
.tile.c-W { background: var(--c-W); }
.tile.clickable { cursor: pointer; }
.tile.clickable:hover { outline: 2px solid var(--accent-2); outline-offset: 1px; }
.tile.sel { outline: 3px solid var(--accent); outline-offset: 1px; z-index: 1; }
.tile.one {
  display: flex; align-items: center; justify-content: center;
  background: var(--panel-2); color: var(--text);
  font-weight: 700; font-size: 0.8rem;
}

/* ------------------------------------------------------------ factories */
.offer {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}
.factories {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}
.factory {
  background: radial-gradient(circle at 40% 35%, #3a4152, #262c39);
  border: 1px solid var(--panel-2);
  border-radius: 50%;
  padding: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
.factory.empty { opacity: 0.35; }
.factory-grid {
  display: grid;
  grid-template-columns: repeat(2, var(--tile));
  grid-auto-rows: var(--tile);
  gap: 4px;
  min-width: calc(var(--tile) * 2 + 4px);
  min-height: calc(var(--tile) * 2 + 4px);
}
.center-wrap { width: 100%; display: flex; justify-content: center; }
.center {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  max-width: 420px;
  min-height: var(--tile);
  padding: 8px 10px;
  background: var(--panel);
  border: 1px dashed var(--panel-2);
  border-radius: 12px;
}
.center-empty { color: var(--muted); font-size: 0.85rem; }

/* --------------------------------------------------------- mini mats */
.minimats {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 4px;
  -webkit-overflow-scrolling: touch;
}
.minimats:empty { display: none; }
.board.mini {
  --tile-sm: 13px;
  flex: 0 0 auto;
  min-width: 150px;
  padding: 6px 8px;
}
.board.mini .board-head { margin-bottom: 4px; }
.board.mini .pname { font-size: 0.72rem; }
.board.mini .pscore { font-size: 0.95rem; }
.board.mini .board-main { gap: 8px; }
.board.mini .floor { margin-top: 5px; gap: 2px; }
.board.mini .slot, .board.mini .fslot { border-radius: 3px; }

/* flying tile used by the scoring animation */
.tile.flying {
  position: fixed;
  z-index: 9000;
  pointer-events: none;
  margin: 0;
  border-radius: 5px;
}

/* -------------------------------------------------------------- boards */
.boards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
.board {
  background: linear-gradient(180deg, #323a4b, #262c39);
  border: 1px solid #454f64;
  border-radius: 14px;
  padding: 12px;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.4);
}
.board.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent), 0 3px 12px rgba(0, 0, 0, 0.4); }
.board.me .board-head { color: var(--accent-2); }
.board-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}
.pname { font-weight: 700; }
.pscore { font-weight: 700; font-size: 1.3rem; }

.board-main {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  justify-content: space-between;
}

/* pattern lines */
.lines { display: flex; flex-direction: column; gap: 4px; flex: 1 1 auto; }
.line {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
  padding: 2px;
  border-radius: 6px;
}
.line.legal { cursor: pointer; background: var(--place); outline: 1px dashed #6fdc8c; }
.line.legal:hover { background: rgba(120, 220, 140, 0.5); }
.line.pickable { cursor: pointer; background: rgba(86, 182, 255, 0.18); outline: 1px dashed var(--accent-2); }
.line.picked { background: rgba(86, 182, 255, 0.4); outline: 2px solid var(--accent-2); }
.slot {
  width: var(--tile-sm);
  height: var(--tile-sm);
  border-radius: 5px;
  background: #171b23;
  border: 1px solid rgba(0, 0, 0, 0.45);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.5);
}
.slot .tile { border-width: 1px; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.3); }

/* wall */
.wall {
  display: grid;
  grid-template-columns: repeat(5, var(--tile-sm));
  grid-auto-rows: var(--tile-sm);
  gap: 4px;
  flex: none;
}
/* Empty cells are dark, recessed sockets; filled cells are bright and raised. */
.wcell {
  border-radius: 5px;
  background: #171b23;
  border: 1px solid rgba(0, 0, 0, 0.5);
  box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.55);
}
/* standard board: faint colour hint of which tile belongs in an empty cell */
.wcell.off.c-B { background: rgba(47, 123, 214, 0.30); }
.wcell.off.c-Y { background: rgba(232, 195, 58, 0.30); }
.wcell.off.c-R { background: rgba(214, 69, 69, 0.30); }
.wcell.off.c-K { background: rgba(126, 134, 148, 0.32); }
.wcell.off.c-W { background: rgba(238, 241, 245, 0.26); }
/* free board: empty cells stay neutral sockets (base .wcell) */

/* filled cells: solid colour, raised with a light rim */
.wcell.on.c-B { background: var(--c-B); }
.wcell.on.c-Y { background: var(--c-Y); }
.wcell.on.c-R { background: var(--c-R); }
.wcell.on.c-K { background: var(--c-K); }
.wcell.on.c-W { background: var(--c-W); }
.wcell.on {
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
.wcell.target {
  cursor: pointer;
  outline: 2px dashed var(--accent); outline-offset: 1px;
  box-shadow: inset 0 0 0 2px rgba(245, 180, 0, 0.35);
}
.wcell.target:hover { background: rgba(245, 180, 0, 0.3); }

/* floor */
.floor {
  display: flex;
  gap: 4px;
  margin-top: 10px;
  padding: 4px;
  border-radius: 6px;
  flex-wrap: wrap;
}
.floor.legal { cursor: pointer; background: var(--place); outline: 1px dashed #6fdc8c; }
.fslot {
  position: relative;
  width: var(--tile-sm);
  height: var(--tile-sm);
  border-radius: 5px;
  background: #171b23;
  border: 1px solid rgba(0, 0, 0, 0.45);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.5);
  display: flex; align-items: center; justify-content: center;
}
.fslot .pen {
  position: absolute; top: -14px; left: 0; right: 0;
  text-align: center; font-size: 0.6rem; color: var(--muted);
}

/* --------------------------------------------------------- end screen */
.endscreen {
  background: var(--panel);
  border: 1px solid var(--accent);
  border-radius: 14px;
  padding: 18px;
  text-align: center;
}
.endscreen h2 { margin: 0 0 12px; }
.final-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.final-row {
  display: grid;
  grid-template-columns: 24px 1fr auto 48px;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--panel-2);
  border-radius: 8px;
  text-align: left;
}
.final-row.win { outline: 2px solid var(--accent); }
.end-btns { display: flex; gap: 10px; }
.end-btns .primary, .end-btns .secondary { margin-top: 0; }
.fr-rank { color: var(--muted); font-weight: 700; }
.fr-name { font-weight: 600; }
.fr-extra { color: var(--muted); font-size: 0.8rem; }
.fr-score { font-weight: 700; font-size: 1.2rem; text-align: right; }

/* --------------------------------------------------------- responsive */
@media (min-width: 720px) {
  :root { --tile: 34px; --tile-sm: 26px; }
  .board.mini { --tile-sm: 15px; }
  .boards { grid-template-columns: minmax(0, 560px); justify-content: center; }
}
