/* Sidebar rechts für Patchnotes und Roadmap */
.sidebar-right {
  opacity: 0.8;
  position: fixed;
  right: 32px;
  top: 120px;
  width: 280px;
  min-height: 400px;
  background: #fffbe8;
  border: 2px solid #73a24e;
  border-radius: 12px;
  box-shadow: 0 2px 8px #0002;
  padding: 18px 20px 18px 20px;
  z-index: 99;
  font-size: 15px;
}
.sidebar-right h3 {
  margin-top: 0;
  font-size: 1.1em;
  color: #73a24e;
}
.sidebar-right ul {
  margin: 8px 0 18px 0;
  padding-left: 18px;
}
.sidebar-right li {
  margin-bottom: 6px;
}
/* Admiral kommt von links ins Bild */
.mascot-container.show-admiral {
  animation: mascot-slide-in 1.2s cubic-bezier(.7,.2,.7,1) forwards;
  opacity: 1 !important;
  pointer-events: auto !important;
}
@keyframes mascot-slide-in {
  0% { opacity: 0; transform: translateX(-450px); }
  100% { opacity: 1; transform: translateX(0); }
}
.admiral-hide-btn {
  background: #1976d2;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 0.98em;
  cursor: pointer;
  margin-left: 8px;
  box-shadow: 0 2px 6px #0002;
  transition: background 0.2s;
}
.admiral-hide-btn:hover {
  background: #145ea8;
}
.mascot-container.hide-admiral {
  animation: mascot-slide-left 1.2s cubic-bezier(.7,.2,.7,1) forwards;
}
@keyframes mascot-slide-left {
  0% { opacity: 1; transform: translateX(0); }
  80% { opacity: 1; transform: translateX(-600px); }
  100% { opacity: 0; transform: translateX(-900px); pointer-events: none; }
}
.mascot-speech {
  position: absolute;
  left: 160px;
  top: 20px;
  min-width: 220px;
  max-width: 320px;
  background: #fffbe8;
  color: #222;
  border: 2px solid #73a24e;
  border-radius: 12px;
  box-shadow: 0 2px 8px #0002;
  padding: 16px 18px 16px 24px;
  font-size: 1.08em;
  z-index: 101;
  pointer-events: auto;
}
/* Tutorial-Maskottchen links neben Main Container */
.mascot-container {
  position: fixed;
  left: 0;
  top: 120px;
  z-index: 100;
  width: 160px;
  display: flex;
  justify-content: flex-end;
  pointer-events: none;
}
.mascot-img {
  width: 140px;
  height: auto;
  filter: drop-shadow(0 2px 8px #0006);
  background: none;
  border-radius: 12px;
}
.container {
  margin-left: 170px;
}
/* Audio Controls unter dem Logo */
.audio-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 0 24px;
}
#volume-slider {
  accent-color: #1976d2;
}
#mute-btn {
  background: none;
  border: none;
  font-size: 1.3em;
  cursor: pointer;
  padding: 2px 6px;
}
.dropdown-container {
  position: relative;
}
/* Drag handle for dropdown cards */
.drag-handle {
  cursor: grab;
  position: absolute;
  left: 50%;
  top: 8px;
  transform: translateX(-50%);
  font-size: 1.3em;
  user-select: none;
  opacity: 0.6;
  transition: opacity 0.2s;
  z-index: 1001;
  pointer-events: auto;
}
.drag-handle:active {
  cursor: grabbing;
  opacity: 1;
}

.card.dragging {
  opacity: 0.85;
  border: 4px solid #ff9800;
  box-shadow: 0 0 32px 8px #ff9800cc;
  background: #fff3e0 !important;
  z-index: 10000;
  transition: box-shadow 0.1s, border 0.1s, background 0.1s;
}

/* Extra highlight for drop target */
.card.drag-over {
  border: 4px dashed #1976d2;
  box-shadow: 0 0 24px 4px #1976d2cc;
}
.storage-full {
  color: #fff !important;
  background: #d32f2f !important;
  animation: blink-red 1s steps(2, start) infinite;
  border-radius: 6px;
}

@keyframes blink-red {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}
/* Workaround: Unsichtbare vertikale Scrollbar, Layout bleibt stabil */
html {
  scrollbar-width: none; /* Firefox */
}
body::-webkit-scrollbar {
  width: 0px; /* Chrome, Safari, Edge */
  background: transparent;
}
.population-stat #merchants-count {
  margin-right: 0;
}
.population-stat .population-merchant-max {
  margin-left: 2px;
  font-size: 0.95em;
  opacity: 0.8;
}
/* Compact population menu spacing */
.population-overview, .population-stat-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.population-stat {
  padding: 4px 8px;
  margin: 0;
}
.population-label, #houses-count, #merchants-count, #workers-count, #merchant-discount, #food-status, #daily-food-need {
  margin-right: 4px;
}
.island-content {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.building-shop {
  position: static;
  margin-bottom: 16px;
  width: 640px;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
  background: rgba(255,255,240,0.95);
  border-radius: 20px;
  box-shadow: none;
  padding: 12px 10px 10px 10px;
}
.island-canvas {
  display: block;
  margin-top: 80px;
}
.building-list {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}
.building-item {
  flex: 1 1 30%;
  max-width: 30%;
  min-width: 180px;
  box-sizing: border-box;
  padding: 0 4px;
}
body, button, input, select, textarea, span, div, p, h1, h2, h3, h4, h5, h6 {
  font-size: 14px;
}
/* Farm info for buildings: smaller font */
.building-farm-info {
  font-size: 14px;
}
/* Fischspot Legende */
.legend-color.fishspot {
  display: inline-block;
  width: 18px;
  height: 18px;
  background: #38bdf8 !important;
  border-radius: 4px;
  margin-right: 6px;
  vertical-align: middle;
}

*{box-s.import-btn {
  display: inline-block;
  border: 1px solid #73a24e;
  background: linear-gradient(90deg, #a9c25d 60%, #73a24e 100%);
  color: #39395f;
  padding: 8px 12px;
  border-radius: 14px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  text-align: center;
  transition: transform .07s ease, background 0.2s;
  box-shadow: none;
}

html,body{
  margin:0;
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Helvetica,Arial,sans-serif;
  background: #f5eec2 url('pics/background.png') no-repeat center center fixed;
  background-size: cover;
  color: #39395f;
  font-size:18px;
  line-height:1.6;
  overflow-y: scroll;
  overflow-x: hidden;
}

html {
  overflow-y: scroll;
}
.topbar{
	display:flex;
	justify-content:space-between;
	align-items:center;
	padding:24px 32px;
  border-bottom:none;
  background:transparent;
  color:#39395f;
	position:sticky;
	top:0;
	box-shadow:none;
	z-index:100;
}

.welcome-message {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	background: #059669;
	color: white;
	padding: 8px 16px;
	border-radius: 6px;
	font-weight: 600;
	opacity: 0;
	transition: opacity 0.5s ease;
	pointer-events: none;
	z-index: 1000;
}

.welcome-message.show {
	opacity: 1;
}

.header-left {
	display: flex;
	align-items: center;
	gap: 20px;
}

.header-logo {
	height: 80px;
	width: auto;
	object-fit: contain;
}
h1{
	font-weight:700;
	font-size:28px;
	margin:0;
	letter-spacing:.02em;
	color:#39395f;
}
.container{
	display:flex;
	flex-direction:column;
	gap:16px;
  padding:16px;
  max-width:800px;
	margin:0 auto;
}
.card{
  background:#f5eec2cc;
  border:1px solid #a9c25d;
  color:#39395f;
	border-radius:20px;
  padding:12px 10px 10px 10px;
	box-shadow:none;
	margin-bottom: 8px;
	position: relative;
	z-index: 50;
}

.card:last-child {
	margin-bottom: 0;
}
.card h2{
	margin:0 0 18px 0;
	font-size:22px;
	font-weight:600;
}
#market-time{
	margin:-6px 0 18px 0;
	font-size:16px;
}
.subtle{
	opacity:.8;
	font-size:14px;
}
table{
	width:100%;
	border-collapse:collapse;
	font-size:17px;
}
th,td{
	border-bottom:1px solid #a9c25d;
	padding:12px 10px;
	text-align:left;
}
th{
	font-size:13px;
	text-transform:uppercase;
	letter-spacing:.08em;
	opacity:.8;
}
td input[type="number"]{
	width:90px;
	padding:8px;
	border-radius:10px;
	border:1px solid #a9c25d;
	background:#f5eec2;
	color:#39395f;
	font-size:16px;
}
button{
  border:1px solid #73a24e;
  background:linear-gradient(90deg,#a9c25d 60%,#73a24e 100%);
  color:#39395f;
  padding:4px 8px;
  border-radius:6px;
  cursor:pointer;
  font-size:14px;
  font-weight:500;
  transition:transform .07s ease;
  box-shadow:none;
}
button:hover{
	transform:translateY(-2px) scale(1.04);
	box-shadow:none;
}
button:disabled{
	opacity:.5;
	cursor:not-allowed;
}
.stats{
	display:flex;
	gap:24px;
	font-weight:600;
	font-size:18px;
	color:#39395f;
}
.footer{
  border-top:none;
  background:rgba(65,106,89,0);
  color:#000;
  opacity:1;
  text-align:center;
  font-size:15px;
  position:fixed;
  left:0;
  right:0;
  bottom:0;
  z-index:100;
}
.log{
	font-family:ui-monospace,Menlo,Consolas,monospace;
	background:#f5eec2cc;
	border:1px solid #a9c25d;
	color:#39395f;
	border-radius:14px;
	padding:18px;
	height:180px;
	overflow:auto;
	font-size:15px;
}
.actions{
	margin-top:18px;
	display:flex;
	gap:12px;
}
.price-up{color:#4ade80;font-weight:700;}
.price-down{color:#f87171;font-weight:700;}

/* Save-System Styles */
.save-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
  background:#f5eec2cc;
  border:1px solid #a9c25d;
  border-radius:20px;
  padding:28px 24px;
}

.save-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.save-controls button,
.import-btn {
  font-size: 14px;
  padding: 4px 8px;
  min-width: auto;
}

.import-btn {
  display: inline-block;
  border: 1px solid #73a24e;
  background: linear-gradient(90deg, #a9c25d 60%, #73a24e 100%);
  color: #39395f;
  padding: 8px 12px;
  border-radius: 14px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  text-align: center;
  transition: transform .07s ease, box-shadow .2s;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
}

.import-btn:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow: none;
}

.autosave-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color:#39395f;
}

.autosave-controls select {
  padding: 4px 8px;
  border-radius: 8px;
  border: 1px solid #a9c25d;
  background: #f5eec2;
  color: #39395f;
  font-size: 14px;
}

.save-status {
  font-size: 12px;
  opacity: 0.8;
  min-height: 18px;
  color:#39395f;
}

.backup-section h4 {
  margin: 8px 0 4px 0;
  font-size: 14px;
  opacity: 0.8;
  color:#39395f;
}

.backup-list {
  font-size: 12px;
  max-height: 120px;
  overflow-y: auto;
  color:#39395f;
}

.backup-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 8px;
  margin: 2px 0;
  background: #39395f;
  border-radius: 6px;
  border: 1px solid #a9c25d;
  color:#f5eec2;
}

.backup-item button {
  font-size: 10px;
  padding: 2px 6px;
  min-width: auto;
  background: linear-gradient(90deg, #a9c25d 60%, #73a24e 100%);
  color: #39395f;
  border: 1px solid #73a24e;
}

@media(max-width: 600px) {
  .save-controls {
    flex-direction: column;
  }
  
  .save-controls button,
  .import-btn {
    width: 100%;
  }
}

/* Debug-Menü Styles */
.debug-container {
  position: relative;
  z-index: 300;
}

.debug-btn {
  font-size: 14px !important;
  padding: 4px 8px !important;
  min-width: auto !important;
  background: linear-gradient(90deg, #dc2626 60%, #ef4444 100%) !important;
  border: 1px solid #dc2626 !important;
  color: white !important;
  border-radius: 8px !important;
  position: relative;
  z-index: 301;
}

.debug-btn:hover {
  background: linear-gradient(90deg, #ef4444 60%, #f87171 100%) !important;
}

.debug-menu {
  position: fixed;
  top: auto;
  left: auto;
  background: #f5eec2;
  border: 1px solid #a9c25d;
  color:#39395f;
  border-radius: 12px;
  padding: 12px;
  width: 340px;
  box-shadow: none;
  z-index: 302;
  margin-top: 8px;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
  visibility: hidden;
  pointer-events: none;
}

.debug-menu.show {
  opacity: 1;
  transform: translateY(0);
  visibility: visible;
  pointer-events: auto;
}

.debug-menu-header {
  font-weight: 600;
  font-size: 14px;
  padding-bottom: 8px;
  margin-bottom: 8px;
  border-bottom: 1px solid #a9c25d;
  color: #39395f;
}

.debug-menu button {
  width: 100%;
  text-align: left;
  margin: 2px 0;
  padding: 8px 12px;
  font-size: 12px;
  background: linear-gradient(90deg, #a9c25d 60%, #73a24e 100%);
  border: 1px solid #73a24e;
  color: #39395f;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s;
}

.debug-menu button:hover {
  background: #73a24e;
  color:#39395f;
  transform: none;
  box-shadow: none;
}

.debug-menu-info {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #a9c25d;
  text-align: center;
}

.debug-menu-info small {
  color: #39395f;
  font-size: 10px;
}

.help-content {
  text-align: left;
  line-height: 1.4;
  max-height: 340px;
  overflow-y: auto;
  padding-right: 12px;
}

/* Spielanleitung ohne Transparenz */
#help-menu {
  background: #f5eec2 !important;
}

.help-content h4 {
  margin: 12px 0 6px 0;
  color: #39395f;
  font-size: 14px;
}

.help-content p {
  margin: 6px 0;
  font-size: 12px;
  color: #39395f;
}

/* Debug-Status im Button */
.debug-btn.active {
  background: linear-gradient(90deg, #059669 60%, #10b981 100%) !important;
  border-color: #059669 !important;
}

.debug-btn.active:hover {
  background: linear-gradient(90deg, #10b981 60%, #34d399 100%) !important;
}

/* Section Dropdown Styles */
.dropdown-container {
  width: 100%;
  position: relative;
  z-index: 200;
}

.section-dropdown-btn {
  width: 100%;
  text-align: left;
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  margin: 0 !important;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: opacity 0.2s ease;
  position: relative;
  z-index: 201;
}

.section-dropdown-btn:hover {
  opacity: 0.8;
  transform: none !important;
  box-shadow: none !important;
}

.section-dropdown-btn h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.dropdown-arrow {
  font-size: 14px;
  transition: transform 0.2s ease;
  color: #39395f;
  flex-shrink: 0;
}

.section-dropdown-btn.active .dropdown-arrow {
  transform: rotate(180deg);
}

.section-dropdown {
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition: opacity 0.3s ease, max-height 0.3s ease, padding 0.3s ease;
  padding: 0;
  position: relative;
  z-index: 199;
}

.section-dropdown.show {
  opacity: 1;
  max-height: 2000px;
  padding: 18px 0 0 0;
}

/* Spezielle Styles für verschiedene Dropdown-Inhalte */
.section-dropdown #market-time {
  margin-bottom: 18px;
}

.section-dropdown .actions {
  margin-top: 18px;
}

.section-dropdown .log {
  margin-top: 0;
}

/* Card-spezifische Anpassungen */
.card {
  padding: 18px 16px 16px 16px;
}

/* Responsive Verhalten für Dropdowns */
@media(max-width: 600px) {
  .section-dropdown-btn h2 {
    font-size: 20px;
  }
  
  .dropdown-arrow {
    font-size: 12px;
  }
}

/* Flying Numbers Animation */
.flying-number {
  position: fixed;
  pointer-events: none;
  font-size: 18px;
  font-weight: bold;
  z-index: 1000;
  animation: flyUp 2s ease-out forwards;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
}

.flying-number.positive {
  color: #10b981;
}

.flying-number.negative {
  color: #ef4444;
}

@keyframes flyUp {
  0% {
    opacity: 1;
    transform: translateY(0px) scale(1);
  }
  50% {
    opacity: 1;
    transform: translateY(-30px) scale(1.1);
  }
  100% {
    opacity: 0;
    transform: translateY(-60px) scale(0.8);
  }
}

/* Population System Styles */
.population-overview {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}

.population-stat {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  padding: 4px 8px;
  background: #f5eec2cc;
  border: 1px solid #a9c25d;
  color:#39395f;
  border-radius: 8px;
  font-size: 15px;
}

.population-label {
  font-weight: 500;
}

.discount-display {
  color: #4CAF50;
  font-weight: bold;
}

.food-status {
  font-weight: bold;
}

.food-sufficient {
  color: #4CAF50;
}

.food-insufficient {
  color: #f44336;
}

.food-details {
  font-size: 0.9em;
  color: #666;
}

.worker-assignments-inline {
  margin-top: 8px;
}

.worker-assignment-inline {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 5px;
  padding: 3px;
  background-color: #f5f5f5;
  border-radius: 3px;
  font-size: 0.85em;
}

.worker-name-small {
  min-width: 70px;
  font-weight: bold;
  font-size: 0.8em;
}

.worker-select-small {
  flex: 1;
  padding: 2px 4px;
  border: 1px solid #a9c25d;
  background:#f5eec2;
  color:#39395f;
  border-radius: 3px;
  font-size: 0.8em;
}

.dismiss-btn-small {
  width: 18px;
  height: 18px;
  padding: 0;
  background-color: #f44336;
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dismiss-btn-small:hover {
  background-color: #d32f2f;
}

.worker-assignments {
  margin-top: 15px;
  padding: 10px;
  border: 1px solid #a9c25d;
  border-radius: 5px;
  background: #f5eec2cc;
  color:#39395f;
}

.worker-assignment {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  padding: 5px;
  background: #39395f;
  color:#f5eec2;
  border-radius: 3px;
}

.worker-name {
  min-width: 80px;
  font-weight: bold;
  color:#f5eec2;
}

.worker-select {
  flex: 1;
  padding: 4px 8px;
  border: 1px solid #a9c25d;
  background:#f5eec2;
  color:#39395f;
  border-radius: 3px;
}

.dismiss-btn {
  padding: 4px 8px;
  background-color: #f44336;
  color: white;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  font-size: 0.8em;
}

.dismiss-btn:hover {
  background-color: #d32f2f;
}

.discount-display #merchant-discount {
  color: #4ade80;
  font-weight: 600;
}

.population-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.recruit-btn {
  font-size: 14px;
  padding: 4px 8px;
}

.house-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #334155;
}

.house-btn {
  font-size: 14px;
  padding: 4px 8px;
}

/* Island Styles */
.island-canvas {
  border: 2px solid #a9c25d;
  border-radius: 8px;
  background: #39395f;
  margin: 16px 0;
  cursor: crosshair;
}

.island-info {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.island-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 14px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-color {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1px solid #a9c25d;
}

.legend-color.water { background: #2563eb; }
.legend-color.grass { background: #22c55e; }
.legend-color.forest { background: #166534; }
.legend-color.mountain { background: #6b7280; }
.legend-color.beach { background: #fbbf24; }
.legend-color.iron { background: #dc2626; }
.legend-color.coal { background: #1f2937; }

.tile-info {
  background: #f5eec2cc;
  border: 1px solid #a9c25d;
  color:#39395f;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 14px;
  min-height: 40px;
  display: flex;
  align-items: center;
}

.island-content {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.building-shop {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: flex-start;
  width: 100%;
  background: #f5eec2cc;
  border: 1px solid #a9c25d;
  color:#39395f;
  border-radius: 6px;
  padding: 8px;
  height: fit-content;
}

.building-shop h3,
.building-shop h4 {
  color: #39395f;
  margin: 0 0 8px 0;
  text-align: center;
  font-size: 14px;
}

.buildings-list,
.building-list {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

.building-item {
  background: #f5eec2cc;
  border: 1px solid #a9c25d;
  color:#39395f;
  border-radius: 3px;
  padding: 6px;
  flex: 1 1 30%;
  max-width: 30%;
  min-width: 180px;
  box-sizing: border-box;
}

.building-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.building-name {
  font-weight: 600;
  color: #39395f;
  font-size: 12px;
}

.building-cost {
  color: #a9c25d;
  font-weight: 600;
  font-size: 11px;
}

.building-buy-btn {
  width: 100%;
  background: linear-gradient(90deg, #a9c25d 60%, #73a24e 100%);
  color: #39395f;
  border: 1px solid #73a24e;
  border-radius: 3px;
  padding: 4px 8px;
  font-size: 14px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.building-buy-btn:hover {
  background: #73a24e;
}

.building-buy-btn:disabled {
  background: #a9c25d;
  color: #39395f;
  opacity: 0.5;
  cursor: not-allowed;
}