/* Project Island - page + HUD styles */
:root{color-scheme:light;box-sizing:border-box;padding-top:env(safe-area-inset-top,0px);padding-bottom:env(safe-area-inset-bottom,0px)}
html{scroll-padding-top:env(safe-area-inset-top,0px)}
body{margin:0;padding:0;font:14px -apple-system,BlinkMacSystemFont,sans-serif;background:#fff;color:#000}
img{max-width:100%}
[hidden]:not([hidden=until-found i]){display:none!important}

:root {
  --bg-panel: rgba(20, 32, 48, 0.82);
  --border-light: rgba(255, 255, 255, 0.24);
  --accent-yellow: #ffd13b;
  --accent-orange: #ff8c3b;
  --accent-teal: #22e3c6;
  --accent-pink: #ff5376;
  --text-light: #f8fbff;
  --font-main: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

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

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0d1f2d;
  font-family: var(--font-main);
  color: var(--text-light);
}

#game-container {
  position: fixed;
  inset: 0;
  z-index: 1;
}

/* HUD Panels */
.hud-panel {
  background: var(--bg-panel);
  backdrop-filter: blur(8px);
  border: 2px solid var(--border-light);
  border-radius: 18px;
  padding: 12px 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

#hud-top-left {
  position: fixed;
  top: 18px;
  left: 18px;
  z-index: 10;
  width: 265px;
}

.stat-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.stat-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.8px;
  width: 62px;
  color: #cfe4ff;
}

.stat-bar-bg {
  flex: 1;
  height: 13px;
  background: rgba(0, 0, 0, 0.45);
  border-radius: 99px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.stat-bar-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.2s ease;
}

.health-fill {
  background: linear-gradient(90deg, #ff4b6e, #ff7954);
}

.hunger-fill {
  background: linear-gradient(90deg, #ff9924, #ffd438);
}

.stamina-fill {
  background: linear-gradient(90deg, #19d3b6, #57f287);
}

.stat-val {
  font-size: 12px;
  font-weight: 800;
  width: 28px;
  text-align: right;
}

#biome-indicator {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 11px;
  font-weight: 800;
  color: var(--accent-teal);
  letter-spacing: 0.7px;
}

/* Top-Center Compass & Objective */
#hud-top-center {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

#compass-strip {
  background: var(--bg-panel);
  border: 2px solid var(--border-light);
  border-radius: 999px;
  padding: 6px 22px;
  font-size: 13px;
  font-weight: 800;
  color: var(--accent-yellow);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
}

#objective-banner {
  background: rgba(18, 35, 52, 0.85);
  border: 2px solid rgba(34, 227, 198, 0.45);
  border-radius: 14px;
  padding: 7px 18px;
  text-align: center;
}

.obj-title {
  font-size: 10px;
  font-weight: 900;
  color: var(--accent-teal);
  letter-spacing: 1px;
}

#obj-desc {
  font-size: 13px;
  font-weight: 700;
  margin-top: 2px;
}

/* Top-Right Controls */
#hud-top-right {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 10;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.key-hint {
  color: #dcecff;
}

kbd {
  background: #2c4460;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-bottom-width: 3px;
  border-radius: 6px;
  padding: 1px 6px;
  font-size: 11px;
  font-weight: 800;
  color: var(--accent-yellow);
}

/* Crosshair & Interaction Prompt */
#crosshair {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 8px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  border: 2px solid rgba(0, 0, 0, 0.45);
  z-index: 8;
  pointer-events: none;
}

#interaction-prompt {
  position: fixed;
  top: 57%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 12;
  background: rgba(16, 28, 42, 0.92);
  border: 2px solid var(--accent-yellow);
  border-radius: 99px;
  padding: 8px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}

.prompt-key {
  background: var(--accent-yellow);
  color: #142030;
  font-weight: 900;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

#prompt-text {
  font-weight: 800;
  font-size: 14px;
}

/* Fishing Overlay */
#fishing-overlay {
  position: fixed;
  top: 34%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 14;
  background: rgba(12, 34, 54, 0.92);
  border: 3px solid var(--accent-teal);
  border-radius: 20px;
  padding: 16px 28px;
  text-align: center;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}

#fishing-status {
  font-size: 20px;
  font-weight: 900;
  color: var(--accent-yellow);
  margin-bottom: 6px;
}

.fishing-sub {
  font-size: 13px;
  color: #d6ecff;
}

/* Toast Notifications */
#toast-container {
  position: fixed;
  bottom: 130px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 15;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.toast-msg {
  background: rgba(18, 32, 48, 0.92);
  border: 2px solid var(--accent-teal);
  color: #fff;
  padding: 8px 18px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
  animation: popIn 0.25s ease-out;
}

@keyframes popIn {
  from { transform: translateY(12px) scale(0.92); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

/* Bottom Resource Strip & Hotbar */
#hud-bottom {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

#resource-strip {
  display: flex;
  gap: 8px;
  background: var(--bg-panel);
  border: 2px solid var(--border-light);
  border-radius: 99px;
  padding: 5px 14px;
}

.res-pill {
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
}

.res-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.wood-dot { background: #c87d45; }
.stone-dot { background: #9cb1c9; }
.fiber-dot { background: #4cd964; }
.scrap-dot { background: #f5b942; }
.fuel-dot { background: #ff4f79; }

#hotbar {
  display: flex;
  gap: 10px;
}

.hotbar-slot {
  width: 68px;
  height: 68px;
  background: var(--bg-panel);
  border: 2px solid var(--border-light);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.hotbar-slot.active {
  border-color: var(--accent-yellow);
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(255, 209, 59, 0.3);
}

.slot-key {
  position: absolute;
  top: 4px;
  left: 7px;
  font-size: 10px;
  font-weight: 900;
  color: var(--accent-yellow);
}

.slot-count {
  position: absolute;
  bottom: 4px;
  right: 7px;
  font-size: 11px;
  font-weight: 900;
  color: #fff;
}

.slot-name {
  font-size: 10px;
  font-weight: 800;
  text-align: center;
  line-height: 1.15;
  padding: 0 4px;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(9, 18, 28, 0.72);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-card {
  background: linear-gradient(165deg, #1b3149, #122234);
  border: 3px solid rgba(255, 255, 255, 0.25);
  border-radius: 26px;
  padding: 26px 30px;
  width: min(680px, 92vw);
  box-shadow: 0 20px 55px rgba(0, 0, 0, 0.6);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.modal-header h2 {
  font-size: 22px;
  font-weight: 900;
  color: var(--accent-yellow);
}

.btn-close {
  background: rgba(255, 255, 255, 0.12);
  border: none;
  color: #fff;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 22px;
  cursor: pointer;
}

.modal-subtitle {
  font-size: 13px;
  color: #c2daf2;
  margin-bottom: 18px;
}

.crafting-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(275px, 1fr));
  gap: 12px;
}

.craft-item {
  background: rgba(255, 255, 255, 0.06);
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
}

.craft-item h3 {
  font-size: 15px;
  color: #fff;
}

.craft-desc {
  font-size: 12px;
  color: #b7d2eb;
}

.craft-cost {
  font-size: 11px;
  font-weight: 800;
  color: var(--accent-yellow);
}

.btn-craft {
  background: linear-gradient(90deg, #22e3c6, #28b5f5);
  border: none;
  border-radius: 10px;
  padding: 8px 12px;
  color: #0b1c2c;
  font-weight: 900;
  cursor: pointer;
}

.btn-craft:disabled {
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.4);
  cursor: not-allowed;
}

/* Map Canvas */
.map-card {
  text-align: center;
}

#island-map-canvas {
  border-radius: 18px;
  border: 3px solid rgba(255, 255, 255, 0.28);
  background: #144d6f;
  max-width: 100%;
}

/* Start & Victory Card */
.start-card {
  text-align: center;
}

.badge-pill {
  display: inline-block;
  background: var(--accent-teal);
  color: #0d2233;
  font-weight: 900;
  font-size: 11px;
  padding: 4px 14px;
  border-radius: 99px;
  letter-spacing: 1px;
  margin-bottom: 10px;
}

.victory-badge {
  background: var(--accent-yellow);
}

.start-card h1 {
  font-size: 36px;
  font-weight: 900;
  margin-bottom: 10px;
  color: #fff;
}

.lead-text {
  font-size: 14px;
  line-height: 1.55;
  color: #d2e7ff;
  margin-bottom: 20px;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 22px;
  text-align: left;
}

.feature-box {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 14px;
  padding: 12px;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.feature-box strong {
  color: var(--accent-yellow);
  font-size: 13px;
}

.btn-primary {
  background: linear-gradient(90deg, #ffba26, #ff7b36);
  border: none;
  border-radius: 99px;
  padding: 14px 36px;
  font-size: 16px;
  font-weight: 900;
  color: #1a1206;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(255, 136, 43, 0.45);
  transition: transform 0.15s ease;
}

.btn-primary:hover {
  transform: scale(1.04);
}

.victory-stats {
  background: rgba(0, 0, 0, 0.25);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 20px;
  font-size: 14px;
  color: var(--accent-yellow);
  font-weight: 800;
}

/* Sleep & Damage Overlays */
#sleep-fade {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: #07111c;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 900;
  color: var(--accent-yellow);
}

#damage-flash {
  position: fixed;
  inset: 0;
  z-index: 7;
  pointer-events: none;
  box-shadow: inset 0 0 90px rgba(255, 35, 65, 0);
  transition: box-shadow 0.25s ease;
}

.hidden {
  display: none !important;
}
