:root {
  --glass: rgba(14, 30, 26, .68);
  --line: rgba(255, 255, 255, .10);
  --hover: rgba(255, 255, 255, .09);
  --text: #f1f7ee;
  --muted: #9fb8a8;
  --accent: #c5f467;
  --accent-ink: #17300f;
  --gold: #ffe27a;
  --radius: 18px;
  --gap: 12px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font: 13px/1.4 "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  color: var(--text);
  background: #0e4370;
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

/* La mappa occupa tutto lo schermo; i pannelli galleggiano sopra */
#stage { position: fixed; inset: 0; }
#view { width: 100%; height: 100%; display: block; cursor: crosshair; touch-action: none; }

.pill, .panel, #hint {
  background: var(--glass);
  border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  backdrop-filter: blur(16px) saturate(1.4);
  box-shadow: 0 10px 32px rgba(0, 20, 30, .35), inset 0 1px 0 rgba(255, 255, 255, .06);
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  border-radius: 10px;
  padding: 5px 10px;
  cursor: pointer;
  transition: background .15s, color .15s, transform .1s;
}
button:hover { background: var(--hover); }
button:active { transform: scale(.96); }
button.on {
  background: linear-gradient(180deg, #d6fb85, #a8e84f);
  color: var(--accent-ink);
  font-weight: 600;
  box-shadow: 0 2px 10px rgba(180, 240, 90, .35);
}

h3 {
  margin: 14px 4px 6px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}
h3:first-child { margin-top: 2px; }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .18); border-radius: 3px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---- barra superiore ---- */
#topbar {
  position: fixed;
  top: var(--gap); left: var(--gap); right: var(--gap);
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 8px;
  pointer-events: none;
  white-space: nowrap;
  z-index: 3;
}
#topbar > * { pointer-events: auto; }
.pill { display: flex; align-items: center; border-radius: 999px; padding: 6px 14px; }
.brand { font-size: 16px; font-weight: 800; letter-spacing: -.01em; gap: 6px; }
.brand .logo em { font-style: normal; color: var(--accent); }
a.brand { text-decoration: none; color: var(--text); }
.stats { gap: 18px; padding: 6px 18px; }
.stat { display: flex; align-items: center; gap: 8px; }
.stat i { font-style: normal; font-size: 18px; }
.stat small { display: block; font-size: 10px; color: var(--muted); letter-spacing: .04em; line-height: 1.2; }
.stat b { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.25; }
#money.bad { color: #ff9a8a; }
.daybar { width: 62px; height: 5px; margin-top: 5px; background: rgba(255, 255, 255, .12); border-radius: 3px; overflow: hidden; }
.daybar u { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #ffd35a, #ff9d4a); border-radius: 3px; }
.stepper { display: flex; align-items: center; gap: 2px; }
.stepper b { min-width: 38px; text-align: center; }
.stepper button { width: 20px; height: 20px; padding: 0; line-height: 18px; border-radius: 50%; background: var(--hover); }
.stepper button:hover { background: rgba(255, 255, 255, .2); }
.spacer { flex: 1; }
.seg { display: flex; gap: 2px; padding: 4px; }
.seg button { min-width: 34px; padding: 5px 8px; border-radius: 999px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---- pannelli laterali ---- */
.panel {
  position: fixed;
  top: var(--panel-top, 76px); bottom: 58px;
  border-radius: var(--radius);
  padding: 12px 10px;
  overflow-y: auto;
  z-index: 2;
}
#tools { left: var(--gap); width: 232px; bottom: auto; max-height: calc(100vh - var(--panel-top, 76px) - 58px); }
#side { right: var(--gap); width: 268px; display: flex; flex-direction: column; }

.tool {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  margin-bottom: 2px;
  padding: 6px 8px;
  text-align: left;
}
.tool .sw {
  width: 20px; height: 20px;
  border-radius: 7px;
  flex: none;
  font-size: 15px; line-height: 20px; text-align: center;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .28), inset 0 -6px 8px rgba(0, 0, 0, .14);
}
.tool .sw.ic { box-shadow: none; }
.tool .nm { flex: 1; }
.tool .cs { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tool.on .cs { color: #3d5a22; }

/* ---- obiettivi ---- */
#goals { flex: none; }
#goals .bar { height: 5px; background: rgba(0, 0, 0, .3); border-radius: 3px; overflow: hidden; margin: 5px 0 3px; }
#goals .bar i { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, #a8e84f, #d6fb85); transition: width .4s; }
#goals small { display: block; color: var(--muted); font-size: 11px; line-height: 1.3; }
.rank {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  padding: 8px 10px;
  margin-bottom: 5px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(255, 226, 122, .2), rgba(255, 157, 74, .1));
  border: 1px solid rgba(255, 226, 122, .3);
}
.rank b { font-size: 14px; color: var(--gold); }
.rank span { font-weight: 700; font-variant-numeric: tabular-nums; }
.rank .bar, .rank > small { grid-column: span 2; }
.rank .bar i { background: linear-gradient(90deg, #ffd35a, #ff9d4a) !important; }
.goal {
  display: flex;
  gap: 9px;
  padding: 7px 9px;
  margin-bottom: 4px;
  background: rgba(255, 255, 255, .05);
  border-radius: 12px;
}
.goal > i { font-style: normal; font-size: 20px; line-height: 1.2; }
.goal > div { flex: 1; min-width: 0; }
.goal .pr { display: flex !important; justify-content: space-between; font-variant-numeric: tabular-nums; }
.goal .rw { color: var(--gold); font-weight: 700; }

#toasts {
  position: fixed;
  top: calc(var(--panel-top, 76px) + 8px); left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  z-index: 5;
}
.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 22px 10px 16px;
  border-radius: 999px;
  color: #2a2100;
  background: linear-gradient(180deg, #ffeb9a, #ffc94a);
  box-shadow: 0 12px 36px rgba(255, 190, 60, .45), 0 0 0 1px rgba(255, 255, 255, .5) inset;
  animation: toast 4.6s cubic-bezier(.2, 1.4, .4, 1) both;
}
.toast i { font-style: normal; font-size: 28px; }
.toast small { display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; opacity: .7; }
.toast b { font-size: 15px; }
@keyframes toast {
  0% { opacity: 0; transform: translateY(-24px) scale(.8); }
  8%, 88% { opacity: 1; transform: none; }
  100% { opacity: 0; transform: translateY(-12px) scale(.96); }
}

/* ---- elenco buche ---- */
#holes { max-height: 26%; overflow-y: auto; flex: none; }
.hole {
  display: grid;
  grid-template-columns: 26px 1fr auto;
  gap: 0 9px;
  align-items: center;
  padding: 7px 9px;
  margin-bottom: 4px;
  background: rgba(255, 255, 255, .05);
  border-radius: 12px;
  cursor: pointer;
  transition: background .15s;
}
.hole:hover { background: rgba(255, 255, 255, .12); }
.hole .n {
  grid-row: span 2;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: linear-gradient(180deg, #ff7262, #e2463a);
  font-weight: 800;
  text-align: center;
  line-height: 26px;
  box-shadow: 0 2px 8px rgba(226, 70, 58, .4);
}
.hole small { color: var(--muted); font-size: 11px; }
.hole .mood { grid-row: span 2; font-size: 19px; }
.empty { color: var(--muted); padding: 4px; }

#golferCard:empty { display: none; }
#golferCard {
  flex: none;
  margin-top: 10px;
  padding: 9px 11px;
  background: rgba(255, 226, 122, .10);
  border: 1px solid rgba(255, 226, 122, .35);
  border-radius: 12px;
  font-size: 12px;
}
#golferCard b { font-size: 13px; }
#golferCard .bar { height: 6px; background: rgba(0, 0, 0, .3); border-radius: 3px; margin: 3px 0 6px; overflow: hidden; }
#golferCard .bar i { display: block; height: 100%; background: linear-gradient(90deg, #a8e84f, #d6fb85); border-radius: 3px; }

#log { flex: 1; overflow-y: auto; min-height: 60px; font-size: 12px; }
#log div {
  padding: 6px 9px;
  margin-bottom: 3px;
  border-radius: 9px;
  border-left: 3px solid rgba(255, 255, 255, .18);
  background: rgba(255, 255, 255, .035);
  color: #d5e3d6;
}
#log div.bad { border-left-color: #ff8a7a; color: #ffc4ba; }
#log div.good { border-left-color: var(--accent); }

/* ---- suggerimenti ---- */
#hint {
  position: fixed;
  left: 50%; bottom: var(--gap);
  transform: translateX(-50%);
  max-width: calc(100vw - 2 * var(--gap));
  padding: 8px 18px;
  border-radius: 999px;
  color: #cfe0d2;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  z-index: 3;
}
#hint.flash { color: #ffd9a8; font-weight: 600; border-color: rgba(255, 190, 120, .5); }

/* Schermi stretti: pannelli più compatti */
@media (max-width: 900px) {
  #tools { width: 168px; }
  #side { width: 210px; }
}

/* ---- nuovi elementi della barra ---- */
.ic { width: 18px; height: 18px; display: block; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
#moreBtn .ic circle { fill: currentColor; stroke: none; }
#saveBar { align-items: center; }
#saveBar button { min-width: 34px; display: flex; align-items: center; justify-content: center; }
#menu { display: flex; gap: 2px; }
#menu .lbl, #saveBar #moreBtn { display: none; }
#manageBtn { gap: 6px; }
#saveBar button:disabled { opacity: .35; cursor: default; transform: none; background: none; }
#manageBtn { font-weight: 600; }
#manageBtn:hover { background: rgba(40, 60, 52, .8); }
#cond.bad { color: #ffb38a; }
.hole .dif { font-size: 8px; letter-spacing: 1px; color: #ffd36b; vertical-align: 1px; margin-left: 2px; }
.hole .dif i { font-style: normal; color: rgba(255, 255, 255, .18); }
.gtype { font-size: 11px; color: var(--gold); }
.pill.mobile { display: none; }

/* ---- finestre ---- */
#modal {
  position: fixed; inset: 0;
  z-index: 10;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  background: rgba(4, 18, 24, .45);
}
#modal[hidden] { display: none; }
#modalBody {
  position: relative; top: auto; bottom: auto;
  width: min(680px, 100%);
  max-height: min(88vh, 760px);
  padding: 16px 20px 18px;
  background: rgba(14, 30, 26, .92);
  user-select: text;
}
#modalBody header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
#modalBody h2 { margin: 0; font-size: 18px; }
#modalBody .x { font-size: 16px; width: 32px; height: 32px; padding: 0; border-radius: 50%; }
#modalBody h3 { margin-top: 18px; }
#modalBody .note { color: var(--muted); font-size: 12px; margin: 4px 0 8px; }
#modalBody table { width: 100%; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; margin-top: 6px; }
#modalBody th { text-align: left; color: var(--muted); font-weight: 600; font-size: 11px; padding: 4px 6px; border-bottom: 1px solid var(--line); }
#modalBody td { padding: 4px 6px; border-bottom: 1px solid rgba(255, 255, 255, .05); }
#modalBody details { margin-top: 12px; }
#modalBody summary { cursor: pointer; color: var(--muted); font-size: 12px; }
.neg { color: #ffb08f; }
.pos { color: #b8f08a; }
.tabs { display: flex; gap: 4px; padding: 4px; margin-bottom: 12px; background: rgba(0, 0, 0, .22); border-radius: 999px; }
.tabs button { flex: 1; border-radius: 999px; font-weight: 600; }
button.go {
  background: linear-gradient(180deg, #d6fb85, #a8e84f);
  color: var(--accent-ink); font-weight: 700; padding: 7px 16px; border-radius: 999px;
}
button.go:disabled, .stepper button:disabled { opacity: .4; cursor: default; filter: grayscale(.6); transform: none; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 8px; }
.tile { padding: 8px 10px; border-radius: 12px; background: rgba(255, 255, 255, .05); }
.tile small { display: block; color: var(--muted); font-size: 11px; }
.tile b { font-size: 16px; font-variant-numeric: tabular-nums; }
.tile.neg b { color: #ffb08f; }
.tile.pos b { color: #b8f08a; }

.chartBox { margin-top: 4px; }
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid { stroke: rgba(255, 255, 255, .08); stroke-width: 1; }
.chart .base { stroke: rgba(255, 255, 255, .35); stroke-width: 1; }
.chart .ax { fill: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; }
.chart .pos { fill: #2f9e6c; }
.chart .neg { fill: #d95926; }
.chart .one { fill: #3987e5; }
.chart .hit { fill: transparent; }
.chart .bar:hover path { filter: brightness(1.25); }
.chart .bar:hover .hit { fill: rgba(255, 255, 255, .05); }
#chartTip {
  position: absolute; z-index: 11; pointer-events: none;
  padding: 6px 10px; border-radius: 8px; max-width: 320px;
  background: #f1f7ee; color: #17241a; font-size: 12px; font-weight: 600;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .35);
}
#chartTip[hidden] { display: none; }

.cond { padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, .05); margin-bottom: 10px; }
.cond small { display: block; color: var(--muted); font-size: 11px; }
.cond b { font-size: 15px; }
.cond .bar { height: 7px; margin: 6px 0; border-radius: 4px; overflow: hidden; background: rgba(0, 0, 0, .3); }
.cond .bar i { display: block; height: 100%; background: linear-gradient(90deg, #6fcf5a, #b8f08a); }
.cond .bar i.low { background: linear-gradient(90deg, #d97b3a, #f0b25a); }
.staff, .tier {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; margin-bottom: 6px;
  border-radius: 12px; background: rgba(255, 255, 255, .05);
}
.staff > i, .tier > i { font-style: normal; font-size: 26px; }
.staff > div:nth-child(2), .tier > div { flex: 1; min-width: 0; }
.staff small, .tier small { display: block; color: var(--muted); font-size: 11.5px; line-height: 1.35; }
.staff small.wage { display: inline; color: var(--gold); }
.tier small.why { color: #ffc59a; }
.stepper.big b { min-width: 26px; font-size: 16px; }
.stepper.big button { width: 28px; height: 28px; font-size: 16px; line-height: 26px; }
.live { padding: 9px 12px; border-radius: 12px; margin-bottom: 8px; background: rgba(255, 226, 122, .14); border: 1px solid rgba(255, 226, 122, .35); }
.board tr.done td { color: var(--muted); }

.maps { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 8px; }
.map {
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px;
  padding: 10px 12px; text-align: left; border-radius: 14px;
  background: rgba(255, 255, 255, .05); border: 1px solid transparent;
}
.map i { font-style: normal; font-size: 26px; }
.map b { font-size: 14px; }
.map small { color: var(--muted); font-size: 11.5px; line-height: 1.35; }
.map small.money { color: var(--gold); }
.map.on { background: rgba(197, 244, 103, .14); border-color: var(--accent); color: inherit; box-shadow: none; }
.map.on small { color: #cfe0d2; }
.tutOpt { display: flex; align-items: center; gap: 8px; margin-top: 12px; color: #cfe0d2; cursor: pointer; }
#modalBody footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }

/* ---- tutorial ---- */
#tutorial {
  position: fixed; left: 50%; bottom: 60px; transform: translateX(-50%);
  z-index: 6;
  display: flex; align-items: center; gap: 14px;
  width: min(560px, calc(100vw - 24px));
  padding: 12px 14px 12px 16px;
  border-radius: 18px;
  background: rgba(255, 250, 230, .97); color: #1f2a1c;
  box-shadow: 0 14px 40px rgba(0, 20, 30, .45);
  animation: tutIn .35s cubic-bezier(.2, 1.3, .4, 1) both;
}
#tutorial[hidden] { display: none; }
#tutorial > i { font-style: normal; font-size: 30px; }
#tutorial > div:nth-child(2) { flex: 1; min-width: 0; }
#tutorial small { display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #6b7a5a; }
#tutorial b { font-size: 15px; }
#tutorial p { margin: 3px 0 0; font-size: 13px; line-height: 1.4; }
#tutorial .prog { text-transform: none; letter-spacing: 0; color: #4c7a2a; margin-top: 3px; }
#tutorial .acts { display: flex; flex-direction: column; gap: 4px; align-items: stretch; }
#tutorial .acts button:not(.go) { font-size: 11.5px; color: #5b6650; }
#tutorial .acts button:not(.go):hover { background: rgba(0, 0, 0, .06); }
@keyframes tutIn { from { opacity: 0; transform: translate(-50%, 16px); } to { opacity: 1; transform: translate(-50%, 0); } }
.tut-glow { position: relative; animation: glow 1.2s ease-in-out infinite; border-radius: 12px; }
@keyframes glow {
  0%, 100% { box-shadow: 0 0 0 2px rgba(255, 226, 122, .9), 0 0 0 0 rgba(255, 226, 122, .6); }
  50% { box-shadow: 0 0 0 2px rgba(255, 226, 122, 1), 0 0 18px 6px rgba(255, 226, 122, .55); }
}

/* ---- telefoni: barra compatta e pannelli a scomparsa ---- */
@media (max-width: 700px) {
  :root { --gap: 8px; }
  #topbar {
    top: max(var(--gap), env(safe-area-inset-top)); left: max(var(--gap), env(safe-area-inset-left)); right: max(var(--gap), env(safe-area-inset-right));
    gap: 6px;
  }
  .brand, .spacer { display: none; }
  /* Indicatori su una griglia 3×2: icona e valore, senza etichette */
  .stats {
    flex: 1 1 100%;
    display: grid; grid-template-columns: repeat(3, 1fr);
    gap: 4px 6px; padding: 6px 10px; border-radius: 16px;
  }
  .stat { gap: 5px; min-width: 0; }
  .stat i { font-size: 14px; }
  .stat small { display: none; }
  .stat b { font-size: 13px; }
  #dayStat small { display: block; font-size: 11px; color: var(--text); font-weight: 700; white-space: nowrap; }
  #dayStat .season { display: none; }
  .daybar { width: 48px; margin-top: 3px; }
  .stepper b { min-width: 30px; }
  /* Seconda riga: velocità, gestione e azioni */
  #speed { flex: 1; justify-content: space-between; padding: 3px; }
  #speed button { flex: 1; min-width: 0; padding: 5px 4px; }
  #manageBtn { padding: 6px 12px; font-size: 16px; }
  #manageBtn .lbl { display: none; }
  #saveBar { position: relative; padding: 3px; }
  #saveBar > button { min-width: 36px; }
  #saveBar #moreBtn { display: flex; }
  #topbar { z-index: 6; }
  /* Le altre azioni in un menu a tendina con le etichette */
  #menu {
    display: none;
    position: absolute; top: calc(100% + 8px); right: 0;
    flex-direction: column; align-items: stretch;
    min-width: 210px; padding: 6px;
    border-radius: 16px; border: 1px solid var(--line);
    background: rgba(14, 30, 26, .95);
    box-shadow: 0 14px 36px rgba(0, 15, 25, .5);
    -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  }
  #saveBar.open #menu { display: flex; }
  #saveBar.open #moreBtn { background: var(--hover); }
  #saveBar #menu button { justify-content: flex-start; gap: 12px; padding: 10px 12px; font-size: 14px; text-align: left; }
  /* Avvisi più piccoli, per non coprire mezza mappa */
  .toast { padding: 7px 16px 7px 12px; gap: 9px; max-width: calc(100vw - 32px); }
  .toast i { font-size: 20px; }
  .toast b { font-size: 13px; }
  .toast small { font-size: 9.5px; }
  #menu .lbl { display: inline; }
  .panel { bottom: calc(68px + env(safe-area-inset-bottom)); }
  #tools, #side { display: none; width: min(280px, calc(100vw - 24px)); }
  body.show-tools #tools, body.show-side #side { display: flex; flex-direction: column; z-index: 4; }
  body.show-tools #tools { display: block; }
  .pill.mobile {
    display: block; position: fixed; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 5;
    font-size: 20px; width: 48px; height: 48px; padding: 0; border-radius: 50%;
  }
  #toggleTools { left: max(var(--gap), env(safe-area-inset-left)); }
  #toggleSide { right: max(var(--gap), env(safe-area-inset-right)); }
  body.show-tools #toggleTools, body.show-side #toggleSide { background: rgba(197, 244, 103, .3); border-color: var(--accent); }
  #hint { display: none; }
  #tutorial { bottom: calc(68px + env(safe-area-inset-bottom)); }
  #modalBody { padding: 14px; }
}
@media (max-width: 1380px) and (min-width: 701px) {
  .brand { display: none; }
}

/* ---- sfide, pensieri, prestiti ---- */
.challenge {
  padding: 8px 10px; margin-bottom: 5px; border-radius: 12px;
  background: linear-gradient(135deg, rgba(120, 190, 255, .18), rgba(120, 190, 255, .06));
  border: 1px solid rgba(140, 200, 255, .35);
}
.challenge small { display: block; color: #a9d4ff !important; font-weight: 700; font-size: 10.5px !important; letter-spacing: .04em; }
.challenge b { display: block; font-size: 12px; font-weight: 600; line-height: 1.35; margin: 2px 0; }
.challenge small.pr { color: var(--muted) !important; font-weight: 500; letter-spacing: 0; }
.challenge.won { background: linear-gradient(135deg, rgba(255, 226, 122, .22), rgba(255, 157, 74, .08)); border-color: rgba(255, 226, 122, .45); }
.challenge.won small { color: var(--gold) !important; }
.challenge.lost { opacity: .6; }
.hole .notes { grid-column: 2 / span 2; display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.hole .notes span { font-size: 10.5px; padding: 1px 7px; border-radius: 999px; background: rgba(255, 255, 255, .07); }
.hole .notes span.bad { background: rgba(255, 140, 110, .16); color: #ffcdbd; }
.hole .notes span.ok { background: rgba(170, 235, 110, .14); color: #d6f5b8; }
.warn { margin-top: 10px; padding: 9px 12px; border-radius: 12px; background: rgba(255, 120, 90, .14); border: 1px solid rgba(255, 140, 110, .4); color: #ffd3c4; }
.loan { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; padding: 9px 12px; border-radius: 12px; background: rgba(255, 255, 255, .05); }
.loan > div { flex: 1 1 220px; }
.loan small { display: block; color: var(--muted); font-size: 11.5px; }
.loan button { background: rgba(255, 255, 255, .08); border-radius: 999px; font-weight: 600; font-size: 12px; }
.loan button:disabled { opacity: .35; cursor: default; transform: none; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; box-shadow: 0 0 0 1px rgba(255, 255, 255, .3); }
.tabBody footer { display: flex; justify-content: flex-end; margin-top: 12px; }
.tabBody footer button { background: rgba(255, 255, 255, .08); border-radius: 999px; font-weight: 600; }
.tabs button { padding: 5px 4px; font-size: 12.5px; }
.fleet { display: flex; gap: 4px; margin-top: 5px; }
.fleet i { width: 14px; height: 9px; border-radius: 3px; }
.fleet i.free { background: #6fcf5a; }
.fleet i.out { background: #ffd36b; }
.fleet i.slot { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25); }
.tabs { overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: 1 0 auto; white-space: nowrap; }

/* ---- scheda di un edificio ---- */
#bpop {
  position: fixed; top: 120px; left: 240px; bottom: auto;
  width: 290px; padding: 12px 14px 14px;
  z-index: 6;
  background: rgba(14, 30, 26, .9);
  user-select: text;
}
#bpop[hidden] { display: none; }
#bpop header { display: flex; align-items: center; gap: 9px; margin-bottom: 6px; }
#bpop header i { font-style: normal; font-size: 24px; }
#bpop header b { flex: 1; font-size: 15px; }
#bpop .x { width: 28px; height: 28px; padding: 0; border-radius: 50%; }
#bpop .desc { margin: 0 0 8px; color: var(--muted); font-size: 12px; line-height: 1.4; }
#bpop .kv { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; border-bottom: 1px solid rgba(255, 255, 255, .06); font-size: 12.5px; }
#bpop .kv span { color: var(--muted); }
#bpop .kv b { text-align: right; font-variant-numeric: tabular-nums; }
#bpop .fleet { margin: 4px 0 8px; }
#bpop .acts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; }
#bpop .acts button { background: rgba(255, 255, 255, .08); border-radius: 999px; font-weight: 600; font-size: 12px; }
#bpop .acts button:disabled { opacity: .35; cursor: default; transform: none; }
#bpop .acts.price { justify-content: space-between; }
#bpop .acts.price span { color: var(--muted); font-size: 12.5px; }
#bpop .acts.price .stepper button { padding: 0; }
#bpop .foot { margin-top: 10px; color: var(--muted); font-size: 11px; }
#bpop .demolish span { flex: 1 1 100%; font-size: 12px; color: #ffd3c4; }
#bpop button.danger { background: #d9573f; color: #fff; }
#bpop button.danger.ghost { background: rgba(255, 120, 90, .14); color: #ffc4b4; }
@media (max-width: 700px) {
  #bpop {
    left: max(8px, env(safe-area-inset-left)); right: max(8px, env(safe-area-inset-right)); top: auto;
    bottom: calc(68px + env(safe-area-inset-bottom)); width: auto; max-height: 55vh; overflow-y: auto;
  }
}

/* Saldo previsto oggi, sotto i fondi */
.stat .net { display: block; font-size: 10.5px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; }
.stat .net.pos { color: #b8f08a; }
.stat .net.neg { color: #ffb08f; }
@media (max-width: 700px) {
  .stat .net { font-size: 9.5px; }
}
#bpop .acts button.go { background: linear-gradient(180deg, #d6fb85, #a8e84f); color: var(--accent-ink); font-weight: 700; padding: 7px 14px; }
#bpop .acts button.go:disabled { opacity: .4; filter: grayscale(.6); }

/* ---- pannello strumenti a griglia ---- */
#toolList { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
#toolList h3 { grid-column: 1 / -1; margin: 8px 4px 2px; }
#toolList h3:first-child { margin-top: 0; }
.tool {
  flex-direction: column; justify-content: center; gap: 3px;
  width: auto; margin: 0; padding: 7px 2px 6px; text-align: center; border-radius: 12px; min-width: 0;
}
.tool .sw { width: 24px; height: 24px; font-size: 19px; line-height: 24px; border-radius: 8px; }
.tool .nm { flex: none; font-size: 11px; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.tool .cs { font-size: 9.5px; line-height: 1; }
#brushBar {
  position: fixed; left: 50%; bottom: 58px; transform: translateX(-50%); z-index: 3;
  align-items: center; gap: 2px; padding: 4px 4px 4px 14px;
}
#brushBar[hidden] { display: none; }
#brushBar span { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-right: 6px; }
#brushBar button { min-width: 44px; }
.swatch { display: inline-block; width: 22px; height: 22px; border-radius: 7px; vertical-align: middle; box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .5); }
@media (max-width: 900px) and (min-width: 701px) { #tools { width: 210px; } }
@media (max-width: 700px) {
  #tools { bottom: auto; max-height: calc(100vh - var(--panel-top, 76px) - 76px - env(safe-area-inset-bottom)); }
  #toolList { grid-template-columns: repeat(4, 1fr); }
  #brushBar { bottom: calc(14px + env(safe-area-inset-bottom)); }
}

/* ---- invito ad aggiungere alla schermata Home ---- */
.tier.step > i {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 30px; height: 30px; border-radius: 50%; font-size: 15px; font-weight: 800;
  background: var(--accent); color: var(--accent-ink);
}
.tier.step small { font-size: 14px; color: inherit; }
.tier.step svg.ico { width: 18px; height: 18px; vertical-align: -3px; color: #4ea3ff; }

/* Icona di Abbassa: la montagna di Alza a testa in giù */
.flipv { display: inline-block; transform: scaleY(-1); }
