/* Terraform: the map is the game. A slim bar, a dock of five tools, a short problems list; nothing else. */
:root {
  color-scheme: light;
  --ground: #ebe6d6; --paper: #fbf8ef; --ink: #2b2337; --ink2: #5d566a; --line: #d8d0bd;
  --night: #2b2337; --amber: #f0a500; --amberInk: #7a4d00; --leaf: #4f9a3c;
  --glass: rgba(43,35,55,.86); --cream: #fff6d8;
  --num: 'JetBrains Mono', ui-monospace, Menlo, monospace;
  --pix: 'Silkscreen', 'JetBrains Mono', monospace;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: #1c2a3a; color: var(--ink); font: 15px/1.4 'Bricolage Grotesque', system-ui, sans-serif; display: flex; flex-direction: column; -webkit-tap-highlight-color: transparent; overscroll-behavior: none; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
h2 { margin: 0 0 10px; font: 400 22px var(--pix); text-wrap: balance; }

/* the bar: back, name, cash, goal, problems, new game */
.bar { display: flex; align-items: center; gap: 14px; padding: 6px 14px; padding-top: calc(6px + env(safe-area-inset-top, 0px)); background: var(--night); color: #f6efd9; }
.home { color: #f6efd9; text-decoration: none; font-size: 18px; opacity: .8; }
.brand { font: 400 16px var(--pix); display: flex; align-items: center; gap: 7px; margin: 0; }
.logo { width: 18px; height: 18px; background: url(favicon.svg) center / contain no-repeat; }
.cash { margin-left: auto; font: 600 20px var(--num); color: #ffd34d; font-variant-numeric: tabular-nums; }
.arr { font: 600 12px var(--num); opacity: .75; white-space: nowrap; }
.meters { display: flex; align-items: center; gap: 12px; min-width: 0; }
.meters .m { display: flex; align-items: center; gap: 5px; font: 600 11px var(--num); white-space: nowrap; }
.meters .m i { font-style: normal; font-size: 13px; }
.meters .m.ok { color: #a8e88a; }
.meters .won { font: 600 13px var(--num); color: #ffd34d; }
.gbar { width: 54px; height: 6px; background: rgba(255,255,255,.15); border-radius: 3px; overflow: hidden; flex: none; }
.gbar b { display: block; height: 100%; background: linear-gradient(90deg, #a5c94a, var(--leaf)); transition: width .6s; }
.chip { background: rgba(240,165,0,.16); border: 1px solid rgba(255,211,77,.5); color: #ffd34d; border-radius: 999px; padding: 3px 10px; font: 600 12px var(--num); white-space: nowrap; }
.chip.done { background: rgba(79,154,60,.25); border-color: #a8e88a; color: #a8e88a; }
.iconBtn { background: transparent; border: 0; color: #f6efd9; padding: 2px 4px; font-size: 16px; opacity: .8; }

.view { position: relative; flex: 1; min-height: 0; overflow: hidden; }
#iso { display: block; image-rendering: pixelated; touch-action: none; cursor: pointer; }

/* tools: one dock along the bottom */
.tools { position: absolute; left: 50%; bottom: calc(10px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); display: flex; gap: 4px; z-index: 3; padding: 4px; background: var(--glass); border-radius: 14px; box-shadow: 0 3px 0 rgba(0,0,0,.3); }
.tool { display: flex; flex-direction: column; align-items: center; width: 76px; padding: 2px 2px 4px; background: transparent; border: 0; border-radius: 10px; color: var(--cream); }
.tool:hover { background: rgba(255,246,216,.1); }
.tool .pic { width: 40px; height: 40px; background: url(art/tiles.png) no-repeat; background-size: 640px 400px; image-rendering: pixelated; }
.tool .name { font-weight: 700; font-size: 12px; line-height: 1.1; white-space: nowrap; }
.tool .price { font: 600 11px var(--num); color: #ffd34d; }
.tool.on { background: var(--amber); color: var(--night); }
.tool.on .price { color: var(--night); }
.tool.poor { opacity: .5; }
/* pictures: the bottom 64x64 of a 64x128 atlas sprite at 40px, ground layered under the overlay */
.pic.panel { background-image: url(art/tiles.png), url(art/tiles.png); background-position: -40px -280px, 0 -40px; }
.pic.dc { background-image: url(art/extra.png), url(art/tiles.png); background-size: 680px 80px, 640px 400px; background-position: 0 -40px, 0 -40px; }
.pic.fuel { background-image: url(art/tiles.png), url(art/tiles.png); background-position: -360px -280px, 0 -40px; }
.pic.desal { background-image: url(art/tiles.png), url(art/tiles.png); background-position: -400px -280px, 0 -40px; }
.pic.remove { background: none; display: grid; place-items: center; font-size: 24px; }

/* the guide: two lines at the top */
.hint { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); z-index: 2; background: var(--glass); color: var(--cream); padding: 8px 12px; border-radius: 12px; width: min(440px, calc(100% - 20px)); box-shadow: 0 3px 0 rgba(0,0,0,.3); font-size: 14px; }
.hint .hRow { display: flex; align-items: center; gap: 8px; }
.hint h4 { margin: 0; font-size: 15px; flex: 1; }
.hint p { margin: 3px 0 0; line-height: 1.35; opacity: .85; }
.hint .cStep { font: 600 11px var(--num); color: #ffd34d; }
.hint .sp { font: 600 12px var(--num); color: #ffd34d; } .hint .sp.ok { color: #a8e88a; }
.hint .skip { background: none; border: 0; color: var(--cream); opacity: .55; font-size: 12px; text-decoration: underline; padding: 0; }
.hint .cRow { display: flex; justify-content: flex-end; margin-top: 6px; }
.toast { position: absolute; left: 50%; bottom: 92px; transform: translateX(-50%); z-index: 4; background: #3d6b2f; color: #fff; padding: 6px 14px; border-radius: 10px; font-weight: 700; font-size: 14px; pointer-events: none; box-shadow: 0 3px 0 rgba(0,0,0,.3); max-width: calc(100% - 20px); text-align: center; }

/* map buttons: small, bottom right */
.zoom { position: absolute; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom, 0px)); display: flex; gap: 4px; z-index: 3; padding: 4px; background: var(--glass); border-radius: 12px; }
.zoom button { width: 32px; height: 32px; border-radius: 8px; border: 0; background: transparent; color: var(--cream); font: 600 17px system-ui, sans-serif; }
.zoom button:hover { background: rgba(255,246,216,.12); }

/* problems: one line each, top right */
.probs { position: absolute; right: 10px; top: 10px; z-index: 2; width: 250px; max-height: calc(100% - 80px); overflow-y: auto; background: var(--glass); color: var(--cream); border-radius: 12px; padding: 6px; box-shadow: 0 3px 0 rgba(0,0,0,.3); }
.probs ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }
.probs li { display: grid; grid-template-columns: 20px 1fr auto; grid-template-rows: auto auto; column-gap: 6px; align-items: center; padding: 4px 6px 5px; border-radius: 8px; font-size: 13px; cursor: pointer; }
.probs li:hover { background: rgba(255,246,216,.1); }
.probs li i { font-style: normal; grid-row: 1 / 3; text-align: center; }
.probs .pn { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.probs .pv { font: 600 11px var(--num); color: #ffd34d; white-space: nowrap; }
.probs .pBar { grid-column: 2 / 4; height: 3px; margin-top: 3px; background: rgba(255,246,216,.15); border-radius: 2px; overflow: hidden; }
.probs .pBar b { display: block; height: 100%; background: #ffd34d; transition: width .6s; }
.probs li.ok { color: #a8e88a; } .probs li.ok i { grid-row: 1; }
.probs .tick { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--leaf); color: #fff; font: 800 12px/1 system-ui, sans-serif; }

/* the card for one thing you built: top left, clear of the list */
.info { position: absolute; left: 10px; top: 10px; z-index: 3; width: min(300px, calc(100% - 20px)); background: var(--paper); border: 2px solid var(--night); border-radius: 12px; padding: 10px 12px; box-shadow: 0 3px 0 rgba(0,0,0,.3); font-size: 14px; }
.info h3 { margin: 0 0 4px; font: 400 15px var(--pix); }
.info p { margin: 4px 0 0; }
.info .blurb { margin: 0; color: var(--ink2); font-size: 13px; }
.info .why { font-size: 12px; color: var(--ink2); }
.info .x { position: absolute; right: 6px; top: 4px; border: 0; background: none; font-size: 15px; }
.pips i { font-style: normal; filter: grayscale(1); opacity: .35; } .pips i.on { filter: none; opacity: 1; }

.go { background: var(--amber); color: #2a1a00; border: 0; border-radius: 10px; padding: 8px 14px; font-weight: 800; box-shadow: 0 3px 0 #a26f00; }
.ghost { background: transparent; border: 1px solid var(--line); border-radius: 10px; padding: 7px 12px; }
.modal { position: fixed; inset: 0; background: rgba(43,35,55,.6); display: grid; place-items: center; padding: 16px; z-index: 20; }
.modal .card { background: var(--paper); border-radius: 16px; padding: 22px; width: min(480px, 100%); border: 3px solid var(--night); box-shadow: 0 6px 0 rgba(0,0,0,.35); }
.modal .row { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 14px; }
.modal .small { font-size: 13px; margin: 14px 0 0; } .modal .small a { color: var(--ink2); }
.win { text-align: center; } .winList { list-style: none; padding: 0; margin: 10px auto; text-align: left; display: inline-block; line-height: 1.6; } .winList li { padding-left: 1.3em; text-indent: -1.3em; } .winList b { color: #5fd38a; margin-right: 4px; } .win .trophy { font-size: 64px; line-height: 1; } .win .row { justify-content: center; }

.fb { position: fixed; left: 50%; bottom: 14%; transform: translateX(-50%); width: min(560px, calc(100vw - 32px)); z-index: 60; background: var(--paper); border: 3px solid var(--night); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 8px; box-shadow: 0 6px 0 rgba(0,0,0,.35); }
.fbKinds { display: flex; gap: 8px; flex-wrap: wrap; }
.fbKind { border: 1px solid var(--line); background: var(--ground); border-radius: 999px; padding: 6px 12px; }
.fbKind.on { background: var(--amber); border-color: var(--amberInk); font-weight: 600; }
.fb textarea { font: inherit; border: 1px solid var(--line); border-radius: 8px; padding: 8px; resize: vertical; }
.fbRow { display: flex; gap: 8px; align-items: center; } .fbRow .muted { margin-right: auto; font-size: 12px; color: var(--ink2); }

/* mid widths: the map buttons go up the right edge, clear of the dock */
@media (max-width: 900px) {
  .zoom { flex-direction: column; bottom: 84px; }
}
/* phones: the dock spans the bottom, the list hides behind the chip */
@media (max-width: 700px) {
  .bar { gap: 10px; padding: 6px 10px; padding-top: calc(6px + env(safe-area-inset-top, 0px)); }
  .brand { display: none; }
  .cash { margin-left: 0; font-size: 18px; }
  .arr { display: none; }
  .meters { flex: 1; gap: 6px; justify-content: space-between; }
  .meters .m em { display: none; }
  .gbar { width: auto; flex: 1; min-width: 18px; }
  .meters .m { flex: 1; min-width: 0; }
  .tools { left: 6px; right: 6px; transform: none; justify-content: space-between; }
  .tool { flex: 1; width: auto; min-width: 0; }
  .tool .name { font-size: 10.5px; letter-spacing: -.02em; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .tool { padding-left: 0; padding-right: 0; }
  .zoom { right: 6px; bottom: 84px; }
  .toast { bottom: 84px; }
  .hint { top: 6px; }
  .info { left: 6px; right: 6px; top: 6px; width: auto; }
  .probs { top: 6px; right: 6px; left: auto; width: min(280px, calc(100% - 12px)); z-index: 4; }
}
