* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(38, 117, 255, 0.18), transparent 34%),
    linear-gradient(180deg, #0d1420, #05070b);
  color: #f4f7fb;
  font-family: Arial, Helvetica, sans-serif;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  margin: 16px;
  border-radius: 18px;
  background: rgba(7, 12, 20, 0.92);
  border: 1px solid rgba(255,255,255,0.1);
}

.topbar strong {
  display: block;
  font-size: 24px;
}

.topbar span {
  color: #aebbd0;
  font-size: 14px;
}

nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

button {
  border: 0;
  border-radius: 10px;
  padding: 9px 12px;
  background: #2563eb;
  color: white;
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  filter: brightness(1.12);
}

button:disabled {
  opacity: .35;
  cursor: not-allowed;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 410px;
  gap: 16px;
  padding: 0 16px 16px;
}

.gamebox,
.panel {
  border-radius: 18px;
  background: rgba(7, 12, 20, 0.92);
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 24px 60px rgba(0,0,0,.3);
}

.gamebox {
  min-height: 690px;
  padding: 12px;
  display: grid;
  place-items: center;
}

#game {
  width: 100%;
  min-height: 640px;
  display: grid;
  place-items: center;
}

canvas {
  border-radius: 14px;
  max-width: 100%;
  image-rendering: pixelated;
}

.panel {
  padding: 18px;
  max-height: calc(100vh - 112px);
  overflow: auto;
}

.panel h2 {
  font-size: 17px;
  margin: 18px 0 8px;
}

.panel h2:first-child {
  margin-top: 0;
}

.panel,
.panel p {
  color: #d8e2f1;
  line-height: 1.55;
}

.row,
.barline {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid rgba(255,255,255,.08);
  font-size: 14px;
}

.hint {
  margin: 10px 0;
  padding: 10px;
  border-radius: 12px;
  background: rgba(37, 99, 235, .16);
  color: #dbeafe;
  font-size: 14px;
}

.meter {
  height: 9px;
  background: rgba(255,255,255,.08);
  border-radius: 999px;
  overflow: hidden;
  margin: 0 0 5px;
}

.meter i {
  display: block;
  height: 100%;
  border-radius: 999px;
}

.quest {
  padding: 10px;
  border-radius: 12px;
  margin-bottom: 8px;
  background: rgba(255,255,255,.055);
  border: 1px solid rgba(255,255,255,.08);
}

.quest.done {
  background: rgba(34,197,94,.12);
  border-color: rgba(34,197,94,.28);
}

.quest strong {
  display: block;
  margin-bottom: 4px;
}

.quest small {
  color: #aebbd0;
}

.recipe {
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.recipe-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.recipe small {
  display: block;
  color: #9fb0c8;
  margin-top: 4px;
}

.slots {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-top: 9px;
}

.slot {
  padding: 7px 4px;
  border-radius: 10px;
  background: rgba(255,255,255,.07);
  text-align: center;
  font-size: 12px;
  border: 1px solid rgba(255,255,255,.1);
}

.slot.active {
  border-color: #60a5fa;
  background: rgba(37,99,235,.35);
}

.smallnote {
  color: #aebbd0;
  font-size: 13px;
}

@media (max-width: 1180px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .panel {
    order: -1;
    max-height: none;
  }
}

@media (max-width: 680px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  nav {
    justify-content: flex-start;
  }

  .gamebox {
    min-height: 500px;
  }

  #game {
    min-height: 460px;
  }
}
