:root {
  color-scheme: light;
  --page: #edece4;
  --surface: #faf9f3;
  --surface2: #f0efe7;
  --ink: #253a32;
  --muted: #7c8578;
  --line: #dddcd0;
  --accent: #386a4d;
  --accentSoft: #e1e9d9;
  --danger: #b65e4b;
  --shadow: 0 10px 35px #152e2520;
  --ground: #bfce99;
  --grid: #2c493212;
  --tile2: #b8c991;
  --catch: #95b982;
  --belt: #424c3e;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #17231d;
  --surface: #213128;
  --surface2: #293b30;
  --ink: #e4ebd8;
  --muted: #a0af9c;
  --line: #3b4d3e;
  --accent: #a5c587;
  --accentSoft: #374e35;
  --danger: #e7947b;
  --shadow: 0 10px 35px #0004;
  --ground: #3b553c;
  --grid: #d5ecc312;
  --tile2: #3e593d;
  --catch: #4a7145;
  --belt: #252e26;
}
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font:
    13px/1.5 "Segoe UI",
    system-ui,
    sans-serif;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
a,
input,
select,
textarea {
  outline-offset: 3px;
}
button {
  cursor: pointer;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  padding: 7px 12px;
  transition: background 0.15s;
}
button:hover {
  background: var(--accentSoft);
  border-color: var(--accent);
}
button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
a {
  color: var(--accent);
  text-decoration: none;
}
input,
select,
textarea {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
  color: var(--ink);
}
input[type="checkbox"] {
  width: auto;
  accent-color: var(--accent);
}
label {
  display: block;
  margin: 12px 0;
  color: var(--muted);
  font-size: 12px;
}
label input,
label select,
label textarea {
  margin-top: 5px;
  color: var(--ink);
}
h1,
h2,
h3,
p {
  margin-top: 0;
}
h2 {
  font-size: 20px;
}
h3 {
  font-size: 13px;
  margin: 20px 0 10px;
}
.muted {
  color: var(--muted);
}
.primary {
  background: var(--accent);
  color: var(--surface);
  border-color: var(--accent);
}
.danger {
  color: var(--danger);
  border-color: var(--danger);
}
.topbar {
  height: 70px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  gap: 20px;
}
.brand {
  color: var(--ink);
  font-weight: 800;
  letter-spacing: 2px;
  font-size: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand small {
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 1.8px;
  margin-left: 14px;
  color: var(--muted);
}
.pokeball {
  display: inline-block;
  border-radius: 50%;
  height: 27px;
  width: 27px;
  background: linear-gradient(#c7684f 0 44%, #394b38 44% 56%, #f4f0dd 56%);
  border: 2px solid #394b38;
  position: relative;
  flex: none;
}
.pokeball:after {
  content: "";
  position: absolute;
  top: 8px;
  left: 8px;
  width: 7px;
  height: 7px;
  background: #f4f0dd;
  border: 2px solid #394b38;
  border-radius: 50%;
}
.topbar nav {
  display: flex;
  align-items: center;
  gap: 7px;
}
.topbar nav a {
  font-size: 11px;
  margin-left: 8px;
}
.topbar nav button {
  background: transparent;
}
.world-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  color: var(--muted);
}
.divider {
  height: 16px;
  border-left: 1px solid var(--line);
  margin: 0 8px;
}
.live-dot {
  display: inline-block;
  background: #83a465;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex: none;
}
#game-layout {
  height: calc(100dvh - 70px);
  display: flex;
}
.sidebar {
  width: 310px;
  min-width: 310px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
}
.sidebar-heading {
  padding: 22px 18px 16px;
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  letter-spacing: 1.5px;
  font-weight: 700;
}
.sidebar-heading span:last-child {
  color: var(--muted);
  letter-spacing: 0;
  font-weight: 400;
}
.tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  padding: 0 8px;
  gap: 1px;
}
.tabs button {
  padding: 10px 8px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  font-size: 11px;
  background: none;
  color: var(--muted);
}
.tabs button.active {
  border-bottom-color: var(--accent);
  color: var(--accent);
  font-weight: 700;
}
.panel-search {
  padding: 14px 16px;
}
.panel-search input {
  background: var(--surface2);
  border: none;
  font-size: 12px;
}
.panel {
  padding: 0 16px 18px;
  overflow-y: auto;
  flex: 1;
}
.panel h3 {
  font-size: 10px;
  letter-spacing: 1.3px;
  color: var(--muted);
  text-transform: uppercase;
  margin: 15px 0 10px;
}
.item-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
}
.item-slot {
  position: relative;
  min-height: 62px;
  padding: 7px 4px;
  background: var(--surface2);
  display: flex;
  align-items: center;
  flex-direction: column;
  border-color: transparent;
}
.item-slot .icon {
  font-size: 24px;
  line-height: 30px;
}
.item-slot small {
  font-size: 8px;
  color: var(--muted);
  white-space: nowrap;
  max-width: 60px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.item-slot .count {
  position: absolute;
  right: 5px;
  top: 2px;
  font-size: 10px;
  font-weight: 600;
}
.sidebar-footer {
  display: flex;
  gap: 8px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
  align-items: center;
}
.world-view {
  position: relative;
  flex: 1;
  overflow: hidden;
  background: var(--ground);
}
canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}
.map-top {
  position: absolute;
  left: 22px;
  right: 22px;
  top: 20px;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}
.chip {
  display: flex;
  gap: 9px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 8px 12px;
  border-radius: 5px;
  font-size: 11px;
  box-shadow: var(--shadow);
}
.objective {
  position: absolute;
  left: 22px;
  top: 70px;
  max-width: 260px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 13px 16px;
  box-shadow: var(--shadow);
  font-size: 11px;
}
.objective small {
  display: block;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 1.5px;
  margin-bottom: 5px;
}
.objective strong {
  display: block;
  font-size: 12px;
  margin-bottom: 3px;
}
.objective p {
  margin: 0;
  color: var(--muted);
}
.map-bottom {
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: 105px;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  font-size: 10px;
  color: var(--ink);
}
.map-bottom > span:first-child {
  background: var(--surface);
  padding: 6px 10px;
  border-radius: 4px;
}
.map-bottom button {
  font-size: 10px;
  padding: 5px 10px;
}
kbd {
  font:
    10px/1.5 "Consolas",
    monospace;
  border: 1px solid var(--line);
  background: var(--surface2);
  padding: 2px 4px;
  border-radius: 3px;
  margin-right: 4px;
}
.buildbar {
  position: absolute;
  bottom: 23px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  gap: 4px;
  max-width: calc(100% - 28px);
}
.buildbar button {
  border: 1px solid transparent;
  padding: 5px 7px;
  min-width: 46px;
  font-size: 21px;
  position: relative;
  background: transparent;
  height: 57px;
}
.buildbar button.active {
  background: var(--accentSoft);
  border-color: var(--accent);
}
.buildbar button small {
  display: block;
  font-size: 8px;
  white-space: nowrap;
}
.buildbar button .tool-count {
  position: absolute;
  top: 1px;
  right: 2px;
  font-size: 8px;
}
.build-divider {
  height: 35px;
  border-left: 1px solid var(--line);
  margin: 0 4px;
}
#build-tools {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  max-width: 570px;
}
.hover-card {
  position: absolute;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 8px 12px;
  font-size: 11px;
  pointer-events: none;
  max-width: 260px;
  box-shadow: var(--shadow);
}
.toast {
  position: absolute;
  left: 50%;
  bottom: 180px;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--surface);
  padding: 12px 20px;
  border-radius: 6px;
  box-shadow: var(--shadow);
  max-width: 90%;
  text-align: center;
  font-size: 12px;
  z-index: 5;
}
.inspector {
  width: 290px;
  min-width: 290px;
  padding: 22px 18px;
  background: var(--surface);
  border-left: 1px solid var(--line);
  overflow-y: auto;
}
.inspector[hidden] {
  display: none;
}
.inspector .close {
  float: right;
}
.eyebrow {
  font-size: 9px;
  letter-spacing: 2px;
  color: var(--muted);
  margin-bottom: 12px;
}
.badge {
  display: inline-block;
  font-size: 9px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 2px 6px;
  margin: 3px 3px 3px 0;
  color: var(--muted);
}
.recipe-card,
.pokemon-card,
.research-card,
.plan-card {
  border: 1px solid var(--line);
  border-radius: 7px;
  margin-bottom: 8px;
  padding: 12px;
}
.recipe-card .recipe-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.recipe-card .icon {
  font-size: 24px;
}
.recipe-card strong {
  font-size: 12px;
}
.recipe-card p {
  font-size: 10px;
  color: var(--muted);
  margin: 5px 0 8px;
}
.recipe-card .button-row {
  display: flex;
  gap: 5px;
}
.recipe-card button {
  font-size: 10px;
  padding: 5px 8px;
}
.button-row {
  display: flex;
  gap: 7px;
  margin: 12px 0;
  flex-wrap: wrap;
}
.button-row > * {
  flex: 1;
}
.empty {
  color: var(--muted);
  border: 1px dashed var(--line);
  padding: 20px 14px;
  border-radius: 7px;
  text-align: center;
  font-size: 12px;
}
.empty .big-icon {
  display: block;
  font-size: 32px;
  margin-bottom: 8px;
}
.progress {
  height: 5px;
  background: var(--line);
  border-radius: 3px;
  overflow: hidden;
  margin: 8px 0;
}
.progress > i {
  display: block;
  background: var(--accent);
  height: 100%;
}
.queue-entry {
  font-size: 11px;
  padding: 9px;
  border: 1px solid var(--line);
  margin: 5px 0;
  border-radius: 4px;
}
.queue-entry button {
  float: right;
  font-size: 10px;
  padding: 1px 5px;
}
.pokemon-card header {
  display: flex;
  align-items: center;
  gap: 8px;
}
.pokemon-card img {
  width: 50px;
  height: 50px;
  image-rendering: pixelated;
}
.pokemon-card strong {
  font-size: 12px;
}
.pokemon-card .iv-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 3px;
  margin: 8px 0;
}
.iv-grid span {
  background: var(--surface2);
  padding: 3px 2px;
  text-align: center;
  font-size: 11px;
  border-radius: 3px;
}
.iv-grid small {
  display: block;
  color: var(--muted);
  font-size: 8px;
}
.check {
  display: flex;
  align-items: center;
  gap: 8px;
}
.research-card.locked {
  opacity: 0.55;
}
.research-card p {
  font-size: 11px;
  margin: 6px 0;
  color: var(--muted);
}
.research-card button {
  width: 100%;
  font-size: 11px;
}
.buffer {
  background: var(--surface2);
  padding: 8px;
  border-radius: 4px;
  margin: 7px 0;
  font-size: 11px;
}
.buffer strong {
  display: block;
  font-size: 10px;
  color: var(--muted);
  margin-bottom: 4px;
}
.buffer button {
  font-size: 10px;
  padding: 4px 7px;
  margin-top: 6px;
}
.controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  font-size: 11px;
}
.controls span {
  color: var(--muted);
}
dialog {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  padding: 30px;
  max-width: 480px;
  width: calc(100% - 40px);
  box-shadow: 0 24px 120px #0005;
}
dialog::backdrop {
  background: #162b2170;
  backdrop-filter: blur(4px);
}
.dialog-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.dialog-title h2 {
  margin: 0;
}
#welcome {
  padding: 42px;
  text-align: center;
  width: 470px;
}
.welcome-emblem .pokeball {
  height: 48px;
  width: 48px;
  margin-bottom: 22px;
}
.welcome-emblem .pokeball:after {
  top: 16px;
  left: 16px;
  width: 12px;
  height: 12px;
}
#welcome h1 {
  font-size: 46px;
  letter-spacing: -2px;
  font-weight: 800;
  margin: 0 0 8px;
}
#welcome h1 span {
  color: var(--accent);
}
#welcome p {
  color: var(--muted);
  font-size: 13px;
}
.welcome-preview {
  display: flex;
  justify-content: space-between;
  margin: 30px 0;
  padding: 20px 0;
  border-block: 1px solid var(--line);
  text-align: left;
}
.welcome-preview span {
  font-size: 10px;
  color: var(--accent);
  font-weight: 700;
}
.welcome-preview small {
  display: block;
  font-weight: 400;
  color: var(--muted);
  margin-top: 5px;
}
#welcome label {
  text-align: left;
}
#welcome button {
  width: 100%;
  margin-top: 8px;
  padding: 12px;
}
#welcome button span {
  float: right;
}
#welcome #remove-local-data {
  display: inline;
  width: auto;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}
.welcome-foot {
  font-size: 9px;
  color: var(--muted);
  margin-top: 24px;
}
.welcome-open .world-view {
  filter: blur(2px);
}
.admin-main {
  max-width: 1250px;
  margin: 35px auto;
  padding: 0 25px;
}
.admin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.admin-grid {
  display: grid;
  grid-template-columns: 190px 280px 1fr;
  gap: 20px;
  margin-top: 25px;
}
.admin-nav button {
  display: block;
  width: 100%;
  text-align: left;
  margin-bottom: 5px;
}
.admin-nav button.active {
  background: var(--accentSoft);
  border-color: var(--accent);
}
.admin-list {
  background: var(--surface);
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  max-height: calc(100vh - 210px);
  overflow: auto;
}
.admin-list button {
  display: block;
  width: 100%;
  text-align: left;
  margin: 5px 0;
}
.admin-form {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 15px;
}
.form-grid .wide {
  grid-column: 1/-1;
}
.array-row {
  display: flex;
  gap: 5px;
  margin: 7px 0;
  align-items: center;
}
.array-row > * {
  flex: 1;
}
.array-row button {
  flex: 0;
}
.array-row input {
  min-width: 40px;
}
.admin-status {
  font-size: 12px;
  color: var(--muted);
  margin-top: 10px;
}
.error {
  color: var(--danger);
}
.import-area {
  margin-top: 20px;
}
.import-area textarea {
  height: 130px;
  font-family: Consolas, monospace;
  font-size: 11px;
}
.tip {
  font-size: 11px;
  color: var(--muted);
  margin-top: 10px;
}
.field-note {
  font-size: 10px;
  color: var(--muted);
  margin-top: 5px;
}
@media (max-width: 1200px) {
  .brand small,
  .world-info {
    display: none;
  }
  .sidebar {
    width: 270px;
    min-width: 270px;
  }
  .inspector {
    position: absolute;
    right: 0;
    top: 70px;
    bottom: 0;
    box-shadow: var(--shadow);
    z-index: 6;
  }
  .buildbar button {
    min-width: 38px;
    padding: 5px;
  }
  .buildbar small {
    font-size: 7px !important;
  }
  .map-bottom > span:first-child {
    font-size: 8px;
  }
  .map-bottom kbd {
    font-size: 8px;
  }
}
@media (max-width: 760px) {
  .topbar {
    padding: 0 10px;
    height: 58px;
  }
  .brand {
    font-size: 14px;
  }
  .topbar nav {
    gap: 2px;
  }
  .topbar nav button {
    font-size: 10px;
    padding: 6px;
  }
  .topbar nav a {
    display: none;
  }
  #game-layout {
    height: calc(100dvh - 58px);
  }
  .sidebar {
    width: 225px;
    min-width: 225px;
  }
  .sidebar-heading {
    padding: 12px;
  }
  .tabs button {
    font-size: 9px;
    padding: 8px 5px;
  }
  .panel {
    padding: 0 10px;
  }
  .item-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .map-bottom > span:first-child {
    display: none;
  }
  .objective {
    max-width: 180px;
    left: 12px;
    padding: 10px;
  }
  .buildbar {
    bottom: 12px;
  }
  #build-tools {
    max-width: 100px;
  }
  .buildbar button {
    min-width: 35px;
  }
  .admin-grid {
    grid-template-columns: 1fr;
  }
  .admin-nav {
    display: flex;
    flex-wrap: wrap;
  }
  .admin-nav button {
    width: auto;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .inspector {
    top: 58px;
  }
  .welcome-preview small {
    font-size: 9px;
  }
}
.category {
  margin: 12px 0;
  border-bottom: 1px solid var(--line);
}
.category > summary,
.run-manager > summary {
  cursor: pointer;
  font-weight: 700;
  padding: 12px 2px;
}
.category > summary span {
  float: right;
  opacity: 0.5;
  font-size: 11px;
}
.item-tile {
  position: relative;
  min-width: 0;
}
.item-tile .item-slot {
  width: 100%;
  height: 100%;
}
.favorite-button {
  padding: 3px 6px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 17px;
}
.favorite-button.active {
  color: #bb9037;
}
.item-tile .favorite-button {
  position: absolute;
  right: 0;
  top: 0;
  z-index: 1;
}
.recipe-card {
  position: relative;
}
.recipe-card > .favorite-button {
  float: right;
}
.run-manager {
  margin-bottom: 24px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.run-manager table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
  text-align: left;
}
.run-manager td,
.run-manager th {
  padding: 10px;
  border-bottom: 1px solid var(--line);
}
#run-detail {
  max-height: 500px;
  overflow: auto;
  white-space: pre-wrap;
}
#login-step .error {
  min-height: 18px;
}
#welcome {
  max-height: 90vh;
  overflow-y: auto;
}
