:root {
  color-scheme: dark;
  --bg: #000000;
  --surface: #0b0c0a;
  --surface-2: #11130f;
  --surface-3: #171a14;
  --line: #2a2d27;
  --line-strong: #454a40;
  --text: #eeeeea;
  --muted: #9a9e94;
  --signal: #c6ff4a;
  --warn: #ffb800;
  --bad: #ff4f45;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, .98), rgba(0, 0, 0, .22) 30%, rgba(0, 0, 0, .22) 70%, rgba(0, 0, 0, .98)),
    url("/assets/griftfall-backdrop.svg") center top / min(1500px, 100vw) auto no-repeat,
    var(--bg);
  color: var(--text);
  font-family: "IBM Plex Mono", "JetBrains Mono", "Courier New", monospace;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

button,
input {
  font: inherit;
}

button {
  min-height: 32px;
  border: 1px solid var(--line-strong);
  border-radius: 0;
  background: linear-gradient(#171914, #0b0c0a);
  color: var(--text);
  cursor: pointer;
}

button:hover:not(:disabled),
button:focus-visible,
button.active {
  border-color: var(--signal);
  color: var(--signal);
  outline: none;
}

button:disabled {
  color: #676a63;
  cursor: not-allowed;
}

input {
  width: 100%;
  height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 0;
  background: #000000;
  color: var(--text);
  padding: 0 10px;
}

input:focus {
  border-color: var(--signal);
  outline: none;
}

.game-shell {
  width: min(920px, calc(100vw - 24px));
  margin: 28px auto 40px;
  border: 1px solid var(--line-strong);
  background: rgba(7, 8, 6, .94);
}

.masthead {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 16px;
  min-height: 70px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-strong);
  background: linear-gradient(#171914, #090a08);
}

.brand {
  color: var(--signal);
  font-size: 30px;
  font-weight: 700;
  line-height: .92;
}

.server,
.identity span,
.status-cell span,
dt,
.job-tile-meta span,
.job-tile-odds,
.target-copy p,
.feedback span,
.trial-panel span,
.shop-item span,
.town-grid span,
.bottom-bars span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.identity {
  display: grid;
  gap: 5px;
  min-width: 160px;
  text-align: right;
}

.identity span:first-child {
  color: var(--text);
}

.main-menu {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border-bottom: 1px solid var(--line-strong);
}

.main-menu button {
  min-height: 46px;
  border: 0;
  border-right: 1px solid var(--line);
}

.main-menu button:last-child {
  border-right: 0;
}

.status-strip {
  display: grid;
  grid-template-columns: 82px minmax(180px, 1fr) 120px minmax(180px, 1fr);
  border-bottom: 1px solid var(--line-strong);
  background: #070806;
}

.status-cell {
  min-height: 54px;
  padding: 10px 12px;
  border-right: 1px solid var(--line);
}

.status-cell:last-child {
  border-right: 0;
}

.status-cell strong {
  display: block;
  margin-top: 5px;
  font-size: 20px;
}

.bar {
  position: relative;
  height: 9px;
  margin-top: 9px;
  border: 1px solid var(--line-strong);
  background: #030403;
  overflow: hidden;
}

.bar i {
  display: block;
  width: var(--value, 0%);
  height: 100%;
  background: var(--signal);
  transition: width 260ms linear;
}

.streak-bar i {
  background: var(--warn);
}

.risk-bar i {
  background: var(--bad);
}

.cooldown-bar i {
  background: var(--signal);
}

.game-frame {
  padding: 10px;
}

.content-panel {
  min-height: 420px;
  border: 1px solid var(--line);
  background: rgba(13, 14, 12, .96);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 46px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 16px;
}

h2 {
  margin-bottom: 10px;
  font-size: 13px;
}

.job-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  min-height: 286px;
}

.job-left {
  border-right: 1px solid var(--line);
}

.target-card {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 14px;
  padding: 14px;
}

.target-art {
  min-height: 154px;
  border: 1px solid var(--line-strong);
  background:
    linear-gradient(135deg, rgba(198, 255, 74, .16), transparent 32%),
    linear-gradient(0deg, #050605, #141711);
  display: grid;
  place-items: center;
}

.target-art span {
  width: 86px;
  height: 86px;
  border: 1px solid #3a4035;
  background:
    linear-gradient(90deg, transparent 48%, #2b3028 48% 52%, transparent 52%),
    linear-gradient(0deg, transparent 48%, #2b3028 48% 52%, transparent 52%),
    #090a08;
}

.target-copy {
  min-width: 0;
}

.target-copy p {
  min-height: 42px;
  margin: 0 0 12px;
}

.compact-stats,
.run-list,
.data-list {
  margin: 0;
}

.compact-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--line);
}

.compact-stats div,
.run-list div,
.data-list div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border-top: 1px solid var(--line);
}

.compact-stats div {
  display: block;
  border-top: 0;
  border-right: 1px solid var(--line);
}

.compact-stats div:nth-child(2n) {
  border-right: 0;
}

.compact-stats div:nth-child(n + 3) {
  border-top: 1px solid var(--line);
}

dd {
  margin: 0;
  text-align: right;
}

.compact-stats dd {
  margin-top: 5px;
  text-align: left;
}

.trial-panel {
  display: grid;
  grid-template-columns: 1fr 150px auto;
  gap: 10px;
  align-items: end;
  margin: 0 14px 14px;
  padding: 12px;
  border: 1px solid var(--warn);
  background: #120f04;
}

.trial-panel[hidden] {
  display: none;
}

.trial-panel label {
  display: grid;
  gap: 6px;
}

.trial-panel label span {
  color: var(--warn);
}

.job-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px 14px;
}

#run-selected {
  min-width: 116px;
}

.job-actions span {
  color: var(--muted);
  font-size: 11px;
}

.job-right {
  padding: 12px;
}

.feedback {
  min-height: 116px;
  padding: 12px;
  border: 1px solid var(--line-strong);
  background: #030403;
}

.feedback strong {
  display: block;
  margin-bottom: 8px;
  font-size: 17px;
}

.feedback.success strong {
  color: var(--signal);
}

.feedback.fail strong {
  color: var(--bad);
}

.feedback.trial strong {
  color: var(--warn);
}

.feedback.pulse {
  animation: feedback-pulse 220ms linear;
}

@keyframes feedback-pulse {
  0% {
    border-color: var(--text);
  }
  100% {
    border-color: var(--line-strong);
  }
}

.run-list {
  margin-top: 12px;
  border: 1px solid var(--line);
}

.run-list div:first-child,
.data-list div:first-child {
  border-top: 0;
}

.job-picker {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border-top: 1px solid var(--line);
}

.job-tile {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-height: 82px;
  padding: 10px;
  border: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.job-tile:last-child {
  border-right: 0;
}

.job-tile.selected {
  background: #151811;
}

.job-tile.locked {
  color: #676a63;
}

.job-tile-text,
.job-tile-text strong,
.job-tile-meta,
.job-tile-odds,
.shop-item strong,
.town-grid strong {
  display: block;
}

.job-tile-text strong {
  margin-bottom: 6px;
}

.job-tile-meta {
  display: grid;
  gap: 2px;
}

.job-tile-odds {
  margin-top: 8px;
  color: var(--signal);
}

.bottom-bars {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: 12px;
}

.stats-view {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stats-view section {
  min-height: 250px;
  padding: 14px;
  border-right: 1px solid var(--line);
}

.stats-view section:last-child {
  border-right: 0;
}

.data-list {
  border: 1px solid var(--line);
}

.town-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.town-grid button {
  min-height: 145px;
  padding: 18px 12px;
  border: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: center;
}

.town-grid button:last-child {
  border-right: 0;
}

.town-grid strong {
  margin-bottom: 9px;
  font-size: 15px;
}

.shop-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.shop-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 86px;
  padding: 12px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.shop-item:nth-child(2n) {
  border-right: 0;
}

.shop-item strong {
  margin-bottom: 5px;
}

.activity-log {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.activity-log li {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}

[hidden] {
  display: none !important;
}

@media (max-width: 860px) {
  .game-shell {
    margin-top: 12px;
  }

  .status-strip,
  .job-layout,
  .target-card,
  .stats-view,
  .town-grid,
  .shop-list,
  .bottom-bars {
    grid-template-columns: 1fr;
  }

  .job-left,
  .stats-view section,
  .shop-item {
    border-right: 0;
  }

  .job-picker {
    grid-template-columns: 1fr;
  }

  .main-menu {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .masthead {
    grid-template-columns: 1fr;
  }

  .identity {
    text-align: left;
  }

  .main-menu {
    grid-template-columns: 1fr 1fr;
  }

  .status-cell {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .trial-panel {
    grid-template-columns: 1fr;
  }
}
