/* ============================================================
   GTNH CLICKER — Dark Theme
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:         #0f0f0f;
  --panel-bg:   #161616;
  --card-bg:    #1c1c1c;
  --border:     #2e2e2e;
  --border-lit: #555;
  --text:       #c8c8c8;
  --text-dim:   #666;
  --text-muted: #444;
  --orange:     #ff8800;
  --green:      #44cc44;
  --green-dark: #1a3a1a;
  --red:        #cc4444;
  --blue:       #4488cc;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Courier New', Courier, monospace;
  font-size: 13px;
  min-height: 100vh;
  overflow: hidden;
}

/* ---- HEADER ---- */
header {
  height: 42px;
  background: #111;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  flex-shrink: 0;
}
.header-title { font-size: 16px; color: var(--orange); letter-spacing: 3px; text-shadow: 0 0 12px #ff440033; }
.header-sub   { color: var(--text-dim); font-size: 11px; letter-spacing: 2px; }
.header-stats   { margin-left: auto; color: var(--text-muted); font-size: 10px; letter-spacing: 1px; }
.header-buttons { display: flex; gap: 6px; margin-left: 12px; }
.hdr-btn {
  padding: 3px 10px;
  background: #1e1e1e;
  border: 1px solid var(--border-lit);
  color: var(--text-dim);
  cursor: pointer;
  font-family: inherit;
  font-size: 10px;
  letter-spacing: 1px;
  transition: background 80ms, color 80ms;
}
.hdr-btn:hover          { background: #2a2a2a; color: var(--text); }
.hdr-btn-danger         { border-color: #553333; color: #885555; }
.hdr-btn-danger:hover   { background: #2a1a1a; color: var(--red); border-color: var(--red); }

/* ---- LAYOUT ---- */
.game {
  display: grid;
  grid-template-columns: 200px 220px 1fr 290px;
  grid-template-rows: calc(100vh - 42px - 72px) 72px;
  height: calc(100vh - 42px);
}

.panel {
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 12px;
}

#panel-machines {
  background: #131313;
}

/* ---- HEADINGS ---- */
h2 {
  font-size: 10px;
  color: var(--orange);
  text-transform: uppercase;
  letter-spacing: 3px;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
h3 {
  font-size: 9px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin: 12px 0 6px;
}

/* ---- ORE / MINING BUTTONS ---- */
.ore-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  margin-bottom: 4px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  text-align: left;
  transition: background 80ms, border-color 80ms;
  user-select: none;
  position: relative;
  overflow: hidden;
}
.ore-btn:hover:not(:disabled)  { background: #232323; border-color: var(--border-lit); }
.ore-btn:active:not(:disabled) { background: #2a2a2a; transform: scale(0.98); }
.ore-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.ore-icon       { width: 18px; height: 18px; border: 1px solid #333; flex-shrink: 0; image-rendering: pixelated; }
.ore-label      { flex: 1; }
.ore-count      { color: var(--text-muted); font-size: 10px; min-width: 24px; text-align: right; }
.ore-cd-bar {
  position: absolute;
  bottom: 0; left: 0;
  height: 2px;
  background: var(--orange);
  width: 0%;
}

/* ---- TOOLS LIST ---- */
.tool-row    { padding: 4px 0; border-bottom: 1px solid #1a1a1a; }
.tool-header { display: flex; align-items: center; gap: 7px; font-size: 11px; }
.tool-dot    { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.tool-dot.on  { background: var(--green); box-shadow: 0 0 5px #44cc4466; }
.tool-dot.off { background: #333; }
.tool-name   { flex: 1; }
.tool-name.dim { color: var(--text-muted); }
.tool-count  { color: var(--orange); font-size: 10px; }
.tool-dur-bar  { height: 3px; background: #1a1a1a; margin-top: 3px; }
.tool-dur-fill { height: 100%; background: var(--green); transition: width 0.3s; }

/* ---- INVENTORY SORT BAR ---- */
.inv-sort-bar { display: flex; gap: 4px; margin-bottom: 8px; }
.sort-btn {
  padding: 2px 8px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  color: var(--text-dim);
  cursor: pointer;
  font-family: inherit;
  font-size: 10px;
  letter-spacing: 1px;
  transition: background 80ms, color 80ms;
}
.sort-btn:hover  { background: #232323; color: var(--text); }
.sort-btn.active { border-color: var(--orange); color: var(--orange); background: #1a1200; }

/* ---- INVENTORY LIST ---- */
.inv-cat-header {
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin: 8px 0 2px;
  padding-bottom: 2px;
  border-bottom: 1px solid #1a1a1a;
}
.inv-cat-header:first-child { margin-top: 0; }
.inv-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 2px 0;
  border-bottom: 1px solid #1a1a1a;
  font-size: 12px;
}
.inv-qty  { color: var(--orange); min-width: 32px; text-align: right; flex-shrink: 0; }
.inv-name { color: var(--text); }
.inv-empty { color: var(--text-muted); font-size: 11px; padding: 4px 0; }

/* ---- PICKAXE STATUS ---- */
.pickaxe-row   { padding: 4px 0; border-bottom: 1px solid #1a1a1a; }
.pickaxe-header { display: flex; align-items: center; gap: 6px; font-size: 11px; }
.pickaxe-dot    { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.pickaxe-dot.on  { background: var(--orange); box-shadow: 0 0 5px #ff880055; }
.pickaxe-dot.off { background: #333; }
.pickaxe-label  { flex: 1; color: var(--text); }
.pickaxe-count  { color: var(--orange); font-size: 10px; }
.pickaxe-bar      { height: 4px; background: #1a1a1a; margin-top: 3px; }
.pickaxe-bar-dur  { margin-bottom: 2px; }
.pickaxe-bar-fill { height: 100%; background: var(--orange); transition: width 0.9s linear; }
.pickaxe-prog-fill { height: 100%; background: var(--green); transition: width 0.9s linear; }
.pickaxe-ops    { font-size: 9px; color: var(--text-muted); }

/* ---- CRAFTING CARDS ---- */
.craft-cols-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 8px;
}

.craft-section-label {
  font-size: 9px;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin: 10px 0 4px;
  padding-bottom: 3px;
  border-bottom: 1px solid #1a1a1a;
}
.craft-section-label:first-child { margin-top: 0; }

.recipe-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  padding: 5px 7px;
  margin-bottom: 3px;
}
.recipe-header     { display: flex; align-items: center; gap: 5px; margin-bottom: 3px; }
.recipe-name       { font-size: 11px; color: #ddd; flex: 1; }
.recipe-tool-badge { font-size: 8px; color: #777; background: #111; padding: 1px 4px; border: 1px solid var(--border); letter-spacing: 1px; }
.recipe-inputs     { font-size: 10px; margin-bottom: 3px; line-height: 1.6; }
.req-ok            { color: #66aa66; }
.req-missing       { color: #aa4444; }

.craft-btn {
  width: 100%;
  padding: 3px;
  background: #1a2a1a;
  border: 1px solid #2a4a2a;
  color: #66aa66;
  cursor: pointer;
  font-family: inherit;
  font-size: 10px;
  letter-spacing: 1px;
  transition: background 80ms;
}
.craft-btn:hover:not(:disabled) { background: #203020; border-color: #3a6a3a; color: var(--green); }
.craft-btn:active:not(:disabled) { background: #263626; }
.craft-btn:disabled { background: #111; border-color: #222; color: #444; cursor: not-allowed; }
.craft-btn.locked-btn { background: #111; border-color: #1e1e1e; color: #3a3a3a; cursor: not-allowed; }

/* ---- MACHINES PANEL ---- */
.machine-block {
  background: #0f1a1f;
  border: 1px solid #1e3040;
  padding: 8px 9px;
  margin-bottom: 6px;
}
.machine-header { display: flex; align-items: center; gap: 6px; margin-bottom: 5px; }
.machine-dot    { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.machine-dot.on  { background: var(--blue); box-shadow: 0 0 6px #4488cc88; }
.machine-dot.off { background: #333; }
.machine-label   { font-size: 11px; color: #aaa; flex: 1; letter-spacing: 1px; }
.machine-fuel    { font-size: 9px; color: #668899; }

.machine-inactive-msg { font-size: 10px; color: var(--text-muted); padding: 2px 0 4px; }

/* Machine recipe rows */
.machine-recipe-row  { margin-bottom: 5px; }
.machine-recipe-info {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  margin-top: 2px;
  flex-wrap: wrap;
}
.mrecipe-arrow     { color: #888; }
.mrecipe-threshold { color: #446688; font-size: 9px; }
.mrecipe-status    { font-size: 11px; margin-left: auto; }
.mrecipe-status.running { color: var(--blue); }
.mrecipe-status.blocked { color: #333; }

/* Progress bar */
.machine-progress-bar {
  height: 4px;
  background: #1a1a1a;
  border: 1px solid #222;
  overflow: hidden;
}
.machine-progress-fill {
  height: 100%;
  transition: width 0.9s linear;
}
.machine-progress-fill.running { background: var(--blue); }
.machine-progress-fill.idle    { background: #333; }

.furnace-queue { font-size: 9px; color: var(--text-muted); margin-top: 4px; }

/* ---- LOG ---- */
.log-panel {
  grid-column: 1 / -1;
  background: #0c0c0c;
  border-top: 1px solid var(--border);
  padding: 6px 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column-reverse;
}
.log-entry { font-size: 10px; color: var(--text-dim); line-height: 1.7; }
.log-time  { color: var(--text-muted); }
.log-item  { color: var(--orange); }
.log-good  { color: var(--green); }
.log-warn  { color: #cc9944; }
.log-auto  { color: var(--blue); }

/* ---- SCROLLBAR ---- */
::-webkit-scrollbar       { width: 3px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #2a2a2a; }

/* ---- FLOAT ANIMATION ---- */
.float-text {
  position: fixed;
  pointer-events: none;
  font-size: 11px;
  font-family: 'Courier New', monospace;
  color: var(--orange);
  animation: float-up 0.9s ease forwards;
  z-index: 999;
}
@keyframes float-up {
  0%   { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-36px); }
}
