/* Tales'n'Treasures — dunkles Piraten-Theme, Pixel-Look */

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

html, body {
  height: 100%;
  overflow: hidden;
  background: #10151c;
  color: #e8e0cc;
  font-family: "Courier New", Courier, monospace;
}

#wrap {
  display: flex;
  height: 100vh;
}

#game {
  flex: 1;
  display: block;
  min-width: 0;
  image-rendering: pixelated;
  cursor: crosshair;
}

/* ---------- Sidebar ---------- */

#sidebar {
  width: 224px;
  flex: 0 0 224px;
  background: linear-gradient(#2a2018, #201810);
  border-left: 3px solid #5a3a1b;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  overflow-y: auto;
}

#sidebar header h1 {
  font-size: 15px;
  color: #e8c840;
  letter-spacing: 1px;
  text-shadow: 2px 2px 0 #000;
}

#wood {
  font-size: 18px;
  font-weight: bold;
  color: #f4f0e0;
  margin-top: 6px;
}

#seedline {
  font-size: 10px;
  color: #8a7a5a;
}

#minimap {
  width: 192px;
  height: 192px;
  border: 2px solid #5a3a1b;
  image-rendering: pixelated;
  cursor: pointer;
  align-self: center;
}

#sidebar h2 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #b89860;
  border-bottom: 1px solid #4a3520;
  margin-bottom: 4px;
}

/* ---------- Buttons ---------- */

.buildBtn {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-bottom: 4px;
  padding: 7px 8px;
  background: #3a2c1c;
  border: 2px solid #5a3a1b;
  color: #e8e0cc;
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  overflow: hidden;
}

.buildBtn:hover { border-color: #e8c840; }

.buildBtn .prog {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 0;
  background: rgba(232, 200, 64, 0.25);
  pointer-events: none;
  transition: width 0.2s linear;
}

.buildBtn .lbl { position: relative; z-index: 1; text-align: left; }
.buildBtn .cost { position: relative; z-index: 1; color: #b89860; font-size: 11px; }

.buildBtn.locked { opacity: 0.45; }

.buildBtn.ready {
  border-color: #3ec84a;
  animation: pulse 0.8s infinite alternate;
}

@keyframes pulse {
  from { background: #3a2c1c; }
  to { background: #2c4a24; }
}

#infoPanel {
  font-size: 11px;
  line-height: 1.5;
  background: #241a10;
  border: 1px solid #4a3520;
  padding: 8px;
  min-height: 64px;
}

.hint { color: #8a7a5a; }
.warn { color: #d04038; font-weight: bold; }
.task { color: #e8c840; }
.hidden { display: none !important; }
#wood.full { color: #d04038; }
#wrap.dimmed { filter: brightness(0.4); }

/* ---------- Spielmenü ---------- */

.menuGrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}

.menuGrid button {
  padding: 7px 4px;
  background: #3a2c1c;
  border: 2px solid #5a3a1b;
  color: #e8e0cc;
  font-family: inherit;
  font-size: 11px;
  cursor: pointer;
}

.menuGrid button:hover { border-color: #e8c840; }
.menuGrid button.active { border-color: #3ec84a; }
.menuGrid #btnMainMenu { grid-column: 1 / -1; }

.setting {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  color: #b89860;
  cursor: pointer;
}

#saveInfo { font-size: 10px; margin-top: 4px; }

/* ---------- Startbildschirm ---------- */

#startScreen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  background:
    radial-gradient(ellipse at center, rgba(46, 106, 158, 0.25), transparent 70%),
    #10151c;
}

#startBox {
  background: #201810;
  border: 3px solid #5a3a1b;
  padding: 40px 48px;
  text-align: center;
  max-width: 440px;
}

#startBox h1 {
  font-size: 28px;
  color: #e8c840;
  text-shadow: 3px 3px 0 #000;
  margin-bottom: 6px;
}

#startBox .subtitle {
  color: #8a7a5a;
  margin-bottom: 24px;
  font-size: 13px;
}

.bigBtn {
  display: block;
  width: 100%;
  margin-bottom: 10px;
  padding: 14px;
  background: #3a2c1c;
  border: 2px solid #5a3a1b;
  color: #e8e0cc;
  font-family: inherit;
  font-size: 15px;
  cursor: pointer;
}

.bigBtn:hover:not(:disabled) { border-color: #e8c840; }
.bigBtn:disabled { opacity: 0.4; cursor: default; }

#startBox .newRow {
  display: flex;
  gap: 8px;
  margin: 18px 0 0;
}

#startBox .newRow .bigBtn { flex: 1; margin-bottom: 0; }

#startBox .newRow input {
  width: 130px;
  background: #10151c;
  border: 2px solid #5a3a1b;
  color: #e8e0cc;
  font-family: inherit;
  font-size: 12px;
  padding: 0 8px;
}

#startBox .newRow { margin-bottom: 10px; }
#startBox #continueInfo { margin: -4px 0 14px; font-size: 11px; }

/* ---------- Game-Over-Overlay ---------- */

#overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 8, 12, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

#overlay.hidden { display: none; }

#overlayBox {
  background: #201810;
  border: 3px solid #5a3a1b;
  padding: 32px 40px;
  text-align: center;
  max-width: 420px;
}

#overlayBox h2 { font-size: 26px; color: #e8c840; margin-bottom: 12px; }
#overlayBox p { margin-bottom: 10px; font-size: 13px; }
#overlaySeed { color: #8a7a5a; font-size: 11px; }

#overlayBox button {
  margin: 6px 4px 0;
  padding: 10px 16px;
  background: #3a2c1c;
  border: 2px solid #5a3a1b;
  color: #e8e0cc;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
}

#overlayBox button:hover { border-color: #e8c840; }
