@font-face {
  font-family: Bebas-Regular;
  src: url('fonts/Bebas-Regular.otf');
}

html, body {
  height: 100%;
  margin: 0;
  font-family: Bebas-Regular, sans-serif;

  background: linear-gradient(0deg, #3a5177, #81b1e0);
}

h1 {
  text-align: center;
  font-size: x-large;
  font-weight: normal;
  margin: 0;
  color: white;
}

#root-window {
  height: 100%;
}

#render-target {
  position: relative;
  height: 100%;
}

#instructions {
  position: absolute;
  color: white;
  left: 0;
  bottom: 0;
  margin: 8px;
}

#version {
  position: absolute;
  color: white;
  right: 0;
  bottom: 0;
  margin: 8px;
}

.text-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  color: white;
  font-size: 5em;
  display: flex;
  align-items: center;
  justify-content: center;
}

.container {
  background-color: #00000048;
  padding: 12px;
}

#bottom-dock,
#game-controls {
  display: block;
}

#game-controls {
  position: absolute;
  top: 64px;
  left: 0;
  bottom: 0;
  width: 56px;
  padding: 4px;
  box-shadow: none;
  background: transparent;
}

#game-controls .view-bar {
  display: none;
}

#ui-toolbar {
  position: static;
  flex-direction: column;
  box-shadow: 0px 0px 1px black;
}

.nav-icon-btn {
  background: transparent;
  border: none;
  color: white;
  font-size: 1.1em;
  cursor: pointer;
  padding: 2px 6px;
  font-family: inherit;
}

.dock-more-btn {
  display: none;
}

.slide-panel {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: #1e2331f5;
  color: white;
  padding: 12px 12px calc(12px + env(safe-area-inset-bottom));
  transform: translateY(100%);
  transition: transform 0.25s ease;
  z-index: 96;
  border-radius: 12px 12px 0 0;
  max-height: 45vh;
}

.slide-panel.open {
  transform: translateY(0);
}

.slide-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 1.1em;
}

.action-bar-inner {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.action-label {
  font-size: 0.85em;
  color: #aaa;
}

.action-btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.action-bar-inner select {
  width: 100%;
  background: #121622;
  color: white;
  border: none;
  padding: 8px;
  border-radius: 6px;
  font-family: inherit;
}

.settings-toggle {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 16px 0;
  font-size: 0.95em;
  line-height: 1.4;
  cursor: pointer;
}

.settings-toggle input {
  margin-top: 4px;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.settings-hint {
  font-size: 0.85em;
  color: #aaa;
  margin: 0 0 16px;
}

.settings-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.settings-section {
  margin-bottom: 16px;
}

.settings-section h3 {
  font-size: 1em;
  margin: 0 0 8px;
  color: #c8d8f0;
}

.settings-select {
  width: 100%;
  background: #121622;
  color: white;
  border: none;
  padding: 8px;
  border-radius: 6px;
  font-family: inherit;
  margin-bottom: 8px;
}

.welcome-panel p {
  line-height: 1.5;
  margin-bottom: 16px;
}

.ui-button {
  height: 48px;
  width: 48px;
  margin: 4px 0;

  transition: background-color 0.1s ease-in-out;
  
  background-color: #1e2331cd;
  border: none;
  border-radius: 8px;

  display: flex;
  justify-content: center;
  align-items: center;
}

.ui-button.selected {
  background-color: #3a3f50d3;
  outline: 2px solid rgb(101, 101, 135);
}

.ui-button:not(.selected):hover {
  background-color: #121622d3;
}

.ui-container {
  background-color: #33333355;
  padding: 16px;
}

.toolbar-icon {
  width: 32px;
  height: 32px;
  pointer-events: none;
}

/* TITLE BAR */

#title-bar {
  position: fixed;

  top: 0;
  left: 0px;
  right: 0;
  height: 48px;

  background-color: #00000048;
  color: white;
  padding: 8px;

  box-shadow: 0px 0px 1px black;

  display: flex;
  justify-content: space-evenly;
  align-items: center;
}

.title-bar-items {
  flex: 1 1 33%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.5em;
}

.title-bar-items.title-bar-center-items {
  font-size: 2em;
}

#population-icon {
  position: relative;
  width: 32px;
  height: 32px;
  top: -3px;
}

#population-counter {
  margin-left: 8px;
}

/* INFO PANEL */

#info-panel {
  visibility: hidden;
  position: fixed;
  top: 64px;
  right: 0px;
  padding: 0; 
  padding-bottom: 16px;
  width: 300px;

  background-color: #00000048;
}

.info-heading {
  text-align: center;
  font-size: 1em;
  margin-top: 12px;
  margin-bottom: 12px;

  background-color: #00000060;

  box-shadow: 0px 0px 1px black;

  color: white;
  padding: 4px;
}

.info-heading:first-of-type {
  margin-top: 0px;
}

.info-label {
  margin-left: 12px;
  font-size: 1em;
  color: rgb(193, 193, 193)
}

.info-value {
  margin-left: 4px;
  font-size: 1.2em;
  color: #ffffff;
  text-align: right;
}

.info-citizen-list {
  list-style-type: none;
  padding: 0;
}

.info-citizen {
  background-color: #222941a0;
  color: white;
  padding: 4px 16px;
  margin: 4px 0;
  border-radius: 8px;
  box-shadow: 0 2px 0 0px #151820;
}

.info-citizen-name {
  font-size: 1.1em;
}

.info-citizen-icon {
  position: relative;
  width: 18px;
  height: 18px;
  top: 2px;
  margin-right: 2px;
}

.info-citizen-details {
  font-size: 1em;
  display: flex;
  justify-content: flex-start;
  gap: 16px;
}

/* --- Classroom SimCity extensions --- */

#disaster-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s;
  z-index: 50;
}

.banner-message {
  position: fixed;
  top: 56px;
  left: 50%;
  transform: translateX(-50%);
  background: #1e2331ee;
  color: white;
  padding: 10px 20px;
  border-radius: 8px;
  visibility: hidden;
  z-index: 100;
  font-size: 1.2em;
}

.banner-message.milestone {
  background: #2d6a4f;
}

.banner-message.toast {
  bottom: 80px;
  top: auto;
  background: #333;
}

#top-nav {
  position: fixed;
  top: 48px;
  right: 8px;
  display: flex;
  gap: 12px;
  z-index: 90;
  font-size: 0.9em;
}

#top-nav a, #top-nav span {
  color: white;
  text-decoration: none;
}

#stats-panel {
  position: fixed;
  top: 72px;
  right: 8px;
  width: 200px;
  z-index: 80;
  font-size: 0.95em;
  color: white;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  margin: 4px 0;
}

.stat-row.time-row span:last-child {
  color: #ffcc00;
  font-size: 1.2em;
}

.view-bar {
  position: fixed;
  bottom: 8px;
  left: 60px;
  display: flex;
  gap: 4px;
  z-index: 80;
}

#view-buttons.view-bar {
  position: fixed;
}

.view-btn, .action-btn {
  background: #1e2331cd;
  color: white;
  border: none;
  border-radius: 6px;
  padding: 8px 12px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9em;
}

.mobile-more-actions {
  display: none;
}

.action-btn.small {
  padding: 6px 10px;
  font-size: 0.8em;
}

.action-btn.small.selected {
  background: #5a6a8a;
  outline: 2px solid rgb(101, 101, 135);
}

.action-btn.secondary {
  background: #3a5177;
}

.action-btn.danger {
  background: #8b2635;
}

.action-bar {
  display: none;
}

/* Desktop: legacy action bar hidden — actions in More panel */

.action-bar select {
  background: #1e2331;
  color: white;
  border: none;
  padding: 6px;
  border-radius: 4px;
  font-family: inherit;
}

.god-icon {
  color: white;
  font-size: 0.75em;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.modal-panel {
  background: #1e2331;
  color: white;
  padding: 24px;
  border-radius: 12px;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-panel h2, .modal-panel h3 {
  margin-top: 0;
}

.end-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 16px 0;
}

.end-stats div {
  background: #00000040;
  padding: 12px;
  border-radius: 8px;
  text-align: center;
}

.end-stats span {
  display: block;
  font-size: 0.85em;
  color: #aaa;
}

.end-stats strong {
  font-size: 1.8em;
}

.end-actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.reflection-list {
  text-align: left;
  font-size: 0.95em;
  line-height: 1.5;
}

#cheat-console {
  position: fixed;
  bottom: 60px;
  left: 60px;
  width: 320px;
  background: #000000cc;
  color: #0f0;
  padding: 8px;
  border-radius: 8px;
  display: none;
  flex-direction: column;
  z-index: 150;
  font-family: monospace;
  font-size: 0.85em;
}

#cheat-input {
  background: #111;
  color: #0f0;
  border: 1px solid #333;
  padding: 6px;
  margin-top: 4px;
}

/* Auth / data pages */
.page-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.page-container {
  background: #1e2331ee;
  color: white;
  padding: 32px;
  border-radius: 12px;
  width: 100%;
  max-width: 420px;
}

.page-container.wide {
  max-width: 960px;
}

.subtitle {
  text-align: center;
  color: #aaa;
  margin-bottom: 20px;
}

.auth-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.tab {
  flex: 1;
  background: #333;
  color: white;
  border: none;
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
}

.tab.active {
  background: #3a5177;
}

.auth-form label {
  display: block;
  margin-bottom: 12px;
}

.auth-form input {
  width: 100%;
  padding: 8px;
  margin-top: 4px;
  border: none;
  border-radius: 4px;
  box-sizing: border-box;
}

.auth-message {
  color: #ffcc00;
  text-align: center;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85em;
}

.data-table th, .data-table td {
  padding: 8px;
  border-bottom: 1px solid #444;
  text-align: left;
}

.data-table th {
  background: #00000040;
}

.table-wrap {
  overflow-x: auto;
  margin-bottom: 24px;
}

.clickable-row {
  cursor: pointer;
}

.clickable-row:hover {
  background: #ffffff10;
}

.admin-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.admin-toolbar input {
  flex: 1;
  min-width: 150px;
  padding: 8px;
  border: none;
  border-radius: 4px;
}

.ai-tip-box {
  margin-top: 16px;
  padding: 12px;
  background: #00000040;
  border-radius: 8px;
}

.ai-tip-box p, .ai-text {
  font-size: 0.9em;
  line-height: 1.4;
  margin-bottom: 8px;
}

.ai-text {
  font-style: italic;
  color: #c8d8f0;
  margin-top: 8px;
}

a {
  color: #81b1e0;
}

/* Mobile & tablet */
@media (max-width: 900px) {
  html, body, #root-window {
    height: 100%;
    height: 100dvh;
    overflow: hidden;
  }

  #instructions, #version {
    display: none;
  }

  .text-overlay {
    font-size: 2.5em;
  }

  #title-bar {
    height: 44px;
    padding: 4px 8px;
    z-index: 92;
  }

  .title-bar-items {
    font-size: 0.95em;
  }

  .title-bar-items.title-bar-center-items {
    font-size: 1em;
    flex: 1 1 50%;
  }

  .title-date-sep,
  #sim-time {
    display: none;
  }

  #population-icon {
    width: 22px;
    height: 22px;
  }

  #population-counter {
    margin-left: 4px;
  }

  /* Stats strip — full width under title bar */
  #stats-panel {
    top: 44px;
    left: 0;
    right: 0;
    width: 100%;
    max-width: none;
    min-width: 0;
    padding: 4px 6px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 2px 8px;
    border-radius: 0;
    font-size: 0.62em;
    z-index: 91;
    box-sizing: border-box;
  }

  .stat-row {
    margin: 0;
    flex: 0 0 auto;
    gap: 4px;
  }

  .stat-row.time-row span:last-child {
    font-size: 1em;
  }

  /* Nav row — centered below stats, no overlap */
  #top-nav {
    top: 68px;
    left: 0;
    right: 0;
    justify-content: center;
    gap: 10px;
    font-size: 0.72em;
    flex-wrap: wrap;
    padding: 2px 8px 4px;
    z-index: 90;
  }

  #top-nav a {
    padding: 2px 6px;
  }

  #settings-btn {
    padding: 2px 8px;
  }

  .mobile-more-actions {
    display: flex;
  }

  .toolbar-extra {
    display: none !important;
  }

  /* Hide left vertical toolbar on mobile */
  #ui-toolbar {
    position: static;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 4px;
    padding: 0;
    box-shadow: none;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex: 1 1 auto;
    min-width: 0;
  }

  #ui-toolbar::-webkit-scrollbar {
    display: none;
  }

  #ui-toolbar .ui-button {
    flex: 0 0 auto;
    margin: 0;
    height: 40px;
    width: 40px;
    min-width: 40px;
  }

  #ui-toolbar .toolbar-icon {
    width: 26px;
    height: 26px;
  }

  #view-buttons.view-bar {
    position: static;
    justify-content: stretch;
    gap: 3px;
    padding: 0;
    flex-wrap: nowrap;
    flex: 0 0 auto;
  }

  .view-btn {
    padding: 6px 4px;
    font-size: 0.65em;
    flex: 1 1 0;
    min-width: 0;
    white-space: nowrap;
  }

  #game-controls {
    display: flex;
    flex-direction: column;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 95;
    width: 100%;
    padding: 4px 6px calc(4px + env(safe-area-inset-bottom));
    gap: 4px;
    background: #1e2331ee;
    border-radius: 0;
    pointer-events: auto;
    box-sizing: border-box;
  }

  #game-controls .view-bar {
    display: flex;
    position: static;
    justify-content: center;
    gap: 3px;
    padding: 0;
    flex-wrap: nowrap;
  }

  .dock-row {
    display: flex;
    align-items: center;
    width: 100%;
    min-width: 0;
  }

  .toolbar-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    min-width: 0;
  }

  .dock-more-btn {
    display: block;
    align-self: stretch;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 8px 16px;
    background: #3a3f50;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-family: inherit;
    cursor: pointer;
  }

  #info-panel {
    top: auto;
    bottom: calc(168px + env(safe-area-inset-bottom));
    right: 4px;
    left: 4px;
    width: auto;
    max-height: 28vh;
    overflow-y: auto;
  }

  #cheat-console {
    bottom: calc(180px + env(safe-area-inset-bottom));
    left: 4px;
    right: 4px;
    width: auto;
  }

  .banner-message {
    top: 96px;
    font-size: 0.85em;
    max-width: 92vw;
    text-align: center;
    padding: 8px 12px;
  }

  .banner-message.toast {
    bottom: calc(180px + env(safe-area-inset-bottom));
    top: auto;
  }

  .modal-panel {
    max-width: 92vw;
    padding: 16px;
  }

  .end-actions {
    flex-direction: column;
  }

  .end-actions .action-btn {
    text-align: center;
  }
}

/* Desktop */
@media (min-width: 901px) {
  #game-controls {
    position: absolute;
    top: 64px;
    left: 0;
    bottom: 0;
    width: 56px;
    padding: 4px;
    background: transparent;
    flex-direction: column;
  }

  #game-controls .view-bar {
    display: none;
  }

  #view-buttons.view-bar {
    display: flex;
    position: fixed;
    bottom: 8px;
    left: 60px;
  }

  #ui-toolbar {
    position: static;
    flex-direction: column;
    overflow: visible;
  }

  #btn-more,
  .dock-more-btn {
    display: none !important;
  }

  #more-panel {
    display: none !important;
  }
}