.gp-game {
  display: grid;
  gap: 14px;
}

.gp-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: stretch;
}

.gp-brand,
.gp-score {
  min-width: 0;
  border: 1px solid #d6deea;
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}

.gp-brand {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.gp-factory-icon {
  position: relative;
  width: 48px;
  height: 48px;
  border: 1px solid #9fb0c5;
  border-radius: 8px;
  background:
    linear-gradient(180deg, #f8fafc 0 42%, #dbe5ef 42% 100%);
  overflow: hidden;
}

.gp-factory-icon::before {
  content: "";
  position: absolute;
  left: 7px;
  right: 7px;
  bottom: 7px;
  height: 17px;
  border-radius: 5px 5px 3px 3px;
  background: #0f766e;
}

.gp-factory-icon span:first-child {
  position: absolute;
  left: 9px;
  top: 11px;
  width: 12px;
  height: 24px;
  border-radius: 10px 10px 0 0;
  border: 4px solid #2563eb;
  border-right: 0;
}

.gp-factory-icon span:last-child {
  position: absolute;
  right: 9px;
  top: 11px;
  width: 12px;
  height: 24px;
  border-radius: 10px 10px 0 0;
  border: 4px solid #d97706;
  border-left: 0;
}

.gp-title {
  color: #17202a;
  font-size: 18px;
  font-weight: 900;
  line-height: 1.2;
}

.gp-subtitle {
  margin-top: 3px;
  color: #667085;
  font-size: 13px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.gp-score {
  display: grid;
  align-content: center;
  min-width: 110px;
}

.gp-score span,
.gp-meter span,
.gp-line-label span {
  color: #667085;
  font-size: 12px;
  line-height: 1.2;
  font-weight: 750;
}

.gp-score strong {
  display: block;
  margin-top: 4px;
  color: #0f766e;
  font-size: 22px;
  line-height: 1.1;
}

.gp-board {
  display: grid;
  gap: 12px;
  overflow: hidden;
  border: 1px solid #ccd5e1;
  border-radius: 8px;
  padding: 12px;
  background:
    linear-gradient(180deg, #ffffff 0%, #f4f7fb 100%),
    repeating-linear-gradient(90deg, rgba(37, 99, 235, 0.05) 0, rgba(37, 99, 235, 0.05) 1px, transparent 1px, transparent 18px);
}

.gp-meters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.gp-meter {
  min-width: 0;
  border: 1px solid #d6deea;
  border-radius: 8px;
  background: #fff;
  padding: 9px;
  display: grid;
  gap: 6px;
}

.gp-meter strong {
  color: #17202a;
  font-size: 21px;
  line-height: 1;
  font-weight: 900;
}

.gp-pips {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  min-height: 8px;
}

.gp-pip,
.gp-mini-track {
  border-radius: 999px;
  background: #e4e9f1;
  overflow: hidden;
}

.gp-pip {
  height: 8px;
}

.gp-pip-stock {
  background: #2563eb;
}

.gp-pip-open {
  background: #d97706;
}

.gp-mini-track {
  position: relative;
  height: 8px;
}

.gp-mini-track span {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: inherit;
  background: #0f766e;
  transition: width 180ms ease;
}

.gp-line-wrap {
  display: grid;
  gap: 8px;
}

.gp-line-label {
  min-height: 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.gp-line-label strong {
  min-width: 0;
  color: #17202a;
  font-weight: 900;
  overflow-wrap: anywhere;
  text-align: right;
}

.gp-line {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
  padding: 8px;
  border: 1px solid #cad4e2;
  border-radius: 8px;
  background:
    linear-gradient(90deg, transparent 0 8%, rgba(15, 118, 110, 0.08) 8% 92%, transparent 92%),
    #fff;
}

.gp-slot {
  min-width: 0;
  min-height: 58px;
  border: 1px dashed #a9b6c7;
  border-radius: 8px;
  background: #f8fafc;
  color: #98a2b3;
  display: grid;
  place-items: center;
  gap: 2px;
  padding: 5px 2px;
}

.gp-slot-token {
  min-height: 28px;
  display: grid;
  place-items: center;
  color: #17202a;
  font-size: 28px;
  line-height: 1;
  font-weight: 950;
}

.gp-slot-index {
  color: #667085;
  font-size: 11px;
  line-height: 1;
  font-weight: 850;
}

.gp-slot-open {
  border-style: solid;
  border-color: #2563eb;
  background: #dbeafe;
}

.gp-slot-close {
  border-style: solid;
  border-color: #d97706;
  background: #fff7ed;
}

.gp-slot-next {
  border-color: #0f766e;
  background: #ecfdf3;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.gp-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.gp-mold {
  min-width: 0;
  min-height: 88px;
  border: 2px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: #17202a;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  grid-template-rows: 1fr auto;
  align-items: center;
  gap: 4px 8px;
  padding: 10px;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  transition: transform 120ms ease, border-color 160ms ease, background 160ms ease, opacity 160ms ease;
}

.gp-mold:active,
.gp-btn:active {
  transform: scale(0.98);
}

.gp-mold-symbol {
  grid-row: 1 / span 2;
  width: 52px;
  height: 52px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 38px;
  line-height: 1;
  font-weight: 950;
}

.gp-mold-open .gp-mold-symbol {
  background: #2563eb;
}

.gp-mold-close .gp-mold-symbol {
  background: #d97706;
}

.gp-mold-name {
  min-width: 0;
  color: #17202a;
  font-size: 16px;
  font-weight: 900;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.gp-mold-state {
  min-width: 0;
  color: #667085;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.gp-mold.gp-branch-ready {
  border-color: #0f766e;
  background: #ecfdf3;
  box-shadow: 0 8px 18px rgba(15, 118, 110, 0.1);
}

.gp-mold.gp-branch-blocked,
.gp-mold.gp-branch-spent,
.gp-mold.gp-branch-locked {
  background: #f2f4f7;
  opacity: 0.72;
}

.gp-mold.gp-branch-spent {
  border-color: #98a2b3;
}

.gp-mold.gp-branch-blocked {
  border-color: #cbd5e1;
}

.gp-mold-wrong {
  border-color: #b42318 !important;
  background: #fff1f0 !important;
  opacity: 1 !important;
  animation: gp-shake 360ms ease;
}

.gp-branch-panel {
  display: grid;
  gap: 8px;
  border: 1px solid #d6deea;
  border-radius: 8px;
  background: #fff;
  padding: 9px;
}

.gp-trace,
.gp-branch-list {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.gp-trace-node {
  min-height: 28px;
  border: 1px solid #d7dde6;
  border-radius: 6px;
  background: #f8fafc;
  color: #475467;
  padding: 5px 7px;
  font-size: 12px;
  line-height: 1.1;
  font-weight: 850;
}

.gp-trace-current {
  border-color: #0f766e;
  background: #d7f4ef;
  color: #0f514b;
}

.gp-branch {
  min-height: 34px;
  border: 1px solid #d7dde6;
  border-radius: 8px;
  background: #f8fafc;
  display: inline-grid;
  grid-template-columns: 24px auto;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  color: #344054;
  font-size: 12px;
  font-weight: 850;
}

.gp-branch strong {
  font-size: 18px;
  line-height: 1;
  color: #17202a;
}

.gp-branch-ready {
  border-color: #0f766e;
  background: #ecfdf3;
  color: #0f514b;
}

.gp-branch-blocked {
  color: #667085;
}

.gp-branch-spent {
  border-color: #d97706;
  background: #fff7ed;
  color: #8a3b07;
}

.gp-branch-locked {
  background: #eef2f6;
  color: #667085;
}

.gp-status {
  min-height: 58px;
  border: 1px solid #d6deea;
  border-radius: 8px;
  background: #fff;
  color: #344054;
  padding: 11px 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.gp-status-good {
  border-color: #147d4f;
  background: #e7f6ef;
  color: #0f5132;
}

.gp-status-warn {
  border-color: #b45309;
  background: #fff7ed;
  color: #7c2d12;
}

.gp-crates {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 8px;
}

.gp-crate {
  min-width: 0;
  border: 1px solid #d6deea;
  border-radius: 8px;
  background: #fff;
  padding: 9px;
  display: grid;
  gap: 7px;
}

.gp-crate-done {
  border-color: #0f766e;
  background: #f0fdfa;
}

.gp-crate-head {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.gp-crate-head span {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: #eef2f6;
  color: #475467;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 900;
}

.gp-crate-done .gp-crate-head span {
  background: #0f766e;
  color: #fff;
}

.gp-crate-head strong {
  min-width: 0;
  color: #17202a;
  font-size: 13px;
  line-height: 1.15;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.gp-crate-body {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 3px;
}

.gp-mini-bracket {
  min-width: 0;
  min-height: 26px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #f8fafc;
  color: #17202a;
  display: grid;
  place-items: center;
  font-size: 16px;
  line-height: 1;
  font-weight: 950;
}

.gp-mini-open {
  border-color: #2563eb;
  background: #dbeafe;
}

.gp-mini-close {
  border-color: #d97706;
  background: #fff7ed;
}

.gp-mini-empty {
  background: #eef2f6;
}

.gp-actions {
  display: grid;
  grid-template-columns: 1.15fr 0.8fr 0.9fr;
  gap: 9px;
}

.gp-btn {
  min-width: 0;
  min-height: 46px;
  border: 1px solid #d6deea;
  border-radius: 8px;
  background: #fff;
  color: #17202a;
  padding: 8px 10px;
  font-size: 14px;
  line-height: 1.15;
  font-weight: 850;
  cursor: pointer;
  touch-action: manipulation;
}

.gp-btn-primary {
  border-color: #0f766e;
  background: #0f766e;
  color: #fff;
}

.gp-action-ready {
  border-color: #d97706;
  background: #fff7ed;
  color: #8a3b07;
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.14);
}

.gp-action-muted {
  opacity: 0.7;
}

.gp-mold:focus-visible,
.gp-btn:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.28);
  outline-offset: 2px;
}

@keyframes gp-shake {
  0%, 100% { transform: translateX(0); }
  24% { transform: translateX(-5px); }
  70% { transform: translateX(5px); }
}

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

  .gp-score {
    min-width: 0;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  .gp-score strong {
    margin-top: 0;
  }

  .gp-board {
    padding: 10px;
    gap: 10px;
  }

  .gp-meters {
    gap: 6px;
  }

  .gp-meter {
    padding: 8px 7px;
  }

  .gp-meter strong {
    font-size: 19px;
  }

  .gp-line {
    gap: 5px;
    padding: 7px;
  }

  .gp-slot {
    min-height: 54px;
  }

  .gp-slot-token {
    font-size: 25px;
  }

  .gp-controls {
    gap: 8px;
  }

  .gp-mold {
    min-height: 82px;
    grid-template-columns: 46px minmax(0, 1fr);
    padding: 9px 8px;
  }

  .gp-mold-symbol {
    width: 46px;
    height: 46px;
    font-size: 34px;
  }

  .gp-mold-name {
    font-size: 15px;
  }
}

@media (max-width: 380px) {
  .gp-brand {
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 8px;
    padding: 9px;
  }

  .gp-factory-icon {
    width: 44px;
    height: 44px;
  }

  .gp-title {
    font-size: 17px;
  }

  .gp-subtitle,
  .gp-status {
    font-size: 13px;
  }

  .gp-meter span,
  .gp-line-label span {
    font-size: 11px;
  }

  .gp-meter strong {
    font-size: 18px;
  }

  .gp-slot {
    min-height: 50px;
  }

  .gp-slot-token {
    font-size: 23px;
  }

  .gp-slot-index {
    font-size: 10px;
  }

  .gp-mold {
    min-height: 76px;
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 4px 6px;
  }

  .gp-mold-symbol {
    width: 42px;
    height: 42px;
    font-size: 31px;
  }

  .gp-mold-name,
  .gp-btn {
    font-size: 13px;
  }

  .gp-actions {
    gap: 7px;
  }

  .gp-btn {
    padding-left: 7px;
    padding-right: 7px;
  }
}
