/* product_of_war.css — one stylesheet for the lobby and the game page. */

* { box-sizing: border-box; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  margin: 0 auto;
  max-width: 880px;
  padding: 1rem;
  color: #1c1c1e;
  background: #f4f1ea;
}

h1 { margin: 0.2rem 0; }
h2 { margin: 0.3rem 0 0.6rem; font-size: 1.1rem; }
h3 { margin: 0.2rem 0; font-size: 1rem; }

.Centered { text-align: center; }

.TitleWar { color: #a33; }
.Tagline { color: #666; margin: 0.2rem 0 1rem; }
.Hint { color: #777; font-size: 0.85rem; }
.ErrorNote { color: #a33; font-weight: 600; }

.Panel {
  background: #fff;
  border: 1px solid #ddd6c8;
  border-radius: 8px;
  padding: 1rem;
  margin: 0 auto 1rem;
  max-width: 560px;
}

.CreateForm label { display: block; margin-bottom: 0.3rem; }
.CreateForm input {
  font-size: 1rem;
  padding: 0.4rem 0.6rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  margin-right: 0.5rem;
}

button {
  font-size: 0.95rem;
  padding: 0.45rem 1rem;
  border: 1px solid #999;
  border-radius: 6px;
  background: #efe9dc;
  cursor: pointer;
}
button:hover:not(:disabled) { background: #e4dcc9; }
button:disabled { opacity: 0.45; cursor: default; }

.RoomList { margin: 0 auto; border-collapse: collapse; }
.RoomList th, .RoomList td { padding: 0.35rem 0.9rem; text-align: left; }
.RoomCode {
  font-family: ui-monospace, monospace;
  font-weight: 700;
  letter-spacing: 0.15em;
  background: #efe9dc;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
}
.JoinLink { color: #a33; }

/* ---------- game page ---------- */

#StatusLine {
  min-height: 1.6rem;
  font-weight: 600;
  margin: 0.4rem 0 0.8rem;
}

#Battlefield {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.PlayerSide {
  background: #fff;
  border: 2px solid #ddd6c8;
  border-radius: 8px;
  padding: 0.6rem 0.9rem;
  min-width: 240px;
  flex: 1 1 260px;
  max-width: 380px;
}
.PlayerSide.Active { border-color: #a33; }
.PlayerSide.Mine { background: #fdfbf5; }

/* Three or more players at the table: smaller panels wrap into rows. */
#Battlefield.Multi .PlayerSide { min-width: 200px; flex: 1 1 200px; }

.CreatorMark { color: #c90; }
.Offline { color: #999; font-weight: 400; font-size: 0.8rem; }
.HandCount { color: #777; font-weight: 400; font-size: 0.8rem; }

.Characters {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.4rem;
}

.Character {
  flex: 1;
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 0.4rem;
  font-size: 0.8rem;
}
.Character.Selectable { cursor: pointer; }
.Character.Selectable:hover { border-color: #a33; background: #faf5ea; }
.Character.Selected { border-color: #a33; background: #f7e8e8; box-shadow: 0 0 0 2px #a33; }
.Character.Dead { opacity: 0.45; background: #eee; }

.CharName { font-weight: 600; margin-bottom: 0.25rem; }

.HealthBar {
  height: 0.5rem;
  background: #e5e0d3;
  border-radius: 4px;
  overflow: hidden;
}
.HealthFill { height: 100%; background: #4a7; }
.HealthFill.Low { background: #c44; }
.HealthText { margin-top: 0.2rem; color: #555; }

/* dice vs card vs power strip */

#DiceArea {
  margin: 0.8rem 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 1.2rem;
}
.PlayedCard.Red { color: #c0392b; }
.Die, .PlayedCard, .Power {
  display: inline-block;
  min-width: 2.2rem;
  padding: 0.2rem 0.5rem;
  border: 2px solid #999;
  border-radius: 8px;
  background: #fff;
  font-weight: 700;
  text-align: center;
}
.Power { min-width: 3.5rem; color: #a33; }
.DieLabel { color: #666; }
.DefenseLabel { font-size: 0.9rem; font-weight: 600; color: #555; }

#Actions { margin: 0.6rem 0; display: flex; gap: 0.5rem; justify-content: center; flex-wrap: wrap; }

#HandArea { margin: 0.6rem 0; }
.Hand { display: flex; gap: 0.4rem; justify-content: center; flex-wrap: wrap; min-height: 3.2rem; }
/* Hand cards are little playing cards: white face, corner label,
   big centre suit. Ink colour rides on RedSuit/BlackSuit. */
.Card {
  position: relative;
  width: 3rem;
  height: 4.2rem;
  border-radius: 6px;
  background: #fff;
  border: 1px solid #999;
  box-shadow: 0 2px 2px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  padding: 0;
}
.Card.RedSuit { color: #c0392b; }
.Card.BlackSuit { color: #1a1a1a; }
.Card .Corner {
  position: absolute;
  top: 2px;
  left: 4px;
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1;
}
.Card .BigSuit {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.7rem;
}
.Card.Selected { border-color: #a33; box-shadow: 0 0 0 2px #a33; transform: translateY(-4px); }

#LogArea { margin: 0.8rem auto; max-width: 640px; }
.Log {
  background: #fff;
  border: 1px solid #ddd6c8;
  border-radius: 8px;
  padding: 0.6rem 0.9rem;
  max-height: 16rem;
  overflow-y: auto;
  text-align: left;
  font-size: 0.85rem;
}
.Log p { margin: 0.25rem 0; color: #666; }
.Log p.Latest { color: #1c1c1e; font-weight: 600; }

#ErrorToast {
  position: fixed;
  bottom: 1.2rem;
  left: 50%;
  transform: translateX(-50%);
  background: #a33;
  color: #fff;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  max-width: 90%;
}

/* Only the visible overlay gets the flex layout — a plain display:flex
   here would override the hidden attribute's display:none and pin the
   overlay on screen forever. */
#NameOverlay:not([hidden]) {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
}
#NameOverlay .Panel { max-width: 320px; }
#NameOverlay label { display: block; margin-bottom: 0.3rem; }
#NameOverlay input {
  font-size: 1rem;
  padding: 0.4rem 0.6rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  margin-right: 0.5rem;
  width: 60%;
}
