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

body {
  background: #0a0a0f;
  color: #e0e0e0;
  overflow: hidden;
  width: 100vw;
  height: 100vh;
  font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', 'Menlo', 'Consolas', monospace;
}

#ascii-container {
  width: 100vw;
  height: calc(100vh - 32px);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#ascii-canvas {
  display: block;
}

#info-bar {
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.03);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 11px;
  color: #666;
  letter-spacing: 0.5px;
  gap: 8px;
  white-space: nowrap;
}

#info-bar .key {
  display: inline-block;
  padding: 1px 5px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 3px;
  font-size: 10px;
  color: #999;
  margin: 0 2px;
}

/* Mobile start button */
#mobile-start {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  background: #0a0a0f;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

#mobile-start.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

#mobile-start button {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #e0e0e0;
  padding: 16px 40px;
  font-family: inherit;
  font-size: 14px;
  letter-spacing: 3px;
  text-transform: uppercase;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

#mobile-start button:active {
  background: rgba(255, 255, 255, 0.08);
}

/* Only show on touch devices */
@media (hover: hover) and (pointer: fine) {
  #mobile-start { display: none; }
}

/* Hide info bar in fullscreen */
:fullscreen #info-bar,
:-webkit-full-screen #info-bar {
  display: none;
}

:fullscreen #ascii-container,
:-webkit-full-screen #ascii-container {
  height: 100vh;
}

/* Preload fonts hint */
.font-preload {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

/* Settings panel */
#settings-panel {
  position: fixed;
  top: 0;
  right: 0;
  height: calc(100vh - 32px);
  width: 200px;
  background: rgba(10, 10, 15, 0.85);
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 20px 16px;
  z-index: 50;
  display: none;
  flex-direction: column;
  overflow-y: auto;
  gap: 18px;
  font-size: 11px;
  color: #999;
  letter-spacing: 0.5px;
}

#settings-panel.visible {
  display: flex;
}

#settings-panel .slider-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#settings-panel .slider-group label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-transform: uppercase;
  font-size: 10px;
  color: #777;
}

#settings-panel .slider-group label span {
  color: #aaa;
  font-variant-numeric: tabular-nums;
}

#settings-panel input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

#settings-panel input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  background: #999;
  border-radius: 50%;
  cursor: pointer;
}

#settings-panel input[type="range"]::-moz-range-thumb {
  width: 12px;
  height: 12px;
  background: #999;
  border: none;
  border-radius: 50%;
  cursor: pointer;
}

#settings-panel select {
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #ccc;
  font-family: inherit;
  font-size: 10px;
  padding: 6px 8px;
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}

#settings-panel select:focus {
  border-color: rgba(255, 255, 255, 0.2);
}

#settings-panel select option {
  background: #1a1a24;
  color: #ccc;
}

#settings-panel .panel-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#settings-panel .panel-label {
  text-transform: uppercase;
  font-size: 10px;
  color: #777;
}

#settings-panel .panel-value {
  display: flex;
  align-items: center;
  gap: 4px;
}

#settings-panel .panel-value span {
  flex: 1;
  color: #ccc;
  font-size: 10px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#settings-panel .panel-row-inline {
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
}

#settings-panel .panel-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #aaa;
  width: 22px;
  height: 22px;
  border-radius: 3px;
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

#settings-panel .panel-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ccc;
}

#settings-panel .panel-toggle {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #aaa;
  padding: 3px 10px;
  border-radius: 3px;
  font-family: inherit;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
}

#settings-panel .panel-toggle:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ccc;
}

#settings-panel .panel-toggle.active {
  background: rgba(255, 255, 255, 0.15);
  color: #ddd;
  border-color: rgba(255, 255, 255, 0.25);
}

#settings-panel .panel-actions {
  display: flex;
  gap: 6px;
  margin-top: auto;
}

#settings-panel .panel-actions button {
  flex: 1;
}

#settings-panel .panel-title {
  font-size: 11px;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

#settings-panel .reset-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #777;
  font-family: inherit;
  font-size: 10px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 6px 0;
  cursor: pointer;
  border-radius: 3px;
}

#settings-panel .reset-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #aaa;
}

:fullscreen #settings-panel,
:-webkit-full-screen #settings-panel {
  height: 100vh;
}

/* Mobile floating action button */
#mobile-fab {
  display: none;
  position: fixed;
  bottom: 48px;
  right: 16px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #999;
  font-size: 20px;
  cursor: pointer;
  z-index: 60;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: background 0.2s;
}

#mobile-fab:active {
  background: rgba(255, 255, 255, 0.2);
}

#mobile-fab svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

@media (hover: none) and (pointer: coarse) {
  #mobile-fab {
    display: flex;
  }
  #info-bar {
    display: none;
  }
  #ascii-container {
    height: 100vh;
  }
}

/* Mobile controls panel */
#mobile-controls {
  display: none;
  position: fixed;
  bottom: 100px;
  right: 16px;
  width: 240px;
  max-height: 70vh;
  overflow-y: auto;
  background: rgba(10, 10, 15, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 60;
  padding: 16px;
  flex-direction: column;
  gap: 14px;
  font-family: inherit;
  font-size: 11px;
  color: #999;
  letter-spacing: 0.5px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

#mobile-controls.visible {
  display: flex;
  opacity: 1;
  transform: translateY(0);
}

#mobile-controls .mc-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#mobile-controls .mc-label {
  text-transform: uppercase;
  font-size: 10px;
  color: #777;
}

#mobile-controls .mc-value {
  display: flex;
  align-items: center;
  gap: 6px;
}

#mobile-controls .mc-value span {
  color: #ccc;
  font-size: 11px;
  min-width: 60px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#mobile-controls .mc-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #aaa;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

#mobile-controls .mc-btn:active {
  background: rgba(255, 255, 255, 0.15);
}

#mobile-controls .mc-toggle {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #aaa;
  padding: 4px 12px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

#mobile-controls .mc-toggle:active {
  background: rgba(255, 255, 255, 0.15);
}

#mobile-controls .mc-toggle.active {
  background: rgba(255, 255, 255, 0.15);
  color: #ddd;
  border-color: rgba(255, 255, 255, 0.25);
}

#mobile-controls .mc-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
}

#mobile-controls .mc-slider-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#mobile-controls .mc-slider-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#mobile-controls .mc-slider-row label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-transform: uppercase;
  font-size: 10px;
  color: #777;
}

#mobile-controls .mc-slider-row label span {
  color: #aaa;
  font-variant-numeric: tabular-nums;
}

#mobile-controls input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

#mobile-controls input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  background: #999;
  border-radius: 50%;
  cursor: pointer;
}

#mobile-controls input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: #999;
  border: none;
  border-radius: 50%;
  cursor: pointer;
}

#mobile-controls .mc-actions {
  display: flex;
  gap: 8px;
}

#mobile-controls .mc-actions button {
  flex: 1;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #777;
  font-family: inherit;
  font-size: 10px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 8px 0;
  cursor: pointer;
  border-radius: 6px;
  -webkit-tap-highlight-color: transparent;
}

#mobile-controls .mc-actions button:active {
  background: rgba(255, 255, 255, 0.12);
  color: #aaa;
}

#mobile-controls select {
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #ccc;
  font-family: inherit;
  font-size: 11px;
  padding: 7px 8px;
  border-radius: 6px;
  outline: none;
  cursor: pointer;
}

#mobile-controls select option {
  background: #1a1a24;
  color: #ccc;
}

/* Hidden shader host */
#shader-host {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  pointer-events: none;
}
