/* Monopoly: interfaccia "sul tavolo". Cartoncino dei contratti, inchiostro del tabellone,
   rosso Monopoli, verde banconota e ottone delle pedine. */
:root {
  --card: #f2e9d0;
  --card-hi: #faf4e2;
  --card-2: #e4d7b4;
  --ink: #1f2a24;
  --ink-2: #545c52;
  --ink-3: #7d8275;
  --rule: rgba(31, 42, 36, 0.2);
  --rule-2: rgba(31, 42, 36, 0.38);
  --red: #a8202a;
  --red-dk: #7f141c;
  --green: #2e5b45;
  --green-dk: #1f4232;
  --brass: #a9802f;
  --brass-hi: #d6ad57;
  --wood: #2a1a12;
  --pos: #2e7a50;
  --neg: #a8202a;

  --serif: 'Bodoni Moda', 'Bodoni 72', Didot, 'Times New Roman', serif;
  --sans: 'Libre Franklin', 'Franklin Gothic', 'Helvetica Neue', Arial, sans-serif;

  --r-card: 6px;
  --r-btn: 4px;
  --lift: 0 1px 0 rgba(255, 255, 255, 0.55) inset, 0 2px 3px rgba(25, 12, 6, 0.28), 0 14px 30px -10px rgba(25, 12, 6, 0.6);
  --paper: linear-gradient(transparent, transparent); /* sostituita all'avvio da una grana generata (ui.js) */
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--wood);
  -webkit-font-smoothing: antialiased;
  user-select: none;
  font-variant-numeric: lining-nums;
}
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
input, select { user-select: text; }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }

#scene { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; touch-action: none; }
#vignette {
  position: fixed; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse 75% 70% at 50% 45%, transparent 55%, rgba(18, 9, 4, 0.55) 100%);
}

/* ---------- materiali ---------- */
.card {
  background: var(--paper), var(--card);
  border: 1px solid rgba(31, 42, 36, 0.28);
  border-radius: var(--r-card);
  box-shadow: var(--lift);
}

.ic { width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.2em; }

.wordmark {
  font-family: var(--serif);
  font-optical-sizing: auto;
  font-weight: 800;
  letter-spacing: 0.16em;
  margin: 0;
  line-height: 1;
}

.money, .bid, .code, .num { font-family: var(--serif); font-variant-numeric: lining-nums tabular-nums; }

/* ---------- pulsanti ---------- */
.btn {
  --bg: transparent; --fg: var(--ink); --bd: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1.5px solid var(--bd); border-radius: var(--r-btn); cursor: pointer;
  padding: 8px 15px; font-weight: 600; font-size: 0.93rem; line-height: 1.2;
  background: var(--bg); color: var(--fg);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.14);
  transition: background-color 0.15s, transform 0.08s, box-shadow 0.08s;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { background-color: color-mix(in srgb, var(--bg) 88%, #000); }
.btn:not(.primary, .green, .gold, .blue):hover:not(:disabled) { background-color: rgba(31, 42, 36, 0.07); }
.btn:active:not(:disabled) { transform: translateY(1px); box-shadow: none; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.primary { --bg: var(--red); --fg: var(--card-hi); --bd: var(--red-dk); }
.btn.green { --bg: var(--green); --fg: var(--card-hi); --bd: var(--green-dk); }
.btn.gold { --bg: var(--brass); --fg: #1d160a; --bd: #82611f; }
.btn.blue { --bg: var(--ink); --fg: var(--card-hi); --bd: #0f1612; }
.btn.ghost { --bd: var(--rule-2); box-shadow: none; }
.btn.big { padding: 12px 22px; font-size: 1.02rem; }
.btn.small { padding: 5px 11px; font-size: 0.84rem; }
.btn.tiny { padding: 3px 8px; font-size: 0.76rem; border-width: 1px; box-shadow: none; gap: 4px; }
.btn[data-poor] { opacity: 0.55; }
.btn.shake { animation: shake 0.35s; }
@keyframes shake { 20%, 60% { transform: translateX(-4px); } 40%, 80% { transform: translateX(4px); } }
/* il pulsante da premere adesso: un respiro lento, non un lampeggio */
.btn.pulse { animation: breathe 2.4s ease-in-out infinite; }
@keyframes breathe {
  0%, 100% { box-shadow: inset 0 -2px 0 rgba(0,0,0,0.14), 0 0 0 0 rgba(169, 128, 47, 0); }
  50% { box-shadow: inset 0 -2px 0 rgba(0,0,0,0.14), 0 0 0 5px rgba(169, 128, 47, 0.35); }
}

.icon-btn {
  width: 40px; height: 40px; border-radius: var(--r-btn); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--paper), var(--card); color: var(--ink);
  border: 1px solid rgba(31, 42, 36, 0.3); box-shadow: var(--lift);
  font-size: 1.1rem; transition: transform 0.12s, background-color 0.15s;
}
.icon-btn:hover { background-color: var(--card-hi); transform: translateY(-1px); }
.icon-btn.off { color: var(--ink-3); }
.icon-btn.off .ic { opacity: 0.5; }
.icon-btn.danger:hover { color: var(--red); }

/* ---------- campi ---------- */
.field { display: flex; flex-direction: column; gap: 5px; margin: 12px 0; }
.field > span { font-size: 0.84rem; color: var(--ink-2); font-weight: 600; }
.field input, .field select, .join-row input, .chat-form input, .num-input {
  background: var(--card-hi);
  border: 1.5px solid var(--rule-2);
  border-radius: var(--r-btn); padding: 10px 12px; outline: none; color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input::placeholder, .join-row input::placeholder, .chat-form input::placeholder { color: var(--ink-3); }
.field input:focus, .join-row input:focus, .chat-form input:focus, .num-input:focus, .field select:focus {
  border-color: var(--ink); box-shadow: 0 0 0 3px rgba(169, 128, 47, 0.3);
}
.field.compact { margin: 6px 0 12px; }
.field.compact input, .field.compact select { padding: 8px 10px; }
.field select:disabled, .toggle input:disabled ~ * { opacity: 0.55; }
select option { background: var(--card-hi); color: var(--ink); }

.toggle { display: flex; align-items: flex-start; gap: 10px; margin: 12px 0; cursor: pointer; font-size: 0.92rem; line-height: 1.3; }
.toggle .tl { padding-top: 1px; }
.toggle .tl small { display: block; font-size: 0.78rem; color: var(--ink-2); margin-top: 2px; line-height: 1.35; }
.rules-sub { font-family: var(--serif); font-weight: 700; font-size: 1.02rem; margin: 18px 0 4px; padding-top: 12px; border-top: 1px solid var(--rule); }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle input + span {
  width: 38px; height: 22px; border-radius: 22px; background: var(--card-2); position: relative; flex: none;
  border: 1.5px solid var(--rule-2); transition: background-color 0.2s, border-color 0.2s;
}
.toggle input + span::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 15px; height: 15px; border-radius: 50%;
  background: var(--card-hi); box-shadow: 0 1px 2px rgba(0,0,0,0.35); transition: transform 0.2s;
}
.toggle input:checked + span { background: var(--green); border-color: var(--green-dk); }
.toggle input:checked + span::after { transform: translateX(16px); }
.toggle input:focus-visible + span { outline: 2px solid var(--brass); outline-offset: 2px; }

input[type=range] { accent-color: var(--ink); }

.count { font-family: var(--sans); font-weight: 500; font-size: 0.82rem; color: var(--ink-2); margin-left: 6px; }

/* ---------- caricamento ---------- */
#loader {
  position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px;
  background: radial-gradient(ellipse at 50% 40%, #3b261a, var(--wood) 70%);
  transition: opacity 0.6s;
}
#loader.done { opacity: 0; pointer-events: none; }
.loader-mark {
  font-size: clamp(2.2rem, 8vw, 4rem); color: var(--card); background: var(--red);
  padding: 14px 30px 12px 38px; border-radius: 3px;
  box-shadow: inset 0 0 0 3px var(--red), inset 0 0 0 5px var(--card), 0 20px 50px rgba(0,0,0,0.5);
}
.loader-bar { width: 200px; height: 2px; background: rgba(242, 233, 208, 0.15); overflow: hidden; }
.loader-bar span { display: block; height: 100%; width: 35%; background: var(--card); animation: load 1.3s ease-in-out infinite; }
@keyframes load { 0% { transform: translateX(-100%); } 100% { transform: translateX(300%); } }
.loader-text { color: rgba(242, 233, 208, 0.65); font-size: 0.9rem; font-style: italic; font-family: var(--serif); }

/* ---------- schermate ---------- */
.screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 10; overflow-y: auto; }

/* home: il coperchio della scatola appoggiato accanto al tabellone */
#home { justify-content: flex-start; padding-left: max(16px, 7vw); }
.home-card { width: min(400px, 100%); overflow: hidden; }
.lid {
  background: var(--red); padding: 26px 22px 22px; position: relative;
  box-shadow: inset 0 0 0 6px var(--red), inset 0 0 0 7.5px rgba(242, 233, 208, 0.85);
}
.lid .wordmark { color: var(--card-hi); font-size: clamp(2.3rem, 9vw, 3.1rem); text-align: center; padding-left: 0.16em; }
.home-body { padding: 18px 26px 22px; }
.tagline { font-family: var(--serif); font-style: italic; font-size: 1.12rem; margin: 0 0 6px; color: var(--ink); }
.home-card .btn.big { width: 100%; margin-top: 4px; }
.join { margin-top: 18px; padding-top: 4px; border-top: 1px solid var(--rule); }
.join .field { margin-bottom: 6px; }
.join-row { display: flex; gap: 8px; }
.join-row input {
  flex: 1; min-width: 0; text-transform: uppercase; letter-spacing: 0.3em; text-align: center;
  font-family: var(--serif); font-weight: 700; font-size: 1.2rem; padding: 8px 10px;
}
.join-row input::placeholder { letter-spacing: 0.3em; opacity: 0.45; }
.fineprint { color: var(--ink-2); font-size: 0.8rem; margin: 18px 0 0; line-height: 1.45; }

.deal-in { animation: dealIn 0.7s cubic-bezier(0.2, 0.9, 0.25, 1) both; }
@keyframes dealIn { from { opacity: 0; transform: translateY(24px) rotate(-1.2deg); } to { opacity: 1; transform: none; } }

/* ---------- lobby ---------- */
.lobby-card { width: min(1040px, 100%); padding: 22px 26px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; }
.lobby-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; padding-bottom: 16px; border-bottom: 1px solid var(--rule); }
.ticket-label { font-size: 0.84rem; color: var(--ink-2); font-weight: 600; }
.code { font-size: 2.7rem; font-weight: 700; letter-spacing: 0.18em; color: var(--red); line-height: 1.05; user-select: all; }
.lobby-share { display: flex; gap: 8px; flex-wrap: wrap; }
.lobby-body { display: grid; grid-template-columns: 1.1fr 1fr 1fr; gap: 30px; padding: 16px 0; overflow-y: auto; }
.lobby-col { min-width: 0; }
.lobby-col h3, .modal h2, .help h3 { font-family: var(--serif); font-weight: 700; }
.lobby-col h3 { font-size: 1.2rem; margin: 4px 0 10px; display: flex; align-items: baseline; }
.lobby-col h3 + .token-picker + h3 { margin-top: 18px; }
.lobby-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.lobby-list li {
  display: flex; align-items: center; gap: 10px; padding: 6px 10px 6px 6px; border-radius: var(--r-btn);
  background: var(--card-2); border-left: 5px solid var(--pc, transparent);
}
.lobby-list img { width: 40px; height: 40px; }
.lobby-list .nm { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lobby-list .nm .ic { color: var(--brass); margin-left: 4px; }
.lobby-list .tag { font-size: 0.78rem; color: var(--ink-2); font-weight: 400; }
.lobby-list .you { font-size: 0.78rem; font-weight: 500; color: var(--ink-2); margin-left: 4px; }
.lobby-list .empty { background: transparent; border: 1.5px dashed var(--rule); color: var(--ink-3); font-style: italic; justify-content: center; padding: 13px; font-family: var(--serif); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--pos); flex: none; }
.dot.off { background: transparent; box-shadow: inset 0 0 0 1.5px var(--ink-3); }
.token-picker { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.token-opt {
  border: 1.5px solid transparent; border-radius: var(--r-btn); background: var(--card-2); cursor: pointer; padding: 4px 2px 5px;
  display: flex; flex-direction: column; align-items: center; font-size: 0.72rem; color: var(--ink-2); transition: background-color 0.15s, border-color 0.15s;
}
.token-opt img { width: 100%; max-width: 64px; aspect-ratio: 1; }
.token-opt:hover:not(.taken) { background: var(--card-hi); }
.token-opt.sel { border-color: var(--ink); background: var(--card-hi); color: var(--ink); font-weight: 600; }
.token-opt.taken { opacity: 0.3; cursor: not-allowed; }
.color-picker { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.color-opt { width: 30px; height: 30px; border-radius: 50%; cursor: pointer; border: 3px solid var(--card); box-shadow: 0 0 0 1px var(--rule-2); transition: box-shadow 0.15s; }
.color-opt.sel { box-shadow: 0 0 0 2px var(--ink); }
.color-opt.taken { opacity: 0.2; cursor: not-allowed; }
.host-note { font-size: 0.86rem; color: var(--ink-2); margin: -4px 0 8px; font-style: italic; font-family: var(--serif); }
.lobby-foot { display: flex; align-items: center; gap: 12px; padding-top: 16px; border-top: 1px solid var(--rule); }
.lobby-foot .hint { flex: 1; text-align: center; color: var(--ink-2); font-size: 0.92rem; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; z-index: 5; pointer-events: none; }
#hud > * { pointer-events: auto; }

.hud-players { position: absolute; top: 12px; left: 12px; display: flex; flex-direction: column; gap: 6px; width: 252px; max-height: calc(100vh - 300px); overflow-y: auto; padding: 2px 6px 6px 2px; }
.pl {
  position: relative; display: grid; grid-template-columns: 42px 1fr auto; align-items: center; gap: 8px; padding: 5px 11px 5px 5px;
  background: var(--paper), var(--card); border-radius: var(--r-btn); box-shadow: var(--lift);
  border-left: 5px solid var(--pc); transition: transform 0.3s, box-shadow 0.3s, opacity 0.3s; cursor: default;
}
.pl.current { transform: translateX(6px); box-shadow: 0 0 0 2px var(--brass), var(--lift); }
.pl.bankrupt { opacity: 0.45; filter: grayscale(1); }
.pl img { width: 42px; height: 42px; }
.pl .nm { font-weight: 600; font-size: 0.9rem; white-space: nowrap; overflow: hidden; display: flex; align-items: center; gap: 6px; }
.pl .nm span.n { overflow: hidden; text-overflow: ellipsis; }
.pl .me-tag { font-size: 0.72rem; font-weight: 500; color: var(--ink-2); }
.pl .sub { font-size: 0.74rem; color: var(--ink-2); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pl .sub span { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
.pl .sub .warn { color: var(--red); }
.pl .money { font-size: 1.12rem; font-weight: 700; text-align: right; }
.chips { display: flex; gap: 2px; flex-wrap: wrap; margin-top: 3px; }
.chips i { width: 7px; height: 10px; border-radius: 1px; display: inline-block; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.25); }
.chips i.mort { opacity: 0.3; }
.money-delta {
  position: absolute; right: 8px; top: -10px; font-family: var(--serif); font-weight: 700; font-size: 0.92rem; pointer-events: none;
  padding: 0 6px; border-radius: 3px; background: var(--card-hi); box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  animation: deltaUp 1.6s ease-out forwards;
}
.money-delta.pos { color: var(--pos); }
.money-delta.neg { color: var(--neg); }
@keyframes deltaUp { from { opacity: 0; transform: translateY(6px); } 15% { opacity: 1; } 70% { opacity: 1; } to { opacity: 0; transform: translateY(-16px); } }

.hud-tools { position: absolute; top: 12px; right: 12px; display: flex; gap: 6px; }
#btn-panel { display: none; }

.side-panel { position: absolute; top: 62px; right: 12px; bottom: 12px; width: 330px; display: flex; flex-direction: column; overflow: hidden; }
.tabs { display: flex; border-bottom: 1px solid var(--rule); padding: 0 6px; }
.tabs button {
  flex: 1; padding: 11px 4px 9px; background: none; border: 0; cursor: pointer; color: var(--ink-2); font-weight: 600; font-size: 0.88rem;
  border-bottom: 2px solid transparent; margin-bottom: -1px; position: relative;
}
.tabs button.active { color: var(--ink); border-bottom-color: var(--red); }
.badge {
  position: absolute; top: 5px; right: 8px; min-width: 17px; height: 17px; border-radius: 9px; background: var(--red); color: var(--card-hi);
  font-size: 0.7rem; font-style: normal; font-weight: 700; display: flex; align-items: center; justify-content: center; padding: 0 4px;
}
.tab-body { flex: 1; min-height: 0; position: relative; }
.pane { position: absolute; inset: 0; overflow-y: auto; padding: 12px 14px; display: none; }
.pane.active { display: block; }

/* chat: a riposo è solo testo sul tavolo, al passaggio diventa una carta */
.chat-box {
  position: absolute; left: 12px; bottom: 12px; width: 290px; height: 260px; display: flex; flex-direction: column;
  overflow: hidden; border-radius: var(--r-card); border: 1px solid transparent;
  transition: height 0.25s ease, background-color 0.3s, border-color 0.3s, box-shadow 0.3s;
}
.chat-box.collapsed { height: 40px; }
.chat-head {
  display: flex; align-items: center; gap: 7px; padding: 10px 12px; background: none; border: 0; cursor: pointer;
  font-weight: 600; font-size: 0.9rem; text-align: left; flex: none; color: var(--card); text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}
.chat-head .badge { position: static; }
.chat-head .chev { margin-left: auto; transition: transform 0.25s; display: inline-flex; }
.chat-box.collapsed .chev { transform: rotate(180deg); }
.chat-body { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 0 10px 10px; }
.chat-box.collapsed .chat-body { visibility: hidden; }
.chat-box.ping { animation: chatPing 0.6s; }
.chat-box .chat-list {
  pointer-events: none;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 45%);
  mask-image: linear-gradient(to bottom, transparent 0%, #000 45%);
}
.chat-box .chat-msg { background: rgba(24, 16, 10, 0.62); color: var(--card); }
.chat-box .chat-msg b { color: color-mix(in srgb, var(--pc) 70%, #fff); }
.chat-box .chat-form input { background: rgba(24, 16, 10, 0.5); border-color: rgba(242, 233, 208, 0.25); color: var(--card); }
.chat-box .chat-form input::placeholder { color: rgba(242, 233, 208, 0.6); }
.chat-box .chat-form .btn { --fg: var(--card); --bd: rgba(242, 233, 208, 0.4); }
.chat-box .empty-note { display: none; }
.chat-box:hover .empty-note, .chat-box:focus-within .empty-note { display: block; }
.chat-box.collapsed .chat-head { background: rgba(24, 16, 10, 0.6); }
#hud > .chat-box, .chat-box .chat-body { pointer-events: none; }
.chat-box .chat-head, .chat-box .chat-form { pointer-events: auto; }
#hud > .chat-box:hover, #hud > .chat-box:focus-within,
.chat-box:hover .chat-body, .chat-box:focus-within .chat-body { pointer-events: auto; }
.chat-box:hover, .chat-box:focus-within {
  background: var(--paper), var(--card); border-color: rgba(31, 42, 36, 0.28); box-shadow: var(--lift);
}
.chat-box:hover .chat-head, .chat-box:focus-within .chat-head { color: var(--ink); text-shadow: none; background: none; }
.chat-box:hover .chat-list, .chat-box:focus-within .chat-list { pointer-events: auto; -webkit-mask-image: none; mask-image: none; }
.chat-box:hover .chat-msg, .chat-box:focus-within .chat-msg { background: var(--card-2); color: var(--ink); }
.chat-box:hover .chat-msg b, .chat-box:focus-within .chat-msg b { color: var(--ink); }
.chat-box:hover .chat-form input, .chat-box:focus-within .chat-form input { background: var(--card-hi); border-color: var(--rule-2); color: var(--ink); }
.chat-box:hover .chat-form .btn, .chat-box:focus-within .chat-form .btn { --fg: var(--ink); --bd: var(--ink); }
.chat-box:hover .empty-note, .chat-box:focus-within .empty-note { color: var(--ink-2); text-shadow: none; }
.chat-box .chat-msg.fresh { animation: msgFresh 4s ease-out; }
@keyframes msgFresh { 0%, 40% { box-shadow: 0 0 0 1.5px var(--brass-hi); } }
@keyframes chatPing { 30% { box-shadow: 0 0 0 3px var(--brass); } }

.chat-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; padding-bottom: 8px; }
.chat-msg { font-size: 0.86rem; background: var(--card-2); border-radius: var(--r-btn); padding: 5px 9px; user-select: text; word-wrap: break-word; }
.chat-msg b { font-weight: 700; }
.chat-msg b::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--pc); margin-right: 5px; vertical-align: 1px; }
.chat-form { display: flex; gap: 6px; }
.chat-form input { flex: 1; min-width: 0; padding: 7px 10px; }
.chat-form .btn { padding: 5px 9px; }
.empty-note { color: var(--ink-2); font-size: 0.88rem; text-align: center; padding: 18px 8px; line-height: 1.5; }
.empty-note b { color: var(--ink); }

/* notifiche */
#notify-root { position: fixed; top: 62px; left: 50%; transform: translateX(-50%); z-index: 35; display: flex; flex-direction: column; gap: 10px; align-items: center; pointer-events: none; width: min(440px, calc(100vw - 24px)); }
.notif {
  pointer-events: auto; width: 100%; display: grid; grid-template-columns: 52px 1fr; gap: 2px 12px; align-items: center;
  padding: 12px 14px 0; border-radius: var(--r-card); background: var(--paper), var(--card); overflow: hidden;
  border: 1px solid rgba(31, 42, 36, 0.3); border-left: 6px solid var(--nc, var(--brass)); box-shadow: var(--lift);
  animation: notifIn 0.45s cubic-bezier(0.2, 0.9, 0.25, 1) both;
}
.notif.out { animation: notifOut 0.3s forwards; }
.notif img { width: 52px; height: 52px; grid-row: span 2; }
.notif .nt { font-family: var(--serif); font-weight: 700; font-size: 1.1rem; line-height: 1.2; }
.notif .nx { font-size: 0.86rem; color: var(--ink-2); }
.notif .na { grid-column: 1 / -1; display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }
.notif .bar { grid-column: 1 / -1; height: 2px; margin: 10px -14px 0; background: var(--nc, var(--brass)); transform-origin: left; animation: notifTimer linear forwards; }
@keyframes notifIn { from { opacity: 0; transform: translateY(-16px); } }
@keyframes notifOut { to { opacity: 0; transform: translateY(-12px); } }
@keyframes notifTimer { from { transform: scaleX(1); } to { transform: scaleX(0); } }

.log-item { font-size: 0.83rem; padding: 6px 0; border-bottom: 1px solid var(--rule); line-height: 1.4; }
.log-item time { color: var(--ink-3); font-size: 0.74rem; margin-right: 7px; font-variant-numeric: tabular-nums; }

/* proprietà */
.summary { font-size: 0.86rem; line-height: 1.7; }
.summary .row2 { display: flex; justify-content: space-between; gap: 8px; }
.summary .row2 b { font-family: var(--serif); font-size: 1rem; }
.summary .muted { color: var(--ink-2); font-size: 0.8rem; }
.summary .ic { color: var(--ink-2); }
.prop-group { margin-bottom: 14px; }
.prop-group h4 { margin: 4px 0 6px; font-size: 0.86rem; font-weight: 600; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.prop-group h4 .full { color: var(--green); display: inline-flex; align-items: center; gap: 3px; }
.prop-row {
  display: grid; grid-template-columns: 6px 1fr auto; gap: 9px; align-items: center; padding: 6px 8px 6px 6px; border-radius: var(--r-btn);
  background: var(--card-2); margin-bottom: 4px; cursor: pointer;
}
.prop-row:hover { background: color-mix(in srgb, var(--card-2) 80%, var(--card-hi)); }
.prop-row .bar { width: 6px; height: 30px; border-radius: 1px; }
.prop-row .pn { font-size: 0.86rem; font-weight: 600; line-height: 1.2; display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.prop-row .ps { font-size: 0.74rem; color: var(--ink-2); }
.prop-row.mort .pn { text-decoration: line-through; opacity: 0.6; }
.prop-row .acts { display: flex; gap: 4px; }
.houses { display: inline-flex; gap: 1px; color: var(--green); }
.houses .ic { width: 0.95em; height: 0.95em; }
.houses.hotel { color: var(--red); }
.props-tools { display: flex; gap: 6px; margin-top: 10px; }
.props-tools .btn { flex: 1; }

.hud-bottom {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px;
  max-width: calc(100vw - 24px - 342px - 262px); min-width: 320px; pointer-events: none;
}
.hud-bottom > * { pointer-events: auto; }
.turn-info {
  font-size: 0.95rem; text-align: center; padding: 6px 16px; border-radius: var(--r-btn);
  background: var(--paper), var(--card); box-shadow: var(--lift); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center;
}
.turn-info b { font-weight: 700; }
.turn-info .who { display: inline-flex; align-items: center; gap: 6px; }
.turn-info .who::before { content: ''; width: 9px; height: 9px; border-radius: 50%; background: var(--pc); }
.turn-info .yours { color: var(--red); font-family: var(--serif); font-size: 1.05rem; }
.turn-info .timer { font-family: var(--serif); font-weight: 700; display: inline-flex; align-items: center; gap: 3px; font-variant-numeric: tabular-nums; }
.turn-info .timer.low { color: var(--red); }
.turn-info .auto { font-size: 0.78rem; color: var(--ink-2); font-style: italic; }
.action-bar {
  display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; align-items: center; padding: 10px;
  border-radius: var(--r-card); background: var(--paper), var(--card); border: 1px solid rgba(31, 42, 36, 0.28); box-shadow: var(--lift);
}
.action-bar:empty { display: none; }
.action-bar.busy { pointer-events: none; }
.action-bar.busy .btn { opacity: 0.55; animation: none; }
.action-bar .note { font-size: 0.86rem; color: var(--ink-2); font-style: italic; padding: 4px 8px; }
.debt-box { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center; }
.debt-box .msg { color: var(--red); font-weight: 700; }
.dice-readout {
  display: inline-flex; align-items: center; gap: 8px; font-family: var(--serif); font-weight: 700; font-size: 1.25rem; padding: 2px 14px;
  border-radius: var(--r-btn); background: var(--paper), var(--card); box-shadow: var(--lift); animation: dealIn 0.4s both;
}
.dice-readout .ic { color: var(--ink-2); }
.dice-readout .dbl { color: var(--red); font-size: 0.82rem; font-family: var(--sans); font-weight: 700; }

.go-choice { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center; }
.go-choice select { background: var(--card-hi); border: 1.5px solid var(--rule-2); border-radius: var(--r-btn); padding: 8px 10px; color: var(--ink); max-width: 210px; }
.summary .goal b { color: var(--green); }
.buy-prompt { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; justify-content: center; }
.buy-prompt .side { display: flex; flex-direction: column; gap: 8px; }
.buy-prompt small { color: var(--red); max-width: 220px; }

/* ---------- contratti ---------- */
.deed {
  width: 252px; background: #fbf7ea; color: var(--ink); border-radius: 3px; padding: 9px;
  box-shadow: 0 2px 3px rgba(0,0,0,0.25), 0 16px 34px -12px rgba(0,0,0,0.55); font-size: 0.84rem; position: relative;
  outline: 1px solid rgba(31, 42, 36, 0.2);
}
.deed .head { border: 1.5px solid var(--ink); padding: 7px 6px 8px; text-align: center; color: var(--ink); }
.deed .head small { display: block; font-family: var(--serif); font-style: italic; font-size: 0.78rem; opacity: 0.9; }
.deed .head b { font-weight: 800; font-size: 1.08rem; letter-spacing: 0.04em; text-transform: uppercase; display: block; line-height: 1.15; margin-top: 2px; }
.deed .head.dark { color: #fbf7ea; }
.deed table { width: 100%; border-collapse: collapse; margin: 8px 0 4px; }
.deed td { padding: 2.5px 5px; }
.deed td:last-child { text-align: right; font-family: var(--serif); font-weight: 700; font-variant-numeric: tabular-nums; }
.deed tr.cur td { background: rgba(169, 128, 47, 0.25); }
.deed .foot { border-top: 1px solid var(--rule); margin-top: 6px; padding-top: 6px; font-size: 0.76rem; color: var(--ink-2); line-height: 1.5; }
.deed .owner { margin-top: 8px; padding: 5px 8px; border-radius: 2px; color: #fff; font-weight: 600; text-align: center; font-size: 0.8rem; display: flex; align-items: center; justify-content: center; gap: 6px; }
.deed .owner.bank { background: var(--card-2); color: var(--ink-2); }
.deed .owner .houses { color: inherit; }
.deed .stamp {
  position: absolute; top: 46%; left: 50%; transform: translate(-50%, -50%) rotate(-14deg);
  border: 3px double var(--red); color: var(--red); font-family: var(--serif); font-weight: 800; letter-spacing: 0.12em;
  font-size: 1.35rem; padding: 2px 12px; opacity: 0.85; background: rgba(251, 247, 234, 0.75);
}
.deed .icon { text-align: center; margin: 8px 0 2px; color: var(--ink); }
.deed .icon .ic { width: 44px; height: 44px; stroke-width: 1.3; }
.deed p { margin: 8px 2px 2px; line-height: 1.45; }
.mini-deed { width: 168px; font-size: 0.74rem; padding: 6px; }
.mini-deed .head b { font-size: 0.92rem; }

/* ---------- finestre ---------- */
#modals { position: fixed; inset: 0; z-index: 30; pointer-events: none; }
.modal-wrap {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; pointer-events: auto;
  background: rgba(20, 11, 6, 0.45); animation: fadeIn 0.2s;
}
@keyframes fadeIn { from { opacity: 0; } }
.modal-wrap.clear { background: transparent; pointer-events: none; }
.modal-wrap.clear .modal { pointer-events: auto; }
.modal { padding: 20px 24px; max-width: min(720px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; animation: dealIn 0.35s cubic-bezier(0.2, 0.9, 0.25, 1) both; }
.modal h2 { margin: 0 0 12px; font-size: 1.6rem; line-height: 1.15; display: flex; align-items: center; gap: 10px; }
.modal h2 .ic { width: 0.9em; height: 0.9em; color: var(--ink-2); }
.modal p { line-height: 1.5; }
.modal .lead { max-width: 440px; color: var(--ink-2); }
.modal .row { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 18px; }
.modal .center { text-align: center; }
.deed-modal { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; justify-content: center; }
.deed-actions { display: flex; flex-direction: column; gap: 8px; min-width: 190px; }
.deed-actions .note { font-size: 0.82rem; color: var(--ink-2); line-height: 1.45; }

/* carta imprevisti / probabilità */
.card3d { perspective: 1200px; pointer-events: auto; cursor: pointer; }
.card3d .inner {
  width: min(400px, 86vw); aspect-ratio: 1.55; position: relative; transform-style: preserve-3d;
  animation: cardFlip 0.9s cubic-bezier(0.3, 1.15, 0.5, 1) both;
}
@keyframes cardFlip {
  from { transform: translateY(80px) rotateY(180deg) rotateZ(-6deg) scale(0.6); opacity: 0; }
  30% { opacity: 1; }
  to { transform: none; }
}
.card3d .face, .card3d .back {
  position: absolute; inset: 0; border-radius: 8px; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 22px 28px; text-align: center;
  box-shadow: 0 30px 60px rgba(0,0,0,0.5);
}
.card3d .back { transform: rotateY(180deg); color: #fbf7ea; }
.card3d .back .ic { width: 96px; height: 96px; stroke-width: 1.4; }
.card3d.chance .back { background: #cf5f1c; }
.card3d.chest .back { background: #2c628f; }
.card3d .face { background: #fbf7ea; color: var(--ink); box-shadow: inset 0 0 0 10px var(--dc), inset 0 0 0 12px #fbf7ea, inset 0 0 0 13px var(--dc), 0 30px 60px rgba(0,0,0,0.5); }
.card3d.chance { --dc: #cf5f1c; }
.card3d.chest { --dc: #2c628f; }
.card3d .face .ttl { font-family: var(--serif); font-style: italic; font-weight: 700; font-size: 1.55rem; color: var(--dc); }
.card3d .face .txt { font-size: 1.12rem; font-weight: 500; margin-top: 10px; line-height: 1.45; max-width: 30ch; }
.card3d .face .who { margin-top: 14px; font-size: 0.8rem; color: var(--ink-3); }

/* cantiere */
.build-modal { width: min(840px, 100%); }
.build-top { display: flex; gap: 18px; flex-wrap: wrap; align-items: center; font-size: 0.9rem; color: var(--ink-2); margin-bottom: 14px; }
.build-top span { display: inline-flex; align-items: center; gap: 5px; }
.build-top b { color: var(--ink); font-family: var(--serif); font-size: 1.02rem; }
.build-top .note { font-style: italic; }
.bgroup { border-radius: var(--r-btn); background: var(--card-2); margin-bottom: 12px; overflow: hidden; border-top: 6px solid var(--gc); }
.bg-head { display: flex; align-items: center; gap: 10px; padding: 9px 12px; flex-wrap: wrap; }
.bg-head b { font-family: var(--serif); font-weight: 700; font-size: 1.1rem; }
.bg-head span { font-size: 0.82rem; color: var(--ink-2); }
.bg-quick { margin-left: auto; display: flex; gap: 6px; }
.bg-warn { padding: 0 12px 10px; font-size: 0.84rem; color: var(--red); display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.bg-props { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; padding: 0 10px 10px; }
.bprop { background: var(--card-hi); border-radius: var(--r-btn); padding: 8px; text-align: center; }
.bp-name { font-weight: 600; font-size: 0.84rem; min-height: 2.3em; display: flex; align-items: center; justify-content: center; line-height: 1.2; }
.bp-slots { display: flex; justify-content: center; gap: 3px; margin: 6px 0; }
.slot { font-style: normal; width: 24px; height: 24px; border-radius: 3px; display: inline-flex; align-items: center; justify-content: center; color: var(--ink-3); background: var(--card-2); opacity: 0.55; transition: all 0.2s; }
.slot .ic { width: 15px; height: 15px; }
.slot.on { opacity: 1; background: var(--green); color: var(--card-hi); }
.slot.hotel.on { background: var(--red); }
.slot.add { box-shadow: 0 0 0 2px var(--brass); }
.slot.del { opacity: 0.8; background: transparent; box-shadow: inset 0 0 0 1.5px var(--red); color: var(--red); }
.bp-rent { font-size: 0.76rem; color: var(--ink-2); min-height: 1.2em; }
.bp-rent b { color: var(--ink); }
.bp-ctrl { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 6px; }
.bp-ctrl b { font-family: var(--serif); font-weight: 700; font-size: 1.25rem; min-width: 1.4em; display: inline-flex; justify-content: center; }
.bp-ctrl .btn.tiny { width: 32px; height: 28px; padding: 0; }
.bsub { margin: 16px 0 6px; font-size: 0.9rem; font-weight: 600; color: var(--ink-2); }
.bpartials { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; }
.bpartial { border-left: 6px solid var(--gc); background: var(--card-2); border-radius: var(--r-btn); padding: 8px 10px; font-size: 0.84rem; }
.bp-missing { margin-top: 4px; display: flex; flex-direction: column; gap: 4px; color: var(--ink-2); }
.build-sum, .funds-sum, .tr-vals { display: grid; gap: 1px; background: var(--rule); border: 1px solid var(--rule); border-radius: var(--r-btn); overflow: hidden; }
.build-sum { grid-template-columns: repeat(4, 1fr); margin-top: 14px; transition: opacity 0.2s; }
.build-sum.idle { opacity: 0.5; }
.build-sum div, .tr-vals div, .funds-sum div { background: var(--card-hi); padding: 7px 10px; text-align: center; }
.build-sum span, .tr-vals span, .funds-sum span { display: block; font-size: 0.78rem; color: var(--ink-2); }
.build-sum b, .tr-vals b, .funds-sum b { font-family: var(--serif); font-weight: 700; font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.neg-txt { color: var(--neg); }
.pos-txt { color: var(--pos); }
.warn-txt { color: var(--red); }

/* scambi */
.trade-modal { width: min(900px, 100%); }
.trade-target { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.trade-target button {
  border: 1.5px solid var(--rule-2); border-radius: var(--r-btn); background: transparent; padding: 4px 12px 4px 4px; cursor: pointer;
  display: flex; align-items: center; gap: 6px; font-weight: 600;
}
.trade-target button img { width: 30px; height: 30px; }
.trade-target button small { color: var(--ink-2); font-weight: 500; font-family: var(--serif); margin-left: 2px; }
.trade-target button.sel { border-color: var(--ink); background: var(--card-hi); }
.tr-cols { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: stretch; }
.tr-mid { display: flex; align-items: center; color: var(--ink-2); }
.tr-mid .ic { width: 26px; height: 26px; }
.tr-side { background: var(--card-2); border-radius: var(--r-btn); padding: 10px; min-width: 0; }
.tr-side h4 { margin: 0 0 8px; font-size: 0.92rem; font-weight: 600; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 6px; max-height: 260px; overflow-y: auto; padding: 2px; }
.tile {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; cursor: pointer;
  background: #fbf7ea; color: var(--ink); border: 0; border-radius: 3px; padding: 0 8px 6px; overflow: hidden; font: inherit;
  box-shadow: 0 1px 2px rgba(0,0,0,0.25); transition: transform 0.12s, box-shadow 0.12s, opacity 0.12s; opacity: 0.75;
}
.tile .tc { display: block; height: 8px; margin: 0 -8px 4px; width: calc(100% + 16px); background: var(--gc); }
.tile .tn { font-weight: 600; font-size: 0.76rem; line-height: 1.15; }
.tile .tv { font-size: 0.7rem; color: var(--ink-2); display: inline-flex; align-items: center; gap: 3px; }
.tile:hover:not(:disabled) { transform: translateY(-2px); opacity: 1; }
.tile.sel { opacity: 1; box-shadow: 0 0 0 2px var(--ink), 0 6px 14px -4px rgba(0,0,0,0.4); transform: translateY(-2px); }
.tile.sel::after { content: ''; position: absolute; right: 5px; bottom: 5px; width: 12px; height: 12px; border-radius: 50%; background: var(--green); box-shadow: inset 0 0 0 2.5px #fbf7ea; }
.tile.locked { opacity: 0.3; cursor: not-allowed; }
.tstar { position: absolute; top: 11px; right: 4px; color: var(--brass); display: inline-flex; }
.tstar .ic { width: 13px; height: 13px; fill: currentColor; }
.tstar.theirs { color: var(--red); }
.tiles.mini { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); max-height: none; }
.tiles.mini .tile { opacity: 1; cursor: default; }
.tmoney { font-weight: 600; font-size: 0.86rem; margin-top: 4px; display: flex; align-items: center; gap: 5px; }
.tr-money { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 0.82rem; }
.tr-money > .ic { color: var(--ink-2); }
.tr-money input[type=range] { flex: 1; min-width: 0; }
.tr-money .num-input { width: 92px; padding: 6px 8px; }
.tr-quick { display: flex; gap: 4px; align-items: center; margin-top: 6px; flex-wrap: wrap; }
.tr-quick small { margin-left: auto; color: var(--ink-2); }
.tr-summary { margin-top: 12px; }
.tr-vals { grid-template-columns: 1fr 1.2fr 1fr; }
.tr-bal.pos b { color: var(--pos); }
.tr-bal.neg b { color: var(--neg); }
.tr-notes { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 8px; font-size: 0.84rem; font-weight: 600; }
.tr-notes span { display: inline-flex; align-items: center; gap: 4px; }
.tr-notes .good { color: var(--green); }
.tr-notes .warn { color: var(--red); }
.trade-offer { width: min(620px, 100%); }
.pl.clickable { cursor: pointer; }
.pl.clickable:hover { box-shadow: 0 0 0 1.5px var(--ink-2), var(--lift); }
.pl.current.clickable:hover { box-shadow: 0 0 0 2px var(--brass), var(--lift); }
.trade-card { background: var(--card-2); border-radius: var(--r-btn); padding: 10px; margin-bottom: 8px; font-size: 0.84rem; }
.trade-card .tt { font-weight: 600; margin-bottom: 6px; }
.trade-card .sides { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.trade-card .sides > div { background: var(--card-hi); border-radius: 3px; padding: 6px 8px; min-width: 0; }
.trade-card .sides b { display: block; font-size: 0.78rem; font-weight: 600; color: var(--ink-2); margin-bottom: 3px; }
.trade-card .row { margin-top: 8px; display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }

/* raccolta fondi */
.funds { width: min(560px, 100%); }
.funds-sum { grid-template-columns: repeat(3, 1fr); }
.funds-hint { font-size: 0.88rem; color: var(--ink-2); line-height: 1.5; margin: 12px 0 8px; }
.funds-list { max-height: 42vh; overflow-y: auto; }
.funds-list .prop-row { cursor: default; }
.funds-list .acts { flex-wrap: wrap; justify-content: flex-end; }
.tag-muted { font-size: 0.76rem; color: var(--ink-2); font-style: italic; }

/* asta */
.auction { width: min(520px, 100%); }
.auction-top { display: flex; gap: 18px; align-items: center; }
.auction-info { flex: 1; }
.auction .label { color: var(--ink-2); font-size: 0.84rem; }
.auction .bid { font-weight: 700; font-size: 2.6rem; line-height: 1.05; }
.auction .bidder { color: var(--ink-2); font-size: 0.9rem; margin-top: 4px; }
.auction .value { font-size: 0.82rem; color: var(--ink-2); margin-top: 6px; }
.auction .clock { height: 3px; background: var(--rule); overflow: hidden; margin: 16px 0; }
.auction .clock span { display: block; height: 100%; background: var(--red); transition: width 0.25s linear; }
.auction .bid-row { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.auction .bid-row .num-input { width: 110px; padding: 6px 8px; }
.auction .cash { text-align: center; font-size: 0.82rem; color: var(--ink-2); margin-top: 8px; }
.auction .parts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 14px; font-size: 0.8rem; }
.auction .parts span { padding: 2px 9px; border-radius: 3px; background: var(--card-2); border-left: 4px solid var(--pc); }
.auction .parts span.out { opacity: 0.4; text-decoration: line-through; }

/* fine partita */
.winner { text-align: center; }
.winner .crown { display: block; color: var(--brass); animation: dealIn 0.6s 0.4s both; }
.winner .crown .ic { width: 46px; height: 46px; stroke-width: 1.4; }
.winner img { width: 140px; height: 140px; animation: spinIn 1s cubic-bezier(0.2, 1.2, 0.4, 1) both; }
.winner h2 { justify-content: center; }
@keyframes spinIn { from { transform: rotateY(540deg) scale(0); } }
.standings { margin: 14px auto 0; border-collapse: collapse; min-width: 300px; }
.standings td { padding: 7px 10px; border-bottom: 1px solid var(--rule); text-align: left; }
.standings td:first-child { font-family: var(--serif); color: var(--ink-2); }
.standings td:last-child { text-align: right; font-family: var(--serif); font-weight: 700; }
.standings .sw { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 7px; }

.help { max-width: 620px; font-size: 0.92rem; line-height: 1.55; }
.help h3 { margin: 16px 0 4px; font-size: 1.1rem; }
.help h3:first-child { margin-top: 0; }
.help ul { margin: 4px 0; padding-left: 20px; }
.help .ic { color: var(--ink-2); }

/* ---------- banner, testi fluttuanti, avvisi ---------- */
#banner-root { position: fixed; inset: 0; pointer-events: none; z-index: 25; display: flex; align-items: center; justify-content: center; }
.banner {
  font-family: var(--serif); font-weight: 700; font-size: clamp(1.6rem, 5vw, 2.8rem); line-height: 1.1; color: var(--ink); text-align: left;
  padding: 16px 30px 16px 22px; border-radius: 4px; background: var(--paper), var(--card-hi);
  border-left: 10px solid var(--bc, var(--brass));
  box-shadow: inset 0 0 0 1px rgba(31, 42, 36, 0.25), 0 3px 6px rgba(0,0,0,0.3), 0 30px 60px -10px rgba(0,0,0,0.55);
  animation: bannerIn 1.9s cubic-bezier(0.2, 0.9, 0.25, 1) forwards; display: flex; align-items: center; gap: 16px; max-width: calc(100vw - 32px);
}
.banner img { width: 68px; height: 68px; }
.banner > .ic { width: 0.9em; height: 0.9em; color: var(--bc, var(--ink)); stroke-width: 1.5; }
.banner small { display: block; font-family: var(--sans); font-size: 0.95rem; color: var(--ink-2); font-weight: 500; margin-top: 4px; }
@keyframes bannerIn {
  0% { opacity: 0; transform: translateY(30px) rotate(-1.5deg); }
  14% { opacity: 1; transform: translateY(-3px) rotate(0.3deg); }
  22% { transform: none; }
  82% { opacity: 1; transform: none; }
  100% { opacity: 0; transform: translateY(-14px); }
}

#floaters { position: fixed; inset: 0; pointer-events: none; z-index: 20; }
.floater {
  position: absolute; transform: translate(-50%, -50%); font-family: var(--serif); font-weight: 700; font-size: 1.35rem; white-space: nowrap;
  padding: 1px 10px; border-radius: 3px; background: var(--card-hi); box-shadow: 0 2px 8px rgba(0,0,0,0.45);
  animation: floatUp 1.8s ease-out forwards;
}
.floater.pos { color: var(--pos); }
.floater.neg { color: var(--neg); }
.floater.info { color: var(--ink); }
@keyframes floatUp { from { opacity: 0; transform: translate(-50%, -20%); } 12% { opacity: 1; transform: translate(-50%, -70%); } 75% { opacity: 1; } to { opacity: 0; transform: translate(-50%, -220%); } }

#toasts { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 40; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  padding: 9px 16px; border-radius: var(--r-btn); background: var(--ink); color: var(--card); box-shadow: 0 10px 30px -8px rgba(0,0,0,0.6);
  font-size: 0.9rem; font-weight: 500; animation: toastIn 3.2s forwards; max-width: 90vw; text-align: center;
}
.toast.error { background: var(--red); color: #fbf2e4; }
.toast.ok { background: var(--green); color: #f0f5ee; }
@keyframes toastIn { 0% { opacity: 0; transform: translateY(-10px); } 8%, 85% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(-6px); } }

#conn-banner {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 45; padding: 10px 18px; border-radius: var(--r-btn);
  background: var(--red); color: #fbf2e4; font-weight: 600; display: flex; gap: 10px; align-items: center; box-shadow: var(--lift);
}
.spinner { width: 15px; height: 15px; border: 2px solid rgba(255,255,255,0.3); border-top-color: #fff; border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- audio ---------- */
.audio-fab { position: fixed; right: 14px; bottom: 14px; z-index: 12; }
body.in-game .audio-fab { display: none; }
.audio-pop { position: fixed; z-index: 36; width: 240px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; animation: dealIn 0.25s both; }
.ap-row { display: flex; align-items: center; gap: 10px; }
.ap-toggle {
  display: inline-flex; align-items: center; gap: 7px; width: 96px; flex: none; padding: 6px 4px; border: 0; background: none; cursor: pointer;
  font-weight: 600; font-size: 0.88rem; text-align: left; border-radius: var(--r-btn);
}
.ap-toggle[aria-pressed=false] { color: var(--ink-3); text-decoration: line-through; }
.ap-row input[type=range] { flex: 1; min-width: 0; }
.ap-row input[type=range]:disabled { opacity: 0.35; }

/* ---------- schermi stretti ---------- */
@media (max-width: 1100px) {
  .side-panel { width: 290px; }
  .hud-bottom { max-width: calc(100vw - 24px - 300px - 230px); }
  .hud-players { width: 224px; }
}
@media (max-width: 900px) {
  #home { justify-content: center; padding-left: 16px; }
  .lobby-body { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .lobby-card { padding: 16px; }
  .code { font-size: 2.1rem; }
  #btn-panel { display: inline-flex; }
  .side-panel { top: auto; bottom: 0; right: 0; left: 0; width: auto; height: 50vh; border-radius: var(--r-card) var(--r-card) 0 0; transform: translateY(105%); transition: transform 0.3s; z-index: 3; }
  .side-panel.open { transform: none; }
  .hud-bottom { max-width: calc(100vw - 24px); min-width: 0; width: calc(100vw - 24px); }
  .hud-players { flex-direction: row; width: auto; right: 12px; left: 12px; top: 60px; overflow-x: auto; max-height: none; padding: 2px 2px 6px; }
  .pl { grid-template-columns: 32px auto; grid-template-rows: auto auto; min-width: 128px; padding: 4px 8px 4px 4px; }
  .pl img { width: 32px; height: 32px; grid-row: span 2; }
  .pl .money { text-align: left; font-size: 1rem; }
  .pl .sub, .pl .chips { display: none; }
  .pl.current { transform: translateY(2px); }
  .hud-tools { left: 12px; right: 12px; justify-content: flex-end; }
  .tr-cols { grid-template-columns: 1fr; }
  .tr-mid { justify-content: center; transform: rotate(90deg); }
  .chat-box { top: 122px; bottom: auto; width: calc(100vw - 24px); height: 40vh; z-index: 2; }
  .chat-box.collapsed { width: 104px; height: 38px; }
  /* sul telefono non c'è il passaggio del mouse: aperta, la chat è sempre una carta piena */
  #hud > .chat-box:not(.collapsed), .chat-box:not(.collapsed) .chat-body, .chat-box:not(.collapsed) .chat-list { pointer-events: auto; }
  .chat-box:not(.collapsed) { background: var(--paper), var(--card); border-color: rgba(31, 42, 36, 0.28); box-shadow: var(--lift); }
  .chat-box:not(.collapsed) .chat-head { color: var(--ink); text-shadow: none; }
  .chat-box:not(.collapsed) .chat-list { -webkit-mask-image: none; mask-image: none; }
  .chat-box:not(.collapsed) .chat-msg { background: var(--card-2); color: var(--ink); }
  .chat-box:not(.collapsed) .chat-msg b { color: var(--ink); }
  .chat-box:not(.collapsed) .chat-form input { background: var(--card-hi); border-color: var(--rule-2); color: var(--ink); }
  .chat-box:not(.collapsed) .chat-form .btn { --fg: var(--ink); --bd: var(--ink); }
  .chat-box:not(.collapsed) .empty-note { display: block; color: var(--ink-2); text-shadow: none; }
  #notify-root { top: 118px; }
  .build-sum { grid-template-columns: repeat(2, 1fr); }
  .bg-quick { margin-left: 0; }
  .banner img { width: 48px; height: 48px; }
}
@media (max-width: 520px) {
  body { font-size: 14px; }
  .home-body { padding: 16px 18px 18px; }
  .lobby-head { align-items: flex-start; }
  .lobby-foot { flex-wrap: wrap; }
  .lobby-foot .hint { order: -1; flex-basis: 100%; }
  .lobby-foot #btn-start { margin-left: auto; }
  .modal { padding: 16px; }
  .deed-modal { gap: 12px; }
}

/* movimento ridotto: niente entrate e respiri decorativi; avvisi e banner restano leggibili */
@media (prefers-reduced-motion: reduce) {
  .deal-in, .modal, .btn.pulse, .card3d .inner, .winner img, .winner .crown, .notif, .dice-readout, .audio-pop { animation: none !important; }
  .banner { animation-name: fadeHold !important; }
  .pl, .chat-box, .side-panel, .tile { transition: none !important; }
}
@keyframes fadeHold { 0% { opacity: 0; } 10%, 85% { opacity: 1; } 100% { opacity: 0; } }
