/* INSTALL CLICKER — PressWord admin parody. The CSS is the art budget. */
:root {
  --pw-dark: #1d2327;
  --pw-darker: #101517;
  --pw-blue: #2271b1;
  --pw-blue-dark: #135e96;
  --pw-bg: #f0f0f1;
  --pw-card: #fff;
  --pw-border: #c3c4c7;
  --pw-text: #1d2327;
  --pw-muted: #646970;
  --pw-green: #00a32a;
  --pw-red: #d63638;
  --pw-yellow: #dba617;
  --sidebar-w: 165px;
  --adminbar-h: 32px;
}
* { box-sizing: border-box; }
.hidden { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  font: 13px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, sans-serif;
  background: var(--pw-bg);
  color: var(--pw-text);
  padding-top: var(--adminbar-h);
}

/* ---- admin bar ---- */
#adminbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--adminbar-h);
  background: var(--pw-dark); color: #c3c4c7; z-index: 50;
  display: flex; align-items: center; gap: 14px; padding: 0 12px;
  font-size: 12px; white-space: nowrap; overflow: hidden;
}
#adminbar .logo { color: #fff; font-weight: 600; }
#adminbar .logo::before { content: "Ⓟ "; color: #72aee6; }
#ticker { flex: 1; overflow: hidden; color: #a7aaad; font-style: italic; }
#ticker span { display: inline-block; animation: tickerfade 0.6s; }
@keyframes tickerfade { from { opacity: 0; transform: translateY(6px); } }
#saveState { color: #72aee6; }

/* ---- sidebar ---- */
#sidebar {
  position: fixed; top: var(--adminbar-h); bottom: 0; left: 0; width: var(--sidebar-w);
  background: var(--pw-dark); color: #c3c4c7; padding-top: 8px; z-index: 40;
}
#sidebar .item {
  padding: 8px 12px; cursor: pointer; display: flex; justify-content: space-between; align-items: center;
}
#sidebar .item:hover { background: var(--pw-darker); color: #72aee6; }
#sidebar .item.active { background: var(--pw-blue); color: #fff; font-weight: 600; }
#sidebar .badge {
  background: var(--pw-red); color: #fff; border-radius: 9px; padding: 0 6px;
  font-size: 11px; font-weight: 600; min-width: 18px; text-align: center;
}
#sidebar .badge.ok { background: #50575e; }
#sidebar .foot { position: absolute; bottom: 10px; left: 12px; right: 12px; font-size: 11px; color: #646970; }
#sidebar .foot a { color: #72aee6; cursor: pointer; text-decoration: none; }
#sidebar .foot .credit { margin-top: 10px; padding-top: 8px; border-top: 1px solid #2c3338; color: #50575e; line-height: 1.5; }
#sidebar .foot .credit b { color: #787c82; }

/* ---- main ---- */
#main { margin-left: var(--sidebar-w); padding: 20px 24px 80px; max-width: 1100px; }
h1.pagetitle { font-size: 23px; font-weight: 400; margin: 0 0 4px; }
.subtitle { color: var(--pw-muted); margin-bottom: 16px; }
.subtitle .ver { background: #e5e5e5; border-radius: 3px; padding: 1px 6px; font-family: monospace; }

/* notice banners */
.notice {
  background: #fff; border-left: 4px solid var(--pw-yellow);
  box-shadow: 0 1px 1px rgba(0,0,0,.04); padding: 10px 14px; margin: 0 0 14px;
  display: flex; align-items: center; gap: 12px;
}
.notice.error { border-left-color: var(--pw-red); }
.notice.hidden { display: none; }

/* stats */
#stats { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.stat {
  background: var(--pw-card); border: 1px solid var(--pw-border); border-radius: 2px;
  padding: 12px 16px;
}
.stat .label { color: var(--pw-muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.stat .value { font-size: 26px; font-weight: 600; line-height: 1.2; }
.stat .sub { color: var(--pw-muted); font-size: 12px; }
.stat.installs .value { font-size: 34px; color: var(--pw-blue-dark); }
.stat .stars { color: var(--pw-yellow); letter-spacing: 1px; }

/* actions */
#actions { display: flex; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; align-items: stretch; }
button {
  font: inherit; cursor: pointer; border-radius: 3px; border: 1px solid var(--pw-blue);
  background: #f6f7f7; color: var(--pw-blue); padding: 6px 14px;
}
button:hover:not(:disabled) { background: #f0f6fb; }
button:disabled { opacity: .45; cursor: default; }
button.primary { background: var(--pw-blue); color: #fff; }
button.primary:hover:not(:disabled) { background: var(--pw-blue-dark); }
#clickBtn {
  font-size: 18px; font-weight: 600; padding: 18px 34px; position: relative;
  background: var(--pw-blue); color: #fff; border: none; border-radius: 4px;
  box-shadow: 0 2px 0 var(--pw-blue-dark);
}
#clickBtn:active { transform: translateY(1px); box-shadow: 0 1px 0 var(--pw-blue-dark); }
.floater {
  position: absolute; left: 50%; top: -4px; color: #fff; font-size: 13px; font-weight: 400;
  pointer-events: none; animation: floatup 0.8s forwards; text-shadow: 0 1px 2px rgba(0,0,0,.4);
}
@keyframes floatup { to { transform: translate(-50%, -28px); opacity: 0; } }

/* panels */
#panels { display: grid; grid-template-columns: 1.2fr 1fr; gap: 16px; align-items: start; }
.panel { background: var(--pw-card); border: 1px solid var(--pw-border); border-radius: 2px; }
.panel h2 {
  font-size: 14px; margin: 0; padding: 10px 14px; border-bottom: 1px solid var(--pw-border);
  background: #f6f7f7;
}
.row {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 10px 14px; border-bottom: 1px solid #f0f0f1;
}
.row:last-child { border-bottom: none; }
.row .info { flex: 1; min-width: 0; }
.row .name { font-weight: 600; }
.row .name .count { color: var(--pw-muted); font-weight: 400; }
.row .desc { color: var(--pw-muted); font-size: 12px; }
.row .rate { color: var(--pw-green); font-size: 12px; white-space: nowrap; }
.row button { white-space: nowrap; min-width: 110px; }
.row.locked { display: none; }

/* upgrades */
.upg { padding: 10px 14px; border-bottom: 1px solid #f0f0f1; }
.upg:last-child { border-bottom: none; }
.upg .head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.upg .name { font-weight: 600; }
.upg .desc { font-size: 12px; }
.upg .flavor { color: var(--pw-muted); font-size: 12px; font-style: italic; }
.upg.bought { opacity: .65; }
.upg.bought .name::after { content: " ✓"; color: var(--pw-green); }
.upg.tombstone .name::after { content: " 🪦"; }
.upg.locked { display: none; }

/* spotlight ticket */
#spotlight {
  position: fixed; right: 18px; bottom: 64px; width: 320px; z-index: 60;
  background: #fff; border: 1px solid var(--pw-border); border-top: 3px solid var(--pw-red);
  box-shadow: 0 4px 16px rgba(0,0,0,.18); padding: 12px 14px; border-radius: 3px;
  animation: tickerfade .4s;
}
#spotlight.hidden { display: none; }
#spotlight .from { font-size: 11px; color: var(--pw-muted); text-transform: uppercase; letter-spacing: .04em; }
#spotlight .body { margin: 6px 0 10px; font-size: 13px; }

/* toasts */
#toasts { position: fixed; left: calc(var(--sidebar-w) + 16px); bottom: 16px; z-index: 70; display: flex; flex-direction: column; gap: 8px; max-width: 420px; }
.toast {
  background: var(--pw-dark); color: #fff; padding: 10px 14px; border-radius: 3px;
  box-shadow: 0 4px 12px rgba(0,0,0,.25); font-size: 13px; animation: tickerfade .4s;
}
.toast.milestone { background: var(--pw-blue-dark); }
.toast.core { background: #7a5b00; }

/* modal + ending */
.overlay {
  position: fixed; inset: 0; background: rgba(16,21,23,.75); z-index: 100;
  display: flex; align-items: center; justify-content: center;
}
.overlay.hidden { display: none; }
.modal {
  background: #fff; border-radius: 4px; max-width: 480px; padding: 26px 30px;
  box-shadow: 0 10px 40px rgba(0,0,0,.4);
}
.modal h2 { margin-top: 0; }
.modal .actionsrow { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
#ending .modal { text-align: center; max-width: 540px; }
#ending .big { font-size: 42px; margin: 10px 0; }
#deactivateBtn {
  background: var(--pw-red); border-color: var(--pw-red); color: #fff;
  font-size: 16px; padding: 10px 26px;
}
.credits { text-align: left; font-size: 12px; color: var(--pw-muted); max-height: 180px; overflow: auto; margin-top: 14px; border-top: 1px solid var(--pw-border); padding-top: 10px; }

@media (max-width: 880px) {
  #panels { grid-template-columns: 1fr; }
  #stats { grid-template-columns: 1fr 1fr; }
  :root { --sidebar-w: 0px; }
  #sidebar { display: none; }
  #toasts { left: 16px; }
}
