/* ===== MONOPOL — kompletan izgled ===== */

:root {
  --felt: #14532d;
  --felt-dark: #0d3b20;
  --board-bg: #1b3a2a;
  --tile-bg: #e9f0da;
  --tile-line: #1b3a2a;
  --cream: #fbf7ea;
  --cream-2: #f1ead6;
  --red: #e03b3b;
  --red-dark: #b02a2a;
  --green-deep: #21452f;
  --gold: #ffd76a;
  --ink: #20231f;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'Trebuchet MS', 'Segoe UI', Tahoma, sans-serif;
  background: radial-gradient(ellipse at 50% 30%, var(--felt) 0%, var(--felt-dark) 75%);
  color: var(--ink);
  overflow: hidden;
}
.hidden { display: none !important; }
button { font-family: inherit; }
input, select {
  font-family: inherit;
  font-size: 0.95rem;
  padding: 7px 9px;
  border: 2px solid #c9c2ae;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}
input:focus, select:focus { outline: 2px solid var(--red); border-color: var(--red); }

/* ===== Dugmad ===== */
.btn {
  padding: 0.55em 1.15em;
  border: 2px solid transparent;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  background: #e7e0cc;
  color: var(--ink);
  box-shadow: 0 2px 0 rgba(0,0,0,0.25);
  transition: transform 0.08s, filter 0.15s, box-shadow 0.08s;
}
.btn:hover:not(:disabled) { filter: brightness(1.07); }
.btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 0 0 rgba(0,0,0,0.25); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary { background: var(--red); color: #fff; }
.btn.dark { background: var(--green-deep); color: #fff; }
.btn.danger { background: var(--red-dark); color: #fff; }
.btn.ghost { background: transparent; border-color: #9c947d; }
.btn.big { font-size: 1.1rem; padding: 0.7em 1.4em; width: 100%; margin-top: 10px; }
.btn.tiny { font-size: 0.72rem; padding: 0.35em 0.5em; border-radius: 7px; box-shadow: 0 1px 0 rgba(0,0,0,0.2); }
.btn.side { flex: 1; font-size: 0.85rem; padding: 0.55em 0.4em; }
.btn.icon { flex: 0 0 44px; }
.btn.pulse:not(:disabled) { animation: btnpulse 1.4s infinite; }
@keyframes btnpulse {
  0%, 100% { box-shadow: 0 2px 0 rgba(0,0,0,0.25), 0 0 0 0 rgba(255, 215, 106, 0.7); }
  50% { box-shadow: 0 2px 0 rgba(0,0,0,0.25), 0 0 0 9px rgba(255, 215, 106, 0); }
}

/* ===== Početni ekran ===== */
#setup-screen {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow: auto;
}
.setup-card {
  background: var(--cream);
  border-radius: 18px;
  padding: 26px 30px;
  width: min(560px, 96vw);
  max-height: 96vh;
  overflow: auto;
  box-shadow: 0 24px 60px rgba(0,0,0,0.45);
}
.logo {
  display: block;
  text-align: center;
  background: var(--red);
  color: #fff;
  font-size: 2.4rem;
  letter-spacing: 0.28em;
  padding: 10px 6px 10px 14px;
  border-radius: 10px;
  transform: rotate(-1.5deg);
  box-shadow: 0 6px 0 var(--red-dark);
  margin-bottom: 12px;
  text-shadow: 2px 2px 0 rgba(0,0,0,0.2);
}
.tagline { text-align: center; color: #6b6453; margin-bottom: 18px; }
.setup-section { margin: 14px 0; }
.lbl { display: block; font-weight: 700; font-size: 0.85rem; margin-bottom: 6px; color: #555; text-transform: uppercase; letter-spacing: 0.06em; }
.seg { display: flex; gap: 6px; }
.segbtn {
  flex: 1;
  padding: 9px 0;
  font-size: 1.05rem;
  font-weight: 800;
  border: 2px solid #c9c2ae;
  border-radius: 9px;
  background: #fff;
  cursor: pointer;
}
.segbtn.on { background: var(--green-deep); color: #fff; border-color: var(--green-deep); }
#setup-players { display: flex; flex-direction: column; gap: 7px; margin: 12px 0; }
.setup-player { display: flex; gap: 7px; align-items: center; }
.sp-dot { width: 15px; height: 15px; border-radius: 50%; background: var(--pc); flex: 0 0 15px; box-shadow: 0 0 0 2px #fff, 0 0 0 3px #0002; }
.sp-type { flex: 0 0 118px; }
.sp-name { flex: 1; min-width: 0; }
.sp-token { flex: 0 0 64px; font-size: 1.1rem; }
.setup-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.setup-grid select { width: 100%; }
.checks { display: flex; flex-direction: column; gap: 8px; font-size: 0.92rem; color: #444; }
.checks input { width: 16px; height: 16px; accent-color: var(--red); }

/* ===== Glavni raspored ===== */
#game-screen { display: flex; height: 100vh; }
#board-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  min-width: 0;
}
#board {
  --bs: min(calc(100vh - 20px), calc(100vw - 392px));
  width: var(--bs);
  height: var(--bs);
  font-size: calc(var(--bs) * 0.0115);
  display: grid;
  grid-template-columns: 1.55fr repeat(9, 1fr) 1.55fr;
  grid-template-rows: 1.55fr repeat(9, 1fr) 1.55fr;
  background: var(--board-bg);
  border: calc(var(--bs) * 0.012) solid var(--board-bg);
  border-radius: 12px;
  box-shadow: 0 26px 70px rgba(0,0,0,0.5), inset 0 0 0 2px #ffffff22;
  gap: 1.5px;
}

/* ===== Polja ===== */
.tile {
  position: relative;
  background: var(--tile-bg);
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  transition: filter 0.15s;
}
.tile:hover { filter: brightness(1.06); z-index: 3; }
.tile.s-corner { border-radius: 4px; }

.band { position: absolute; z-index: 1; display: flex; align-items: center; justify-content: center; border: 1px solid #0003; }
.s-bottom .band { top: 0; left: 0; right: 0; height: 23%; }
.s-top .band { bottom: 0; left: 0; right: 0; height: 23%; }
.s-left .band { right: 0; top: 0; bottom: 0; width: 23%; }
.s-right .band { left: 0; top: 0; bottom: 0; width: 23%; }

.houses { display: flex; align-items: center; justify-content: center; gap: 1px; font-size: 1em; line-height: 1; }
.s-left .houses, .s-right .houses { flex-direction: column; }
.house, .hotel { filter: drop-shadow(0 1px 1px rgba(0,0,0,0.4)); }
.hotel { font-size: 1.25em; }

.tname {
  position: relative; z-index: 2;
  font-size: 0.84em;
  font-weight: 700;
  text-align: center;
  line-height: 1.12;
  padding: 0.2em 0.15em;
  text-transform: uppercase;
  letter-spacing: 0.01em;
}
.s-bottom .tname { margin-top: 26%; }
.s-top .tname { margin-top: 6%; }
.s-left .tname { margin-top: 12%; padding-right: 25%; }
.s-right .tname { margin-top: 12%; padding-left: 25%; }

.tprice {
  position: absolute; z-index: 2;
  bottom: 5%;
  width: 100%;
  text-align: center;
  font-size: 0.8em;
  font-weight: 600;
  color: #333;
}
.s-top .tprice { bottom: 26%; }
.s-left .tprice { padding-right: 25%; }
.s-right .tprice { padding-left: 25%; }

.ticon {
  position: absolute; z-index: 1;
  top: 50%; left: 50%;
  transform: translate(-50%, -42%);
  font-size: 1.9em;
  opacity: 0.95;
}
.s-left .ticon { margin-left: -12%; }
.s-right .ticon { margin-left: 12%; }
.ticon.q {
  font-size: 3em;
  font-weight: 900;
  color: var(--red);
  opacity: 0.85;
  font-family: Georgia, serif;
}
.ticon.big { font-size: 2.6em; position: static; transform: none; margin-top: 0.1em; }

.t-chance .tname, .t-chest .tname { font-size: 0.7em; color: #444; }
.t-go, .t-jail, .t-parking, .t-gotojail {
  align-items: center; justify-content: center; text-align: center;
}
.corner-big { font-size: 1.15em; font-weight: 900; letter-spacing: 0.04em; margin-top: 0.4em; line-height: 1.05; z-index: 2; }
.t-go .corner-big { color: var(--red); font-size: 1.5em; }
.corner-sub { font-size: 0.66em; color: #555; z-index: 2; }
.pot { font-size: 0.75em; font-weight: 800; color: #9a6b00; z-index: 2; min-height: 1em; }

.own-mark {
  position: absolute; z-index: 4;
  top: 3%; right: 3%;
  width: 0.95em; height: 0.95em;
  border-radius: 50%;
  box-shadow: 0 0 0 2px #fff, 0 1px 3px rgba(0,0,0,0.4);
  pointer-events: none;
  background: transparent;
}
.tile:not(.owned) .own-mark { box-shadow: none; }
.s-left .own-mark { right: auto; left: 3%; }
.s-top .own-mark { top: auto; bottom: 3%; }

.mort-mark {
  display: none;
  position: absolute; z-index: 5;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) rotate(-14deg);
  background: #fff;
  color: var(--red-dark);
  border: 2px solid var(--red-dark);
  font-size: 0.62em;
  font-weight: 900;
  padding: 1px 4px;
  border-radius: 4px;
  letter-spacing: 0.05em;
  pointer-events: none;
}
.tile.mortgaged { filter: grayscale(0.85) brightness(0.92); }
.tile.mortgaged:hover { filter: grayscale(0.6); }
.tile.mortgaged .mort-mark { display: block; }

.tk {
  position: absolute; z-index: 6;
  bottom: 4%; left: 4%; right: 4%;
  display: flex;
  flex-wrap: wrap-reverse;
  justify-content: center;
  gap: 0.1em;
  pointer-events: none;
}
.s-top .tk { bottom: auto; top: 26%; }
.token {
  font-size: 1.5em;
  line-height: 1;
  background: radial-gradient(circle at 35% 30%, #ffffffee, #ffffffbb 60%, #ddd);
  border: 2px solid var(--pc, #333);
  border-radius: 50%;
  padding: 0.08em;
  box-shadow: 0 2px 4px rgba(0,0,0,0.45);
  transition: all 0.12s;
}
.token.active { animation: tokenbounce 0.9s infinite; }
@keyframes tokenbounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-0.18em); }
}

/* ===== Centar table ===== */
#center {
  grid-row: 2 / 11;
  grid-column: 2 / 11;
  background:
    radial-gradient(ellipse at center, #f0f5e4 0%, #dfeacb 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.1em;
  position: relative;
  border-radius: 6px;
}
#brand {
  background: var(--red);
  color: #fff;
  font-size: 2.7em;
  font-weight: 900;
  letter-spacing: 0.22em;
  padding: 0.18em 0.5em 0.18em 0.72em;
  border-radius: 0.18em;
  transform: rotate(-3deg);
  box-shadow: 0 0.14em 0 var(--red-dark), 0 0.5em 1.4em rgba(0,0,0,0.25);
  text-shadow: 0.04em 0.04em 0 rgba(0,0,0,0.25);
  user-select: none;
}
#turn-banner { font-size: 1.25em; font-weight: 700; color: #2c3e2e; min-height: 1.3em; }
#dice-area { display: flex; gap: 1em; }
.die {
  width: 3.4em; height: 3.4em;
  background: #fff;
  border-radius: 0.6em;
  display: grid;
  grid-template: repeat(3, 1fr) / repeat(3, 1fr);
  padding: 0.45em;
  box-shadow: 0 0.18em 0.4em rgba(0,0,0,0.35), inset 0 -0.15em 0 #00000014;
}
.die.blank { opacity: 0.35; }
.die .pip { width: 0.62em; height: 0.62em; background: #1c1c1c; border-radius: 50%; place-self: center; }
.die.rolling { animation: dieshake 0.12s infinite; }
@keyframes dieshake {
  0% { transform: rotate(-7deg) translateY(-0.05em); }
  50% { transform: rotate(6deg) translateY(0.06em); }
  100% { transform: rotate(-4deg); }
}
.die.landed { animation: diepop 0.4s; }
@keyframes diepop { 0% { transform: scale(1.25); } 100% { transform: scale(1); } }
#center-buttons { display: flex; gap: 0.8em; }
#center-buttons .btn { font-size: 1em; }
#center-note { font-size: 0.95em; color: #4a5a47; min-height: 1.4em; text-align: center; padding: 0 1em; }

/* ===== Bočni panel ===== */
#sidebar {
  width: 372px;
  flex: 0 0 372px;
  background: #102a1d;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  box-shadow: -8px 0 28px rgba(0,0,0,0.35);
}
#players-panel { display: flex; flex-direction: column; gap: 8px; overflow: auto; max-height: 46vh; }
.pcard {
  background: rgba(255,255,255,0.07);
  border-left: 5px solid var(--pc);
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
  color: #eef3ee;
  transition: background 0.15s;
}
.pcard:hover { background: rgba(255,255,255,0.13); }
.pcard.now { outline: 2px solid var(--pc); background: rgba(255,255,255,0.14); }
.pcard.out { opacity: 0.38; filter: grayscale(1); }
.pcard.out .pname { text-decoration: line-through; }
.prow1 { display: flex; align-items: center; gap: 7px; }
.ptok { font-size: 1.15rem; }
.pname { font-weight: 700; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge { font-size: 0.68rem; background: #ffffff22; padding: 2px 6px; border-radius: 20px; white-space: nowrap; }
.badge.jail { background: #b02a2a; }
.badge.card { background: #6d4c2f; }
.prow2 { position: relative; margin: 3px 0 4px; }
.pmoney { font-size: 1.05rem; font-weight: 800; color: var(--gold); letter-spacing: 0.02em; }
.cashflash {
  position: absolute;
  right: 4px; top: 0;
  font-weight: 800;
  font-size: 0.95rem;
  animation: cashrise 1.4s forwards;
  pointer-events: none;
}
.cashflash.plus { color: #7cfc9c; }
.cashflash.minus { color: #ff8c8c; }
@keyframes cashrise {
  0% { opacity: 0; transform: translateY(6px); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-16px); }
}
.prow3 { display: flex; flex-wrap: wrap; gap: 3px; min-height: 13px; }
.chip {
  display: inline-block;
  width: 13px; height: 13px;
  border-radius: 3.5px;
  border: 1px solid rgba(0,0,0,0.45);
  box-shadow: inset 0 -2px 0 rgba(0,0,0,0.18);
}
.chip.big { width: 20px; height: 20px; vertical-align: -4px; margin-right: 6px; }
.chip.mort { opacity: 0.35; }
.nochip { font-size: 0.72rem; color: #8fa597; }

#side-actions { display: flex; gap: 6px; }

#log {
  flex: 1;
  min-height: 80px;
  overflow-y: auto;
  background: #0b1f15;
  border-radius: 10px;
  padding: 9px 11px;
  font-size: 0.8rem;
  line-height: 1.5;
  color: #cfe0d4;
  scrollbar-width: thin;
}
.logline { margin-bottom: 2px; }
.logline b { color: #fff; }
.logline.good { color: #a5e8ad; }
.logline.bad { color: #ffaaaa; }
.logline.warn { color: #ffd98a; }
.logline.dim { color: #88a394; }
.logline.turn {
  margin-top: 7px;
  padding-top: 6px;
  border-top: 1px dashed #ffffff2e;
  color: #fff;
  font-weight: 700;
}
.logline.big { font-size: 0.95rem; }

/* ===== Modali ===== */
#modal-root {
  position: fixed; inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
}
.overlay { position: absolute; inset: 0; background: rgba(8, 20, 12, 0.62); backdrop-filter: blur(2px); }
.modal {
  position: relative;
  z-index: 2;
  width: min(460px, 94vw);
  background: var(--cream);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 30px 70px rgba(0,0,0,0.55);
  animation: modalpop 0.22s ease-out;
}
.modal.wide { width: min(680px, 94vw); }
@keyframes modalpop {
  0% { transform: scale(0.92) translateY(10px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}
.mhead {
  background: var(--green-deep);
  color: #fff;
  font-weight: 800;
  font-size: 1.05rem;
  padding: 13px 17px;
  letter-spacing: 0.02em;
}
.mhead.head-chance { background: #f7941d; }
.mhead.head-chest { background: #1d6fd1; }
.mhead.head-debt { background: var(--red-dark); }
.mhead.head-auction { background: #6d4c2f; }
.mhead.head-win { background: linear-gradient(120deg, #c9962a, #ffd76a, #c9962a); color: #4a3000; }
.mbody { padding: 15px 17px; max-height: 66vh; overflow: auto; }
.mfoot {
  padding: 12px 17px;
  background: var(--cream-2);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
  align-items: center;
}
.center-text { text-align: center; }
.big-text { font-size: 1.15rem; }
.dim { color: #777; }
.small { font-size: 0.8rem; }
.warn { color: var(--red-dark); font-weight: 600; }
.card-text { font-size: 1.06rem; line-height: 1.55; text-align: center; padding: 0.5em 0.3em; }
.tile-head-band {
  display: inline-block;
  width: 15px; height: 15px;
  border-radius: 4px;
  margin-right: 9px;
  vertical-align: -2px;
  border: 1px solid rgba(0,0,0,0.25);
  background: #999;
}
.tile-meta { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; font-size: 0.95rem; }
.rent-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.rent-table td { padding: 4px 7px; }
.rent-table tr:nth-child(odd) { background: #00000008; }
.rent-table td:last-child { text-align: right; font-weight: 700; }
.rent-table tr.dim td { color: #777; font-weight: 400; border-top: 1px solid #00000018; }
.prop-list { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; max-height: 38vh; overflow: auto; }
.prop-line { display: flex; align-items: center; gap: 7px; font-size: 0.92rem; }

/* upravljanje nekretninama */
.debt-banner {
  background: #ffe3e3;
  border: 1px solid #e09999;
  color: #7c1d1d;
  padding: 10px 12px;
  border-radius: 9px;
  margin-bottom: 10px;
  font-size: 0.95rem;
}
.man-cash { font-size: 0.88rem; color: #555; margin-bottom: 8px; }
.man-list { display: flex; flex-direction: column; gap: 5px; max-height: 46vh; overflow: auto; }
.man-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #ffffff99;
  border: 1px solid #00000012;
  border-radius: 9px;
  padding: 6px 9px;
}
.man-row.is-mort { background: #f1e4e4; }
.man-name { flex: 1; font-size: 0.88rem; font-weight: 600; }
.man-acts { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }

/* aukcija */
.auc-prop { font-size: 1rem; margin-bottom: 8px; }
.auc-bid { font-size: 1.1rem; margin-bottom: 10px; }
.auc-list { display: flex; flex-direction: column; gap: 4px; }
.auc-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 10px;
  border-radius: 8px;
  background: #00000008;
  font-size: 0.92rem;
}
.auc-row.turn { background: #fff3cf; font-weight: 700; }
.auc-row.high { background: #e2f3e2; border: 1px solid #9c9; }
.auc-row.out { opacity: 0.45; text-decoration: line-through; }
.auc-cash { font-size: 0.85rem; color: #555; margin-right: auto; }
#auc-custom { width: 120px; }

/* trgovina */
.tr-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tr-col { background: #ffffff88; border: 1px solid #00000014; border-radius: 10px; padding: 10px; }
.tr-head { font-weight: 800; margin-bottom: 8px; }
.tr-money { display: block; font-size: 0.88rem; margin-bottom: 8px; }
.tr-money input { width: 92px; padding: 5px 7px; }
.tr-props { display: flex; flex-direction: column; gap: 3px; max-height: 32vh; overflow: auto; margin-bottom: 6px; }
.tr-item { display: flex; align-items: center; gap: 7px; font-size: 0.88rem; cursor: pointer; padding: 2px 0; }
.tr-item input { accent-color: var(--red); }
.tr-review { display: flex; flex-direction: column; gap: 10px; padding: 6px 0; }
.tr-rev-row { display: flex; gap: 10px; font-size: 1rem; align-items: baseline; }
.tr-rev-row > span:first-child { font-weight: 800; flex: 0 0 70px; }

/* kraj igre */
.win-burst { text-align: center; font-size: 2rem; animation: tokenbounce 1.2s infinite; }
.ranks { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; }
.rank-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 9px;
  background: #00000008;
  font-size: 1rem;
}
.rank-row.winner { background: #fff3cf; border: 1px solid #e0c060; font-weight: 800; }
.rank-medal { font-size: 1.2rem; flex: 0 0 30px; }
.rank-val { margin-left: auto; font-weight: 700; color: #555; }

/* pravila */
.rules p { margin-bottom: 9px; font-size: 0.92rem; line-height: 1.5; }

/* ===== Toast ===== */
#toast-root {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  background: #1c1c1c;
  color: #fff;
  padding: 11px 18px;
  border-radius: 11px;
  font-size: 0.92rem;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
  opacity: 0;
  transform: translateY(12px);
  transition: all 0.3s;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* ===== Responsivno ===== */
@media (max-width: 1020px) {
  body { overflow: auto; }
  #game-screen { flex-direction: column; height: auto; min-height: 100vh; }
  #board { --bs: min(96vw, 96vh); }
  #sidebar { width: 100%; flex: none; }
  #players-panel { max-height: none; }
  #log { min-height: 150px; max-height: 220px; }
}
@media (max-width: 560px) {
  .tr-grid { grid-template-columns: 1fr; }
  .setup-grid { grid-template-columns: 1fr; }
}
