:root {
  --bg-sea: #0b2545;
  --panel-bg: rgba(15, 28, 46, 0.92);
  --panel-border: #3a5a78;
  --gold: #f4b41a;
  --gold-dark: #c78b00;
  --teal: #2ec4b6;
  --teal-dark: #1b8a7f;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --danger: #ef4444;
  --pixel-font: 'Press Start 2P', monospace;
  --body-font: 'Space Grotesk', system-ui, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body, #app {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-sea);
  color: var(--text);
  font-family: var(--body-font);
  -webkit-tap-highlight-color: transparent;
}

#island-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  image-rendering: pixelated;
  touch-action: none;
}

#island-canvas:active {
  cursor: grabbing;
}

/* HUD Top */
.hud-top {
  position: fixed;
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: none;
  z-index: 10;
}

.brand-badge {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--panel-bg);
  border: 2px solid var(--panel-border);
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.45);
  padding: 8px 14px;
  border-radius: 10px;
}

.brand-icon {
  font-size: 22px;
}

.pixel-title {
  font-family: var(--pixel-font);
  font-size: 13px;
  color: var(--gold);
  letter-spacing: 0.5px;
  line-height: 1.3;
}

.brand-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.hud-actions {
  pointer-events: auto;
  display: flex;
  gap: 8px;
}

.btn-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 2px solid var(--panel-border);
  background: var(--panel-bg);
  color: var(--text);
  font-family: var(--pixel-font);
  font-size: 13px;
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.45);
  transition: transform 0.08s;
}

.btn-icon:active {
  transform: translateY(2px);
}

/* Zoom Controls */
.zoom-controls {
  position: fixed;
  right: 12px;
  bottom: 84px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 10;
}

/* HUD Bottom */
.hud-bottom {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  z-index: 10;
  width: calc(100% - 24px);
  max-width: 520px;
  justify-content: center;
}

.btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 13px 14px;
  border-radius: 10px;
  border: 2px solid #000;
  font-family: var(--body-font);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.08s, filter 0.12s;
  white-space: nowrap;
}

.btn small {
  font-weight: 500;
  opacity: 0.85;
  font-size: 12px;
}

.btn:hover {
  filter: brightness(1.07);
}

.btn:active {
  transform: translateY(2px);
}

.btn-primary {
  background: var(--teal);
  color: #06211e;
  box-shadow: 0 4px 0 var(--teal-dark);
}

.btn-gold {
  background: var(--gold);
  color: #211600;
  box-shadow: 0 4px 0 var(--gold-dark);
}

.btn-secondary {
  background: #1e334d;
  color: var(--text);
  border-color: var(--panel-border);
  box-shadow: 0 4px 0 #0c1724;
}

/* Claim Banner */
.claim-banner {
  position: fixed;
  top: 76px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(244, 180, 26, 0.96);
  color: #1f1400;
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 11;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  max-width: 92vw;
}

.btn-mini {
  background: #1f1400;
  color: var(--gold);
  border: none;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

/* Tooltip */
.canvas-tooltip {
  position: fixed;
  pointer-events: none;
  background: var(--panel-bg);
  border: 2px solid var(--gold);
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12px;
  z-index: 15;
  max-width: 220px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 12, 24, 0.72);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 30;
}

.modal-box {
  position: relative;
  width: 100%;
  max-width: 460px;
  max-height: 88vh;
  overflow-y: auto;
  background: #0f1c2e;
  border: 2px solid var(--panel-border);
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.65);
}

.modal-close {
  position: sticky;
  top: 0;
  float: right;
  background: #1e334d;
  color: var(--text);
  border: 1px solid var(--panel-border);
  width: 30px;
  height: 30px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
}

.hidden {
  display: none !important;
}

/* Modal Content Helpers */
.modal-title {
  font-family: var(--pixel-font);
  font-size: 14px;
  color: var(--gold);
  line-height: 1.5;
  margin-bottom: 10px;
  padding-right: 36px;
}

.modal-desc {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 14px;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.badge {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 6px;
  background: #1e334d;
  color: var(--teal);
  border: 1px solid #2b486b;
}

.badge-gold {
  color: var(--gold);
  border-color: var(--gold-dark);
  background: rgba(244, 180, 26, 0.12);
}

.deal-box {
  background: rgba(46, 196, 182, 0.1);
  border: 1px dashed var(--teal);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.deal-code {
  font-family: var(--pixel-font);
  font-size: 11px;
  color: var(--teal);
}

/* Quest Choices */
.quest-progress {
  font-family: var(--pixel-font);
  font-size: 10px;
  color: var(--teal);
  margin-bottom: 8px;
}

.choice-grid {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.choice-btn {
  text-align: left;
  padding: 12px 14px;
  background: #16283f;
  border: 2px solid #294466;
  border-radius: 10px;
  color: var(--text);
  font-family: var(--body-font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: border-color 0.12s, transform 0.08s;
}

.choice-btn:hover {
  border-color: var(--gold);
  background: #1c324f;
}

.choice-btn:active {
  transform: scale(0.99);
}

/* Loot Card Preview */
.loot-canvas {
  width: 100%;
  border-radius: 10px;
  border: 2px solid var(--gold);
  margin: 10px 0;
  image-rendering: pixelated;
}

.result-card {
  background: #16283f;
  border: 1px solid #2b486b;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
}

.result-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.result-card p {
  font-size: 13px;
  color: var(--muted);
}

/* Forms */
.form-group {
  margin-bottom: 12px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 4px;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--panel-border);
  background: #0a1422;
  color: var(--text);
  font-family: var(--body-font);
  font-size: 14px;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--gold);
}

.action-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

@media (max-width: 520px) {
  .pixel-title { font-size: 11px; }
  .btn { font-size: 13px; padding: 12px 10px; }
  .btn small { display: none; }
}
