/* Street Hustle - retro green terminal look, big text, works with mouse, keys and touch. */
:root {
  --green: #33ff66;
  --dim: #1d8a3f;
  --dark: #0f3d1c;
  --off: #1f5a2e;
  --amber: #ffcc33;
  --red: #ff5f5f;
  --bg: #040a05;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--green);
  font-family: Menlo, Monaco, Consolas, "Courier New", "DejaVu Sans Mono", monospace;
  font-size: clamp(13px, min(1.45vw, 2.5vh), 24px);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
body { overflow: hidden; }

button {
  font: inherit;
  color: var(--green);
  background: transparent;
  border: 0;
  padding: 0.05em 0.45em;
  cursor: pointer;
  text-align: left;
  touch-action: manipulation;
}
button:hover:not(:disabled) { background: var(--green); color: var(--bg); }
button:active:not(:disabled) { background: var(--amber); color: var(--bg); }
button:focus-visible { outline: 1px solid var(--amber); color: var(--amber); }
button:disabled { color: var(--off); cursor: default; }

#app {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 0.35em;
  padding: 0.6em 0.75em 0.5em;
}

.title-row { display: flex; justify-content: space-between; align-items: baseline; gap: 1em; }
h1 {
  margin: 0;
  font-size: 1.55em;
  font-weight: normal;
  color: var(--amber);
  text-shadow: 0 0 10px rgba(255, 204, 51, 0.45);
  letter-spacing: 0.04em;
}
.sub { color: var(--dim); white-space: nowrap; }

.box {
  position: relative;
  border: 1px solid var(--dim);
  padding: 0.25em 0.6em 0.4em;
  background: var(--bg);
}
.box-title { color: var(--amber); }

.status-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.05em 1em; }
.stat { white-space: nowrap; }
.stat .k { display: inline-block; min-width: 4.4em; }
.stat.bad { color: var(--red); }

.mid { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 0.4em; min-height: 0; }
#market, #coat { overflow-y: auto; }
#coat-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.box-inner { position: relative; }

.row {
  display: grid;
  width: 100%;
  white-space: nowrap;
  padding: 0.05em 0.45em 0.05em 1em;
}
.row.market { grid-template-columns: minmax(6em, 9em) 7em; }
.row.coat { grid-template-columns: minmax(6em, 9em) 4em 7em; }
.row .num { text-align: right; }
.row.head { color: var(--dim); }
.row.unsellable { color: var(--dim); }
.row.gun { color: var(--amber); }
.empty { color: var(--dim); padding-left: 1em; }

#log { height: 4.6em; overflow-y: auto; line-height: 1.15; }
#prompt { color: var(--dim); }
#cmds { display: flex; flex-wrap: wrap; gap: 0.3em 0.5em; }

/* ----------------------------------------------------------- dialogs */
#overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}
#overlay[hidden] { display: none; }
#dialog {
  position: relative;
  min-width: 32em;
  max-width: 94vw;
  max-height: 94vh;
  overflow: auto;
  background: var(--bg);
  border: 2px solid var(--green);
  padding: 0.6em 0.8em 0.8em;
}
#cop-art { display: none; position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#dialog.cops { min-width: 45em; min-height: 21em; }
#dialog.cops #cop-art { display: block; }
#dialog.cops #dialog-box { margin-right: 16.5em; position: relative; }
#dialog-box { position: relative; }
.d-title { font-size: 1.3em; color: var(--amber); }
.d-title.red { color: var(--red); }
.d-body { white-space: pre-wrap; max-width: 30em; margin: 0.1em 0 0.2em; }
.d-sep { border: 0; border-top: 1px solid #777; margin: 0.35em 0; }
.dbtn { display: block; width: 100%; padding: 0.12em 0.45em; }

.qty-row { display: flex; justify-content: center; align-items: center; gap: 0.35em; margin: 0.25em 0; }
.qbtn {
  min-width: 3.4em;
  min-height: 2.2em;
  text-align: center;
  border: 1px solid var(--dim);
}
.qbtn.wide { min-width: 7.5em; }
.qbtn.ok { border-color: var(--amber); color: var(--amber); }
.qval { font-size: 1.8em; color: var(--amber); min-width: 4.5em; text-align: center; }
.qhint { text-align: center; color: var(--dim); }

/* ----------------------------------------------------------- intro */
#intro {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: var(--bg);
  overflow: auto;
}
#intro[hidden] { display: none; }
#intro-art { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.intro-content {
  position: relative;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.7em;
  padding: 1.2em;
  text-align: center;
}
.intro-spacer { flex: 1; }
.intro-title {
  margin: 0;
  font-size: 3.4em;
  font-weight: normal;
  color: var(--amber);
  text-shadow: 0 0 14px rgba(255, 204, 51, 0.55), 0 0 30px rgba(255, 204, 51, 0.25);
  letter-spacing: 0.04em;
}
.intro-tag { margin: 0; }
.intro-box {
  text-align: left;
  border: 1px solid var(--dim);
  background: rgba(4, 10, 5, 0.85);
  padding: 0.6em 1em;
  max-width: 48em;
}
.intro-box ul { margin: 0.2em 0 0; padding-left: 1.2em; }
.intro-box li::marker { content: "* "; }
#start-btn {
  font-size: 1.3em;
  border: 2px solid var(--amber);
  color: var(--amber);
  padding: 0.35em 1.2em;
  text-align: center;
}
.settings-note { color: var(--red); font-size: 0.8em; }
.settings-note:empty { display: none; }
.credit { background: var(--bg); padding: 0.2em 0.6em; color: var(--green); font-size: 0.8em; }

/* ----------------------------------------------------------- phones */
@media (max-width: 760px), (orientation: portrait) and (max-width: 1000px) {
  html, body { font-size: 15px; }
  body { overflow: auto; }
  #app { height: auto; min-height: 100dvh; padding-bottom: 0; }
  .sub { display: none; }
  .status-grid { grid-template-columns: 1fr 1fr; }
  .mid { grid-template-columns: 1fr; flex: none; }
  #coat { min-height: 17em; }
  #market, #coat { overflow: visible; }
  .row:not(.head) { min-height: 2.3em; align-items: center; }
  #log { height: 7em; }
  #cmds {
    position: sticky;
    bottom: 0;
    background: var(--bg);
    border-top: 1px solid var(--dim);
    padding: 0.5em 0 calc(0.5em + env(safe-area-inset-bottom));
    z-index: 5;
  }
  #cmds button { min-width: 6.6em; min-height: 2.8em; border: 1px solid var(--dark); text-align: center; }
  #dialog { min-width: 0; width: 94vw; }
  .d-body { max-width: none; }
  .dbtn { min-height: 2.6em; }
  #dialog.cops { min-width: 0; min-height: 75vh; }
  #dialog.cops #dialog-box { margin-right: 0; }
  .intro-title { font-size: 2.6em; }
  .qbtn { min-width: 3em; min-height: 2.8em; }
}
