* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  background: #151824;
  color: #f4f4f4;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

#game-root {
  max-width: 1100px;
  margin: 0 auto;
  padding: 12px;
}

/* header */

#game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  margin-bottom: 10px;
  background: linear-gradient(90deg, #252a3a, #303b52);
  border-radius: 8px;
  box-shadow: 0 0 12px rgba(0,0,0,0.6);
}

#game-header .title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 1px;
}

.player-login {
  display: flex;
  align-items: center;
  gap: 6px;
}

#player-name-input {
  padding: 4px 6px;
  border-radius: 4px;
  border: 1px solid #555;
  background: #111827;
  color: #f4f4f4;
}

#btn-start {
  padding: 4px 10px;
  border-radius: 4px;
  border: none;
  background: #10b981;
  color: #011;
  font-weight: 600;
  cursor: pointer;
}

#btn-start:hover {
  background: #059669;
}

#save-status {
  font-size: 12px;
  opacity: 0.8;
}

/* layout */

#game-main {
  display: flex;
  gap: 10px;
}

#left-panel {
  flex: 0 0 660px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#right-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

section {
  background: #111827;
  border-radius: 8px;
  padding: 6px 8px;
  box-shadow: 0 0 8px rgba(0,0,0,0.5);
}

section h3 {
  margin: 0 0 4px;
  font-size: 13px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  padding-bottom: 2px;
}

/* canvas */

#game-canvas {
  border-radius: 8px;
  border: 1px solid #4b5563;
  background: #020617;
  box-shadow: 0 0 12px rgba(0,0,0,0.8);
}

/* world info */

#world-info {
  font-size: 12px;
  line-height: 1.4;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 6px;
  border-radius: 6px;
  background: #020617;
  border: 1px solid #1f2937;
}

.world-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.world-label {
  font-weight: 600;
  margin-right: 4px;
}

.world-effects {
  margin-top: 3px;
  font-size: 11px;
  opacity: 0.9;
}

/* ไอคอน เวลา / อากาศ */

.icon {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  border: 1px solid rgba(255,255,255,0.6);
}

/* เวลา */
.time-icon-morning {
  background: linear-gradient(#fcd37f, #f9a94a);
}
.time-icon-day {
  background: linear-gradient(#6cc6ff, #b6e5ff);
}
.time-icon-evening {
  background: linear-gradient(#f28b5b, #5b2e5d);
}
.time-icon-night {
  background: linear-gradient(#050815, #111a33);
}

/* อากาศ */
.weather-icon-clear {
  background: linear-gradient(#6cc6ff, #fdfdfd);
}
.weather-icon-rain {
  background: linear-gradient(#2f4f7f, #6a8fb8);
}
.weather-icon-fog {
  background: linear-gradient(#dcdcdc, #f5f5f5);
}
.weather-icon-snow {
  background: linear-gradient(#e4f0ff, #ffffff);
}

/* stat / quest / inventory */

.stat-row,
.quest-row,
.inv-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 3px;
  font-size: 12px;
}

#stats,
#quests,
#inventory {
  font-size: 12px;
}

.btn-small {
  padding: 1px 6px;
  font-size: 11px;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  background: #1f2937;
  color: #e5e7eb;
}

.btn-small:disabled {
  opacity: 0.4;
  cursor: default;
}

.btn-small:not(:disabled):hover {
  background: #374151;
}

/* log */

#section-log {
  margin-top: 8px;
  max-height: 180px;
  overflow-y: auto;
}

#log {
  max-height: 140px;
  overflow-y: auto;
  font-size: 12px;
}

.log-entry {
  border-bottom: 1px dashed rgba(148,163,184,0.3);
  padding: 2px 0;
}

/* footer */

#game-footer {
  margin-top: 6px;
  font-size: 11px;
  opacity: 0.75;
}

/* responsive */

@media (max-width: 960px) {
  #game-main {
    flex-direction: column;
  }
  #left-panel {
    flex: 1;
  }
}