html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #1a1410;
  color: #f4ebd9;
  font-family: "Georgia", "Times New Roman", serif;
  user-select: none;
  -webkit-user-select: none;
}

canvas#game {
  display: block;
  width: 100vw;
  height: 100vh;
}

.bo-hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

.bo-panel {
  background: linear-gradient(160deg, rgba(42, 33, 26, 0.92), rgba(26, 20, 16, 0.94));
  border: 2px solid #c9a227;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 232, 160, 0.25);
  border-radius: 10px;
  color: #f4ebd9;
}

.bo-top-left {
  position: fixed;
  top: 14px;
  left: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: auto;
}

.bo-resources {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 14px;
}

.bo-res-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.3px;
}

.bo-icon-cog {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #f3d26b, #c9a227 65%, #7a5c14);
  border: 2px dashed #e6c15a;
  box-sizing: border-box;
  position: relative;
  display: inline-block;
  animation: bo-spin 8s linear infinite;
}

.bo-icon-cog::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: #2a211a;
}

.bo-icon-steam {
  width: 18px;
  height: 18px;
  border-radius: 50% 50% 45% 45%;
  background: radial-gradient(circle at 40% 35%, #ffffff, #d7f2eb 60%, #4fa38a);
  box-shadow: 0 0 8px rgba(79, 163, 138, 0.7);
  display: inline-block;
}

.bo-gauge-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
}

.bo-gauge {
  position: relative;
  width: 78px;
  height: 42px;
  overflow: hidden;
}

.bo-gauge-arc {
  width: 74px;
  height: 74px;
  border-radius: 50%;
  border: 6px solid #3c2f24;
  border-top-color: #4fa38a;
  border-right-color: #c9a227;
  border-left-color: #c4452b;
  box-sizing: border-box;
  transform: rotate(-45deg);
}

.bo-gauge-needle {
  position: absolute;
  bottom: 2px;
  left: 37px;
  width: 3px;
  height: 32px;
  background: #f5d67b;
  border-radius: 2px;
  transform-origin: bottom center;
  transition: transform 0.25s ease-out;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.8);
}

.bo-gauge-hub {
  position: absolute;
  bottom: -4px;
  left: 32px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #c9a227;
  border: 2px solid #2a211a;
}

.bo-gauge-label {
  display: flex;
  flex-direction: column;
  font-size: 12px;
  color: #d6c5a3;
}

.bo-gauge-val {
  font-size: 18px;
  font-weight: 800;
  color: #f7e3a8;
}

.bo-pressure-bar {
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #d6c5a3;
}

.bo-pressure-track {
  width: 96px;
  height: 8px;
  background: #1d1712;
  border: 1px solid #8a6c2a;
  border-radius: 4px;
  overflow: hidden;
}

.bo-pressure-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #4fa38a, #e2f5ef);
  transition: width 0.08s linear;
}

.bo-top-center {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 20px;
  text-align: center;
  min-width: 210px;
}

.bo-wave-title {
  font-family: "Georgia", serif;
  font-size: 17px;
  font-weight: 700;
  color: #f3d26b;
  letter-spacing: 0.6px;
}

.bo-wave-sub {
  font-size: 13px;
  color: #d7ccb6;
  margin-top: 2px;
}

.bo-top-right {
  position: fixed;
  top: 14px;
  right: 14px;
  display: flex;
  gap: 8px;
  pointer-events: auto;
}

.bo-btn {
  background: linear-gradient(180deg, #544029, #332619);
  border: 1.5px solid #c9a227;
  color: #f4ebd9;
  padding: 7px 13px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: transform 0.1s, background 0.15s;
}

.bo-btn:hover {
  background: linear-gradient(180deg, #6e5435, #433120);
  transform: translateY(-1px);
}

.bo-btn-primary {
  background: linear-gradient(180deg, #c9a227, #8e6c14);
  color: #1c150e;
  border-color: #f5df8c;
}

.bo-btn-primary:hover {
  background: linear-gradient(180deg, #dfb83b, #a37d19);
}

.bo-boss-bar {
  position: fixed;
  top: 78px;
  left: 50%;
  transform: translateX(-50%);
  width: min(440px, 84vw);
  padding: 8px 14px;
  display: none;
}

.bo-boss-name {
  font-family: "Georgia", serif;
  font-size: 14px;
  font-weight: 700;
  color: #ff9c66;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 5px;
  display: flex;
  justify-content: space-between;
}

.bo-boss-track {
  height: 12px;
  background: #231714;
  border: 1px solid #b87333;
  border-radius: 6px;
  overflow: hidden;
}

.bo-boss-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #b83b24, #e88435, #f5c35b);
  transition: width 0.12s linear;
}

.bo-banner {
  position: fixed;
  top: 120px;
  left: 50%;
  transform: translateX(-50%) translateY(-10px);
  padding: 12px 28px;
  font-family: "Georgia", serif;
  font-size: 20px;
  font-weight: 700;
  color: #f8e4a6;
  text-align: center;
  opacity: 0;
  transition: opacity 0.45s ease, transform 0.45s ease;
  pointer-events: none;
}

.bo-banner.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.bo-title-card {
  position: fixed;
  top: 26%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  padding: 20px 36px;
  background: radial-gradient(ellipse at center, rgba(36, 27, 20, 0.88), rgba(20, 15, 11, 0.65));
  border: 2px solid #c9a227;
  border-radius: 14px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.65);
  transition: opacity 0.8s ease, transform 0.8s ease;
  pointer-events: none;
}

.bo-title-card.fade-out {
  opacity: 0;
  transform: translate(-50%, -62%);
}

.bo-title-main {
  font-family: "Georgia", serif;
  font-size: clamp(28px, 5vw, 48px);
  font-weight: 800;
  letter-spacing: 3px;
  background: linear-gradient(180deg, #fff1ba, #c9a227 60%, #8f6914);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.8));
}

.bo-title-sub {
  margin-top: 6px;
  font-size: 15px;
  color: #e6d8bd;
  letter-spacing: 1px;
}

.bo-prompt {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  padding: 9px 20px;
  font-size: 14px;
  font-weight: 600;
  color: #f8e6b0;
  opacity: 0;
  transition: opacity 0.2s;
  white-space: nowrap;
}

.bo-prompt.show {
  opacity: 1;
}

.bo-speech {
  position: fixed;
  bottom: 72px;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  max-width: min(460px, 86vw);
  padding: 10px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  opacity: 0;
  transition: opacity 0.35s ease, transform 0.35s ease;
  pointer-events: none;
}

.bo-speech.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.bo-speech-badge {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 15px;
  border: 2px solid #c9a227;
}

.bo-speech-speaker {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #c9a227;
  font-weight: 700;
}

.bo-speech-text {
  font-family: "Georgia", serif;
  font-style: italic;
  font-size: 15px;
  color: #f6eedc;
}

.bo-wheel-overlay {
  position: fixed;
  inset: 0;
  display: none;
  pointer-events: auto;
}

.bo-wheel-overlay.open {
  display: block;
}

.bo-wheel-center {
  position: fixed;
  width: 0;
  height: 0;
}

.bo-wheel-ring {
  position: absolute;
  width: 240px;
  height: 240px;
  left: -120px;
  top: -120px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(28, 22, 17, 0.35) 35%, rgba(28, 22, 17, 0.85) 100%);
  border: 2px solid rgba(201, 162, 39, 0.75);
  box-shadow: 0 0 28px rgba(0, 0, 0, 0.6);
  pointer-events: none;
}

.bo-wheel-item {
  position: absolute;
  width: 98px;
  padding: 6px 6px;
  transform: translate(-50%, -50%);
  text-align: center;
  border-radius: 10px;
  background: rgba(38, 30, 23, 0.94);
  border: 2px solid #7d6230;
  cursor: pointer;
  transition: transform 0.14s, border-color 0.14s, background 0.14s;
}

.bo-wheel-item.selected {
  border-color: #f5d873;
  background: rgba(74, 56, 30, 0.97);
  transform: translate(-50%, -50%) scale(1.1);
  box-shadow: 0 0 14px rgba(245, 216, 115, 0.55);
}

.bo-wheel-item.unaffordable {
  opacity: 0.52;
}

.bo-wheel-name {
  font-size: 12px;
  font-weight: 700;
  color: #f7e6b7;
}

.bo-wheel-cost {
  font-size: 11px;
  color: #d6c39c;
  margin-top: 2px;
}

.bo-wheel-info {
  position: absolute;
  top: 132px;
  left: 0;
  transform: translateX(-50%);
  min-width: 250px;
  padding: 8px 14px;
  text-align: center;
  font-size: 12px;
  color: #efe3cb;
}

.bo-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(12, 9, 7, 0.72);
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  z-index: 25;
}

.bo-modal-backdrop.open {
  display: flex;
}

.bo-modal {
  width: min(640px, 92vw);
  max-height: 86vh;
  overflow-y: auto;
  padding: 22px 26px;
}

.bo-modal h2 {
  margin: 0 0 12px;
  font-family: "Georgia", serif;
  color: #f3d26b;
  letter-spacing: 1px;
}

.bo-controls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px 16px;
  font-size: 13px;
  margin-bottom: 16px;
  color: #e4d8c1;
}

.bo-almanac {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.bo-almanac-card {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  background: rgba(24, 19, 15, 0.75);
  border: 1px solid #6b4f2a;
  border-radius: 8px;
}

.bo-almanac-card svg {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
}

.bo-almanac-title {
  font-size: 13px;
  font-weight: 700;
  color: #f3c86b;
}

.bo-almanac-desc {
  font-size: 12px;
  color: #d6c8b0;
  line-height: 1.3;
}

.bo-modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 18px;
}

.bo-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 14px 0;
}

.bo-stat-box {
  background: rgba(22, 17, 13, 0.8);
  border: 1px solid #7d6230;
  border-radius: 8px;
  padding: 10px;
  text-align: center;
}

.bo-stat-num {
  font-size: 22px;
  font-weight: 800;
  color: #f5d873;
}

.bo-stat-lbl {
  font-size: 11px;
  color: #cbbba0;
  text-transform: uppercase;
}

@keyframes bo-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
