:root {
  --bg: #0f1720;
  --panel: #0b1220;
  --accent: #d8a24a;
  --muted: #98a0b3;
  --card: #0f1726;
  --bar-bg: #1b2330;
  --bar-fill: #6abe6a;
  --glass: rgba(255, 255, 255, 0.03);
  --radius: 10px;
  --gap: 12px;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

body, html {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.app {
  position: relative;
  width: 100%;
  height: 100vh;
  padding: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #000; /* optionnel */
  overflow: hidden;
  cursor: grab;
  user-select: none;
  -moz-user-select: none;
  -webkit-user-select: none;
}

.map-area {
  position: absolute;
    top: 50%;
    left: 50%;
    transition: transform 0.15s ease;
    will-change: transform;
}

.grid {
  display: grid;
  /* // 13 cols // 29 rows */
  grid-template-columns: repeat(29, 48px);
  grid-template-rows: repeat(29, 48px);
  justify-content: center;
  align-content: center;
}

.leftpanel, .rightpanel, .topbar, .bottombar {
  position: absolute;
  background: rgba(15, 23, 32, 0.85);
  backdrop-filter: blur(6px);
  border-radius: 10px;
  padding: 10px;
  z-index: 20;
}
.leftpanel, .rightpanel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
}

.topbar {
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
}
.leftpanel {
  top: 60px;
  left: 10px;
  width: 260px;
  height: 80%;
}
.rightpanel {
  top: 60px;
  right: 10px;
  width: 320px;
  height: 80%;
}

.bottombarleft {
  bottom: 10px; 
  left: 10px;
  width: 260px; 
}

.bottombar {
  position: fixed;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
}

button {
  background: #08152500;
  color: #ffd700;
  border: none;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
}

.menuBottom { 
  position: absolute;
  bottom: 50px;
  background: rgba(15, 23, 32, 0.85);
  border-radius: 10px;
  padding: 10px;
  width: 35vw;
  color: #ddd;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.hidden {
  display: none;
}

#chatMenu { 
  left: -75%;
}
#chatMessages {
  max-height: 300px;
  overflow-y: auto;
}
.chat-message {
  margin-bottom: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
}
.chat-message span {
  font-weight: 600;
  color: var(--accent);
}
.chat-message strong {
  color: #fff;
}

#notifMenu { 
  left: -75%; 
  overflow-y: auto; 
  max-height: 60vh;
}

.brand {
  font-weight: 700;
  color: var(--accent);
}
.topmenu button {
  background: transparent;
  border: 0;
  color: var(--muted);
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
}
.topmenu button:hover {
  background: rgba(255, 255, 255, 0.02);
  color: #fff;
}
.clock {
  font-size: 13px;
  color: var(--muted);
}

.hero-section {
    position: relative;
    width: 100%;
    height: 65vh;
    overflow: hidden;
}

.hero-bg {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: blur(6px) brightness(0.6);
    transform: scale(1.05);
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #fff;
}

.hero-content h1 {
    font-size: 3rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-shadow: 0 0 12px rgba(255, 255, 255, 0.3);
}

.hero-content p {
    font-size: 1.3rem;
    opacity: 0.85;
    margin-top: 10px;
}

.tool-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.tool {
  padding: 10px;
  border-radius: 8px;
  border: 0;
  background: var(--glass);
  color: #dfe8f8;
  cursor: pointer;
}
.tool:hover {
  transform: translateY(-2px);
}

.quickslots {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.slot {
  position: relative;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.slot .progress-ring {
  position: absolute;
  width: 200%;
  height: 200%;
  border-radius: 50%;
  background: conic-gradient(#ffffff1c 0%, #ffffff05 0%);
  clip-path: circle(50%);
  animation: progress-animation 1s linear infinite;
}
.slot .slot-title {
  color: var(--muted);
  font-size: 12px;
}
.slot .remove-icon {
  position: absolute;
  top: 0;
  right: 0;
  width: 16px;
  height: 16px;
  background: rgba(255, 0, 0, 0.7);
  border-top-right-radius: 8px;
  border-bottom-left-radius: 8px;
  color: #fff;
  font-size: 12px;
  line-height: 16px;
  text-align: center;
  cursor: pointer;
}
.slot .remove-icon:hover {
  background: rgba(255, 0, 0, 0.9);
}

.viewport {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.viewport-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.minimap {
  width: 160px;
  height: 96px;
  border-radius: 8px;
  background: linear-gradient(180deg, #081525, #0b1b2b);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.notifications {
  width: 100%;
  max-width: 500px;
  margin: 20px auto;
  border-radius: 12px;
  color: #fff;
  font-family: Arial, sans-serif;
}

.notification {
  background: #081525;
  border-left: 4px solid #0b1b2b;
  padding: 10px;
  margin-bottom: 8px;
  border-radius: 8px;
}

.notification-title {
  font-size: 16px;
  font-weight: bold;
  margin: 0 0 4px 0;
}

.notification-body {
  font-size: 14px;
  margin: 0;
  opacity: 0.9;
}

.notification.empty {
  text-align: center;
  opacity: 0.6;
}

.tile {
  position: relative;
  width: var(--tile-size);
  height: var(--tile-size);
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.01),
    rgba(0, 0, 0, 0.1)
  );
  box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  user-select: none;
  -moz-user-select: none;
  -webkit-user-select: none;
}

.tile img {
  user-select: none;
  -moz-user-select: none;
  -webkit-user-select: none;
  pointer-events: none;
}

.tile .building {
  opacity: 0.5;
  filter: hue-rotate(45deg) brightness(0.8);
  background-color: rgba(0, 157, 255, 0.294);
}

.tile:hover {
  outline: 1px solid rgba(216, 162, 74, 0.12);
  box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.3), 0 0 2px rgba(0, 0, 0, 0.2);
  transform: translateY(-2px);
  transition: 0.2s;
}

.tile .character {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 30px;
  height: 30px;
  object-fit: contain;
  transform: translate(-50%, -50%);
  z-index: 5;
}

.tile .object {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 48px;
  height: 48px;
  object-fit: contain;
  transform: translate(-50%, -50%);
  z-index: 2;
}

.tile .ship {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 48px;
  height: 48px;
  object-fit: contain;
  transform: translate(-50%, -50%);
  z-index: 3;
}

.tile .home {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 48px;
  height: 48px;
  object-fit: contain;
  transform: translate(-50%, -50%);
  z-index: 4;
}

.tile .terrain {
  position: absolute;
  top: 0;
  left: 0;
  width: 48px;
  height: 48px;
  object-fit: cover;
  z-index: 1;
}

.tile.build-hover {
  background: rgba(216, 162, 74, 0.2);
  border: 1px solid rgba(216, 162, 74, 0.4);
}

.selected-crew {
  outline: 1px solid yellow;
  border-radius: 5px;
}
.crew-card.frozen {
  background: rgba(255, 255, 255, 0.1);
  /* border: 1px solid #0ff; */
}

.selected-object {
  outline: 1px solid yellow;
  border-radius: 5px;
}
.object-card.frozen {
  background: rgba(255, 255, 255, 0.1);
  /* border: 1px solid #0ff; */
}

.selected-ship {
  outline: 1px solid yellow;
  border-radius: 5px;
}
.ship-card.frozen {
  background: rgba(255, 255, 255, 0.1);
  /* border: 1px solid #0ff; */
}

.selected-home {
  outline: 1px solid yellow;
  border-radius: 5px;
}
.home-card.frozen {
  background: rgba(255, 255, 255, 0.1);
  /* border: 1px solid #0ff; */
}

.time-controls button {
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 18px;
  padding: 6px;
}
.global-resources span {
  margin-right: 12px;
  color: var(--muted);
}
.global-resources span.right {
  float: right;
}

.crew-list .crew-card {
  display: flex;
  gap: 10px;
  padding: 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.01);
  margin-bottom: 8px;
  align-items: center;
}
.avatar {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: linear-gradient(180deg, #1f2937, #111827);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--accent);
}
.crew-info .name {
  font-weight: 600;
}
.crew-info .role {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}
.needs {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 6px;
}
.needs .need {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
}
.needs .need span {
  margin-bottom: 4px;
}
.needs .need .bar {
  width: 80px;
  height: 8px;
  background: var(--bar-bg);
  border-radius: 6px;
  overflow: hidden;
}
.needs .need .bar .fill {
  height: 100%;
  background: linear-gradient(90deg, var(--bar-fill), #3aa85a);
}
.hand-object {
  font-size: 13px;
  color: var(--muted);
  margin-top: 6px;
  text-align: center;
}

.selected-info .info {
  padding: 8px;
  background: rgba(255, 255, 255, 0.01);
  border-radius: 6px;
  color: var(--muted);
}

.context-menu {
  position: fixed;
  display: none;
  background: #06101a;
  border: 1px solid rgba(255, 255, 255, 0.04);
  padding: 6px;
  border-radius: 8px;
  z-index: 50;
}
.context-menu ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.context-menu li {
  padding: 6px 12px;
  cursor: pointer;
  border-radius: 6px;
  color: var(--muted);
}
.context-menu li:hover {
  background: rgba(255, 255, 255, 0.02);
  color: #fff;
}

header {
  background-color: var(--panel);
  padding: 10px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
header h1 {
  margin: 0;
  font-size: 24px;
  color: var(--accent);
}
header nav {
  margin-top: 8px;
}
header nav img {
  height: 32px;
  vertical-align: middle;
  margin-right: 12px;
}
header nav a {
  color: var(--muted);
  text-decoration: none;
  margin-right: 16px;
  font-size: 14px;
}
header nav a.active {
  color: #ffffff;
  font-weight: 600;
}
header nav form {
  display: inline;
  margin-left: 16px;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  cursor: pointer;
  color: var(--muted);
  box-shadow: none;
}
header nav a:hover {
  color: #ffffff;
}
.container {
  max-width: 1200px;
  margin: 20px auto;
  padding: 0 16px;
}
@media (max-width: 900px) {
  .container {
    padding: 0 8px;
  }
}
@media (max-width: 600px) {
  header h1 {
    font-size: 20px;
  }
  header nav a {
    font-size: 12px;
    margin-right: 12px;
  }
}
/* Footer styles */
footer {
  background-color: var(--panel);
  padding: 10px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}
footer p {
  margin: 4px 0;
}
footer a {
  color: var(--accent);
  text-decoration: none;
}
footer a:hover {
  text-decoration: underline;
}

/* Design form */
form {
  background-color: var(--card);
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(2, 6, 12, 0.6);
}
form h2 {
  margin-top: 0;
  color: var(--accent);
}
form label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
}
form input[type="text"],
form input[type="email"],
form input[type="password"] {
  width: 100%;
  padding: 10px;
  margin-bottom: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background-color: var(--panel);
  color: #e6eef8;
}
form input[type="text"]::placeholder,
form input[type="email"]::placeholder,
form input[type="password"]::placeholder {
  color: var(--muted);
}
form button {
  background-color: var(--accent);
  color: #0f1720;
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
}
form button:hover {
  background-color: #c48e3e;
}

.homepage {
  text-align: center;
}
.homepage h1 {
  font-size: 32px;
  color: var(--accent);
}
.homepage p {
  font-size: 18px;
  color: var(--muted);
}
.homepage .features {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 20px;
}
.homepage .feature {
  background-color: var(--card);
  padding: 16px;
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(2, 6, 12, 0.6);
  width: 200px;
}
.homepage .feature h3 {
  color: var(--accent);
}
.homepage .feature p {
  color: var(--muted);
}
.homepage .call-to-action {
  margin-top: 30px;
}
.homepage .call-to-action a {
  background-color: var(--accent);
  color: #0f1720;
  padding: 12px 24px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
}
.homepage .call-to-action a:hover {
  background-color: #c48e3e;
}
.pointer {
  cursor: pointer;
}

/* Menu contextuel */
.context-menu {
  position: absolute;
  background: #0f1720;
  color: #fff;
  border-radius: 6px;
  padding: 8px 0;
  min-width: 120px;
  display: none; /* caché par défaut */
  box-shadow: 0 2px 10px rgba(0,0,0,0.5);
  z-index: 1000;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.context-menu.show {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

.context-menu .menu-item {
  padding: 10px 14px;
  cursor: pointer;
  transition: background 0.2s;
}

.context-menu .menu-item:hover {
  background: #06101a;;
}

.build-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.build-card {
  background: var(--glass);
  padding: 0;
  border-radius: 8px;
  text-align: center;
  cursor: pointer;
  transition: transform 0.2s;
}
.build-card.active {
  outline: 2px solid var(--accent);
  border-radius: 8px;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}
.build-card:hover {
  transform: translateY(-4px);
}
.build-card img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}
.build-card .name {
  margin-top: 8px;
  font-weight: 600;
  color: var(--accent);
}
.build-card .cost-item {
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted);
}

.btn {
  display: inline-block;
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  transition: background-color 0.2s;
}
.btn-danger {
  background-color: #e53e3e;
  color: #fff;
}
.btn-danger:hover {
  background-color: #c53030;
}
.btn-primary {
  background-color: var(--accent);
  color: #0f1720;
}
.btn-primary:hover {
  background-color: #c48e3e;
}
.btn-secondary {
  background-color: var(--muted);
  color: #0f1720;
}
.btn-secondary:hover {
  background-color: #7b8794;
}
.btn:disabled {
  background-color: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.5);
  cursor: not-allowed;
}
.mt-2 {
  margin-top: 20px;
}