/* Tile / map classes */
.mr { 
  height: 1px; 
  display: block; 
  overflow-x: hidden; 
}
.m { 
  height: 1px; 
  width: 1px; 
  display: inline-block; 
  border: 0; 
  margin: 0; 
  padding: 0; 
  vertical-align: top; 
}

.m0 { 
  background-color: #000; 
}
.m1 { 
  background-color: #1a1a1a; 
}
.m2 { 
  background-color: #3a3a3a; 
}
.m3 { 
  background-color: #5a5a5a; 
}
.m4 { 
  background-color: #7a7a7a; 
}
.m5 { 
  background-color: #8a8a8a; 
}
.m6 { 
  background-color: #9a9a9a; 
}
.m7 { 
  background-color: #bababa; 
}
.m8 { 
  background-color: #dadada; 
}
.m9 { 
  background-color: #fff; 
}

.menu-item {
  display: inline-block;
  padding: 10px 10px;
  cursor: pointer;
  border: 1px dashed #008223;
  margin-right: 20px;
}
.menu-item:hover {
  background-color: #222;
  color: #fff;
  border-color: #fff;
}
.menu-section {
  display: inline-block;
  padding: 5px 20px;
  border: 1px solid #444;
  height: 60px;
  vertical-align: top;
}

/* Generic row/column actors */
.tr {
  height: 20px;
  margin: 0;
  padding: 0;
  transition: height 1s;
}
.tr:first-child {}
.tr:last-child {}

.tc {
  position: relative;
  width: 2%;
  height: 100%;
  display: inline-block;
  margin: 0;
  padding: 0;
  background: #83d135;
  background-image: url("coftbp.png");
  background-repeat: no-repeat;
  transition: width 1s;
}

/* Terrain color classes */
.gt-g { 
  background: #83d135; 
}
.gt-w { 
  background-position: -80px 0; 
}
.gt-f { 
  background-position: 0 0; 
}
.gt-m { 
  background-position: -20px 0; 
}
.gt-c { 
  background-position: -40px 0; 
}

.gt-0 { 
  background: #000; 
}
.gt-1 { 
  background: #010; 
}
.gt-2 { 
  background: #002400; 
}
.gt-3 { 
  background: #003900; 
}
.gt-4 { 
  background: #005900; 
}
.gt-5 { 
  background: #008400; 
}
.gt-6 { 
  background: #00A600; 
}
.gt-7 { 
  background: #00C800; 
}
.gt-8 { 
  background: #00E600; 
}
.gt-9 { 
  background: #0F0; 
}

/* Actor / coin components */
.actor {
  background: #9900C4;
  border-radius: 0;
  height: 80%;
  width: 80%;
  margin: 10%;
  text-align: center;
  font-weight: bold;
  position: absolute;
}

.coin {
  position: relative;
  height: 80%;
  width: 80%;
  padding: 10%;
  background: #d1c521;
  border-radius: 0;
  font-size: 10px;
  text-align: center;
}
.coin_outter {
  border-radius: 0;
  background: #e8e28f;
  box-shadow: inset 0 0 0 3px rgba(209, 56, 0, .3), 0 4px 20px rgba(232, 56, 0, .5);
}
.coin_inner {
  display: inline;
  position: absolute;
  left: 5%;
  top: 5%;
  width: 90%;
  height: 90%;
  border-radius: 0;
  background: #6b651a;
  vertical-align: middle;
}
.coin_text {
  vertical-align: middle;
  text-align: center;
  font-weight: bold;
  color: #ffcc31;
  text-shadow: 1px 1px #000;
  font-size: 1.1em;
}
.coin_glimmer {
  position: absolute;
  left: 0;
  top: 0;
  width: 90%;
  height: 90%;
  border-radius: 0;
  background: #e8e28f;
  transform: translateX(10%) translateY(10%);
  opacity: .35;
}
.loading {
  background-color: #C66751;
}
.loading:before{
  content: "LOADING";
  position: absolute;
  text-align: center;
  width: 100%;
  height: 100%;
  color: #00284F;
  font-weight: bolder;
  font-size: 2rem;
  margin-top: 45%;
}

/* Typography */
.game-title {
  font-size: 4rem;
  margin: 0;
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-transform: uppercase;
  letter-spacing: 4px;
  font-weight: 700;
  text-shadow: 0 4px 10px rgba(0,0,0,0.3);
  /* Use the dedicated heading font for a stiffer, bold title */
  font-family: var(--font-heading);
}

.game-subtitle {
  font-size: 1.2rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin: 0;
  text-align: center;
}

.version {
  position: absolute;
  bottom: 1rem;
  right: 1rem;
  color: var(--text-secondary);
  font-size: 0.8rem;
  opacity: 0.5;
}

/* Buttons */
button {
  cursor: pointer;
  border: none;
  font-family: var(--font-main);
  transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  border-radius: 0;
}

.btn-large {
  padding: 1rem 3rem;
  font-size: 1.25rem;
  font-weight: 600;
  color: white;
  background-color: var(--accent-color);
  border-radius: 0;
  box-shadow: 0 4px 14px rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.1);
}
.btn-large:hover {
  background-color: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.6);
}
.btn-large:active {
  transform: translateY(0);
}

.btn-text {
  display: block;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid transparent;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  margin-top: 1rem;
  text-decoration: underline;
  opacity: 0.7;
}
.btn-text.hidden {
  display: none;
}

/* Simple inline loading placeholder shown where the start button will appear.
   Subtle, matches UI sizing and is removed when the real button is revealed. */
.start-loading {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 180px;
  height: 48px;
  padding: 0 1rem;
  font-size: 1rem;
  color: var(--text-secondary);
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.03);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.01);
  border-radius: 0;
  margin-right: 0.5rem;
}

/* Hide via .hidden utility when replaced by real button */
.start-loading.hidden { display: none !important; }
.btn-text:hover {
  color: #ef4444; /* Danger color */
  opacity: 1;
}

.btn-icon {
  background: var(--glass-bg);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: 0;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-icon:hover {
  background: var(--border-color);
}

.btn-close {
  background: transparent;
  color: var(--text-secondary);
  font-size: 2rem;
  line-height: 1;
  padding: 0 0.5rem;
  border-radius: 0;
}
.btn-close:hover {
  color: white;
}

/* HUD Elements */
.stat-group {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.stat-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  letter-spacing: 1px;
  margin-bottom: 2px;
}
.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  font-feature-settings: "tnum";
}
.stat-divider {
  width: 1px;
  height: 30px;
  background: var(--border-color);
  margin: 0 1.5rem;
}



/* Modal Content */
.modal-content {
  background: #161b22;
  border: 1px solid var(--border-color);
  border-radius: 0;
  width: 90%;
  max-width: 400px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}
.modal-header {
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-header h2 {
  margin: 0;
  font-size: 1.2rem;
}
.modal-body {
  padding: 1.5rem;
}

/* Form Controls in Settings */
.control-row {
  margin-bottom: 1rem;
}
.control-row label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
}
.control-row select, 
.control-row input[type="range"] {
  width: 100%;
  background: #0d1117;
  border: 1px solid var(--border-color);
  color: white;
  padding: 0.5rem;
  border-radius: 4px;
}

/* Mobile adjustments */
@media (max-width: 600px) {
  .game-title { font-size: 2.5rem; }
  .hud-bar { padding: 1rem; }
  .stat-value { font-size: 1.2rem; }
  .stat-divider { margin: 0 1rem; }
  .controls-hint { display: none; } /* Hide generic controls on mobile, maybe replace later */
}

/* Splash credit on start screen */
.splash-credit {
  text-align: center;
  margin-top: 0.6rem;
  pointer-events: auto;
}
.splash-credit .credit-line {
  color: var(--text-secondary);
  font-size: 0.9rem;
  letter-spacing: 0.8px;
  margin-bottom: 6px;
}
.splash-credit a {
  display: inline-block;
}
.splash-credit img {
  display: block;
  margin: 0 auto;
  max-width: 90%;
  height: auto;
  width: 250px;
  height: 70px;
}

/* Inventory Display (on-screen) */
.inventory-overlay {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: center;
  pointer-events: none;
}

.inventory-item-pill {
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 4px 10px;
  border-radius: 20px;
  gap: 8px;
  animation: fadeIn 0.3s ease-out;
}

.inventory-pill-icon {
  width: 12px;
  height: 12px;
  border-radius: 2px;
}

.inventory-pill-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
}

.inventory-pill-qty {
  font-size: 1rem;
  font-weight: bold;
  color: white;
}

/* Collection UI */
.collection-modal-content {
  width: 95vw;
  max-width: 900px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

.collection-tabs {
  display: flex;
  gap: 0.5rem;
  padding: 0 1.5rem 1rem;
  border-bottom: 1px solid var(--border-color);
}

.collection-tab {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid transparent;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
}

.collection-tab:hover {
  color: white;
  border-color: var(--border-color);
}

.collection-tab.active {
  color: white;
  border-bottom-color: var(--accent-color);
}

.collection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1rem;
  overflow-y: auto;
  flex: 1;
}

.collection-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-secondary);
  padding: 3rem 0;
}

.collection-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 4px;
  cursor: default;
  transition: all 0.2s;
}

.collection-card.unlocked {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.15);
}

.collection-card.unlocked:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.25);
}

.collection-card.locked {
  opacity: 0.6;
}

.collection-icon {
  width: 80px;
  height: 80px;
  border-radius: 4px;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.collection-icon.locked-icon {
  background: #4b5563;
  color: #8b949e;
  font-weight: 700;
}

.collection-name {
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
  margin-bottom: 0.5rem;
}

.collection-description {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.3;
}

.collection-card.locked .collection-description {
  display: none;
}

/* Notifications */
.notification-container {
  position: fixed;
  top: 2rem;
  right: 2rem;
  pointer-events: auto;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.notification-toast {
  background: var(--glass-bg);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--accent-color);
  padding: 1rem 1.5rem;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  animation: slideIn 1s ease-out;
  min-width: 300px;
}

.notification-toast.discovery {
  border-left-color: #a78bfa;
}

.notification-toast.warning {
  border-left-color: #ef4444;
}

.notification-toast.info {
  border-left-color: #3b82f6;
}

.notification-toast.fade-out {
  animation: slideOut 1s ease-out;
  opacity: 0;
}

@keyframes slideIn {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(400px);
    opacity: 0;
  }
}

/* Customization UI (Dock) */
.custom-modal-content {
  width: 95vw;
  max-width: 800px;
  height: 80vh;
  display: flex;
  flex-direction: column;
}

.custom-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.custom-preview {
  flex: 1;
  background: #0d1117;
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: 1px solid var(--border-color);
}

.custom-controls {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: rgba(0,0,0,0.2);
}

.custom-options-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
}

.custom-section h3 {
  margin: 0 0 0.5rem 0;
  font-size: 0.9rem;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.custom-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.custom-item {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 4px;
  padding: 0.5rem;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
}

.custom-item:hover {
  background: rgba(255,255,255,0.08);
}

.custom-item.active {
  background: rgba(35, 134, 54, 0.2);
  border-color: var(--accent-color);
  box-shadow: 0 0 0 1px var(--accent-color);
}

.custom-swatch {
  width: 100%;
  height: 40px;
  background: #333;
  border-radius: 2px;
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: #aaa;
}

.custom-name {
  font-size: 0.75rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.custom-cost {
  font-size: 0.7rem;
  color: #f59e0b;
  margin-top: 2px;
}

.custom-item.locked {
  opacity: 0.7;
}

@media (max-width: 600px) {
  .custom-body {
    flex-direction: column;
  }
  .custom-preview {
    height: 200px;
    flex: none;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }
}

/* Dev Panel */
.dev-panel {
  position: absolute;
  top: 80px;
  right: 20px;
  background: var(--glass-bg);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-color);
  width: 240px;
  padding: 1rem;
  z-index: 100;
  pointer-events: auto;
}

.dev-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
}

.dev-panel-header h3 {
  margin: 0;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #f87171; /* red-400 */
}

.dev-panel-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.dev-control {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.dev-control label {
  font-size: 0.7rem;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.btn-row {
  display: flex;
  gap: 0.5rem;
}

.btn-small {
  background: #30363d;
  color: white;
  border: 1px solid #484f58;
  padding: 4px 8px;
  font-size: 0.75rem;
  flex: 1;
}

.btn-small:hover {
  background: #484f58;
}

.dev-control input[type="range"] {
  width: 100%;
}

/* Generic hidden utility */
.hidden {
  display: none !important;
}