:root {
  --paper: #f2eee3;
  --ink: #273034;
  --muted: #747d7f;
  --line: #d8d2c4;
  --orange: #e4683e;
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  min-height: 100%;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: var(--paper);
}
button {
  font: inherit;
  color: inherit;
}
.factory-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: 74px minmax(0, 1fr) 34px;
}
.topbar {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 0 20px;
  background: #fbf9f2;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 220px;
  letter-spacing: 0.12em;
}
.brand > i {
  font-size: 28px;
  color: var(--orange);
}
.brand span {
  font-size: 18px;
  font-weight: 800;
}
.brand span > b {
  font-weight: 400;
}
.brand small {
  display: block;
  font-size: 8px;
  color: var(--muted);
  margin-top: 3px;
}
.stats {
  display: flex;
  justify-content: center;
  flex: 1;
  gap: 8px;
}
.stats span {
  min-width: 130px;
  padding: 7px 14px;
  border-left: 1px solid var(--line);
}
.stats small {
  display: block;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.13em;
  color: var(--muted);
}
.stats b {
  font-size: 18px;
}
.head-actions {
  display: flex;
  gap: 6px;
}
.head-actions button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
}
.factory-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(620px, 1fr) 370px;
}
.main-floor {
  overflow: auto;
  padding: 26px;
  background: repeating-linear-gradient(
    0deg,
    #eee9dd 0,
    #eee9dd 32px,
    #e8e2d5 33px
  );
}
.floor-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}
.floor-head small,
.tab header small {
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.18em;
  color: var(--muted);
}
.floor-head h1 {
  font:
    32px/1 Georgia,
    serif;
  margin: 5px 0;
}
.floor-head p {
  margin: 0;
  color: #667174;
  font:
    13px/1.4 Georgia,
    serif;
}
.buy-modes {
  display: flex;
  background: #ded8cb;
  padding: 4px;
  border-radius: 8px;
}
.buy-modes button {
  border: 0;
  padding: 7px 10px;
  background: transparent;
  font-size: 9px;
  font-weight: 900;
  cursor: pointer;
}
.buy-modes button.active {
  background: #273034;
  color: white;
  border-radius: 5px;
}
.lines {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  gap: 12px;
}
.ink-line {
  --colour: #888;
  position: relative;
  display: grid;
  grid-template-columns: 1.25fr 1fr 105px;
  gap: 12px;
  align-items: center;
  padding: 14px;
  background: #fbfaf5;
  border: 1px solid #cec7b8;
  border-left: 7px solid var(--colour);
  box-shadow: 0 4px 0 #d6d0c2;
  overflow: hidden;
}
.ink-line.locked {
  filter: saturate(0.35);
  opacity: 0.78;
}
.ink-id {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.ink-id > i {
  width: 38px;
  height: 38px;
  border-radius: 50% 45% 52% 42%;
  background: var(--colour);
  box-shadow: inset 8px 7px 0 rgba(255, 255, 255, 0.18);
  transform: rotate(-8deg);
  flex: none;
}
.ink-line.special .ink-id > i,
.ink-line.special .run {
  background: var(--special);
}
.ink-id span > * {
  display: block;
}
.ink-id small {
  font-size: 7px;
  color: var(--muted);
  font-weight: 900;
  letter-spacing: 0.12em;
}
.ink-id b {
  font:
    18px Georgia,
    serif;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ink-id em {
  font-size: 8px;
  color: #6c7575;
  font-style: normal;
}
.production {
  display: grid;
  grid-template-columns: 48px 1fr;
  align-items: center;
  gap: 8px;
}
.run {
  height: 46px;
  border: 0;
  border-radius: 50%;
  background: var(--colour);
  color: #fff;
  font-size: 9px;
  font-weight: 900;
  box-shadow: 0 3px 0 #777;
  cursor: pointer;
}
.run:disabled {
  opacity: 0.58;
}
.production strong,
.production small {
  display: block;
}
.production strong {
  font-size: 12px;
}
.production small {
  font-size: 8px;
  color: var(--muted);
}
.production i {
  display: block;
  height: 6px;
  background: #ddd7ca;
  margin-top: 5px;
  overflow: hidden;
}
.production i span {
  display: block;
  height: 100%;
  background: var(--colour);
  transition: width 0.08s linear;
}
.buy {
  border: 0;
  background: #273034;
  color: white;
  padding: 9px 7px;
  cursor: pointer;
  box-shadow: 3px 3px 0 var(--colour);
}
.buy span,
.buy b {
  display: block;
}
.buy span {
  font-size: 7px;
  letter-spacing: 0.1em;
}
.buy b {
  font-size: 11px;
  margin-top: 2px;
}
.milestone {
  position: absolute;
  right: 10px;
  bottom: 3px;
  font-size: 6px;
  font-weight: 900;
  letter-spacing: 0.07em;
  color: #9a9285;
}
.ink-line.paid {
  animation: paid 0.28s;
}
@keyframes paid {
  50% {
    background: #fff7c7;
    transform: scale(1.007);
  }
}
.control-panel {
  background: #faf8f1;
  border-left: 1px solid var(--line);
  overflow: auto;
}
.control-panel > nav {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  position: sticky;
  top: 0;
  background: #faf8f1;
  z-index: 4;
}
.control-panel > nav button {
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 15px 4px;
  background: transparent;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.08em;
  cursor: pointer;
}
.control-panel > nav button.active {
  background: #273034;
  color: white;
}
.tab {
  display: none;
  padding: 20px;
}
.tab.active {
  display: block;
}
.tab header h2 {
  font:
    25px Georgia,
    serif;
  margin: 5px 0;
}
.tab header p {
  font:
    12px/1.4 Georgia,
    serif;
  color: #6c7575;
}
.shop-list {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}
.shop-list button {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 10px;
  text-align: left;
  padding: 10px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
}
.shop-list button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}
.shop-list i {
  width: 30px;
  height: 30px;
  border-radius: 50%;
}
.shop-list .gear {
  display: grid;
  place-content: center;
  background: #273034;
  color: white;
  font-style: normal;
}
.shop-list span > * {
  display: block;
}
.shop-list b {
  font-size: 10px;
}
.shop-list small {
  font-size: 8px;
  color: var(--muted);
}
.shop-list strong {
  font-size: 9px;
}
.prestige-card {
  margin-top: 20px;
  padding: 18px;
  border: 2px solid #273034;
  background: #fff;
  box-shadow: 7px 7px 0 #e4d3a1;
}
.prestige-card > * {
  display: block;
}
.prestige-card > span {
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.15em;
  color: var(--orange);
}
.prestige-card > b {
  font:
    27px Georgia,
    serif;
  margin: 6px 0;
}
.prestige-card > strong {
  font-size: 11px;
  color: #28875f;
}
.prestige-card p {
  font-size: 10px;
  color: var(--muted);
  line-height: 1.4;
}
.prestige-card button {
  width: 100%;
  border: 0;
  background: #273034;
  color: #fff;
  padding: 12px;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.08em;
  cursor: pointer;
}
.prestige-card button:disabled {
  background: #bbb;
}
.prestige-notes {
  display: grid;
  gap: 7px;
  margin-top: 20px;
  font-size: 10px;
}
.prestige-notes b {
  font-size: 8px;
  letter-spacing: 0.12em;
}
.prestige-notes span {
  color: #4e675e;
}
footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: #273034;
  color: #e9e5d9;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.1em;
}
.welcome {
  position: fixed;
  inset: 0;
  display: grid;
  place-content: center;
  background: rgba(239, 234, 221, 0.94);
  z-index: 50;
  text-align: center;
}
.welcome.hidden {
  display: none;
}
.welcome > div {
  width: min(430px, 90vw);
  padding: 34px;
  background: #fbfaf5;
  border: 1px solid #c9c1b2;
  box-shadow: 12px 12px 0 rgba(39, 48, 52, 0.14);
}
.welcome small {
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.2em;
}
.welcome h2 {
  font:
    48px Georgia,
    serif;
  margin: 5px;
}
.welcome h2 em {
  color: var(--orange);
  font-weight: 400;
}
.welcome p {
  font:
    14px Georgia,
    serif;
}
.welcome button {
  border: 0;
  background: #273034;
  color: white;
  padding: 13px 22px;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.1em;
  cursor: pointer;
}
.welcome span {
  display: block;
  margin-top: 12px;
  font-size: 9px;
  color: #28875f;
}
.toast {
  position: fixed;
  left: 50%;
  bottom: 46px;
  transform: translate(-50%, 20px);
  padding: 10px 16px;
  background: #273034;
  color: #fff;
  opacity: 0;
  pointer-events: none;
  transition: 0.2s;
  z-index: 60;
  font-size: 10px;
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
@media (max-width: 1000px) {
  .factory-grid {
    grid-template-columns: 1fr 320px;
  }
  .lines {
    grid-template-columns: 1fr;
  }
  .stats span:nth-child(3),
  .stats span:nth-child(4) {
    display: none;
  }
}
@media (max-width: 720px) {
  .factory-shell {
    grid-template-rows: 62px auto 30px;
  }
  .topbar {
    padding: 0 8px;
    gap: 8px;
  }
  .brand {
    min-width: 135px;
  }
  .brand span {
    font-size: 13px;
  }
  .brand small {
    display: none;
  }
  .stats span {
    min-width: 84px;
    padding: 5px;
  }
  .stats span:nth-child(2) {
    display: none;
  }
  .factory-grid {
    display: block;
  }
  .main-floor {
    padding: 13px;
  }
  .floor-head {
    align-items: flex-start;
    flex-direction: column;
  }
  .floor-head h1 {
    font-size: 25px;
  }
  .lines {
    grid-template-columns: 1fr;
  }
  .ink-line {
    grid-template-columns: 1.15fr 1fr 90px;
    padding: 11px 8px;
  }
  .control-panel {
    border-left: 0;
    border-top: 2px solid #273034;
    max-height: none;
  }
  .control-panel > nav {
    top: 62px;
  }
  .control-panel .tab {
    padding: 16px;
  }
  footer {
    padding: 0 8px;
  }
  footer span:nth-child(2) {
    display: none;
  }
}
