html, body { margin:0; padding:0; width:100%; height:100%; }
body {
  background: #0a0f0a radial-gradient(1200px 800px at 50% 10%, rgba(20,40,20,.15), transparent);
  color: #9cff86;
  font-family: "VT323", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 22px;
  letter-spacing: 0.5px;
  text-shadow: 0 0 3px rgba(156,255,134,0.4);
}
#app {
  display: grid;
  grid-template-columns: 1fr 1.5fr 1fr;
  gap: 8px;
  width: 100%;
  height: 100vh;
  box-sizing: border-box;
  padding: 8px;
}
.panel {
  border: 2px solid #1f3b1f;
  background: linear-gradient(180deg, rgba(10,20,10,0.7), rgba(8,16,8,0.7));
  box-shadow: inset 0 0 0 1px rgba(156,255,134,0.08);
  display: flex; flex-direction: column; min-width: 0;
}
.panel-title {
  padding: 8px 10px;
  border-bottom: 2px solid #1f3b1f;
  color: #c0ffba;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.kv-list { padding: 8px; display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; }
.kv-list .k { opacity: .8 }
.kv-list .v { text-align: right; }

.pop-wrap { padding: 8px; display: grid; gap: 6px; }
.pop-line { display: flex; justify-content: space-between; }

.controls { padding: 8px; display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; }
.btn {
  background: rgba(18,36,18,0.8);
  border: 2px solid #214421;
  color: #b7ffac;
  padding: 10px 12px;
  cursor: pointer;
  transition: transform .02s ease, background .15s ease;
  min-height: 44px;
}
.btn:hover { background: rgba(28,54,28,0.9); }
.btn:active { transform: translateY(1px); }
.btn.warn { border-color: #4a1f1f; color: #ffb0b0; }
.btn.ghost { background: transparent; }

.cards {
  padding: 8px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 8px;
  overflow-y: auto;
}
.card {
  border: 2px solid #1f3b1f;
  padding: 8px;
  display: grid;
  gap: 6px;
  background: rgba(10,20,10,0.6);
}
.card .title { font-size: 24px; color: #caffc5; }
.card .desc { opacity: .85; }
.card .cost { opacity: .85; }
.card .level { opacity: .9; }
.card .actions { display:flex; gap:8px; }
.card button { width: 100%; }

.tip { padding: 8px; opacity: .75; }

.right .log {
  padding: 8px;
  overflow-y: auto;
  white-space: pre-line;
  flex: 1;
  line-height: 1.2;
}
.right .kv-list { border-bottom: 2px solid #1f3b1f; padding-bottom: 12px; margin-bottom: 6px; }

.modal {
  position: fixed; inset: 0;
  display: grid; place-items: center;
  background: rgba(0,0,0,0.5);
}
.modal.hidden { display: none; }
.modal-box {
  width: min(560px, 92vw);
  border: 2px solid #1f3b1f;
  background: rgba(6,14,6,.95);
  padding: 12px;
  box-shadow: 0 0 0 1px rgba(156,255,134,0.08), 0 20px 60px rgba(0,0,0,.6);
}
.modal-title { font-size: 28px; margin-bottom: 8px; color: #caffc5; }
.modal-body { opacity: .9; margin-bottom: 12px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; }

@media (max-width: 980px) {
  #app { grid-template-columns: 1fr; grid-auto-rows: minmax(0, 1fr); height: 100svh; }
  .cards { grid-template-columns: 1fr; }
}

/* subtle CRT scanlines + flicker */
.panel, .modal-box, .log, .cards, .kv-list, .controls, .pop-wrap, .tip {
  position: relative;
}
.panel::after, .modal-box::after {
  content: "";
  position: absolute; inset: 0;
  background: repeating-linear-gradient( to bottom, rgba(0,0,0,.06), rgba(0,0,0,.06) 1px, transparent 2px, transparent 3px );
  pointer-events: none;
  mix-blend-mode: multiply;
}