:root {
  color-scheme: dark;
}

/* iOS: verhindert automatische Schriftgrößen-Anpassung */
html {
  -webkit-text-size-adjust: 100%;
  width: 100%;
  overflow-x: hidden;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: #000;
  color: #f5f5f5;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  height: 100%;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: 100%;
  overflow-x: hidden; /* ganz wichtig: kein globales horizontales Scrollen */
}

/* Language + mode toggles */

#langToggle,
#modeToggle {
  position: fixed;
  top: 8px;
  z-index: 1000;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px;
  background: rgba(0, 0, 0, 0.75);
  border-radius: 999px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

#langToggle {
  left: 8px;
}

#modeToggle {
  right: 8px;
}

.lang-btn {
  border: none;
  padding: 4px 8px;
  border-radius: 999px;
  background: transparent;
  color: #ccc;
  font-size: 11px;
  cursor: pointer;
}

.lang-btn.active {
  background: #fff;
  color: #000;
}

/* Mode-Toggle (Stable/Beta) */

.mode-label {
  font-size: 11px;
  opacity: 0.8;
  margin-right: 4px;
}

.mode-btn {
  border: none;
  padding: 4px 8px;
  border-radius: 999px;
  background: transparent;
  color: #ccc;
  font-size: 11px;
  cursor: pointer;
  text-decoration: none;
}

.mode-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.mode-btn.active {
  color: #000;
  font-weight: 600;
}

.mode-btn.mode-stable.active {
  background: #2ecc71;
}

.mode-btn.mode-beta.active {
  background: #f1c40f;
}

/* Stage tags (großes Badge neben H1) */

.stage-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  margin-left: 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.stage-stable {
  background: rgba(46, 204, 113, 0.1);
  border-color: rgba(46, 204, 113, 0.8);
  color: #2ecc71;
}

.stage-beta {
  background: rgba(241, 196, 15, 0.1);
  border-color: rgba(241, 196, 15, 0.8);
  color: #f1c40f;
}

.stage-alpha {
  background: rgba(231, 76, 60, 0.1);
  border-color: rgba(231, 76, 60, 0.8);
  color: #e74c3c;
}

/* Layout */

#controls {
  max-width: 640px;
  margin: 60px auto 16px auto;
  padding: 16px;
  width: 100%;
  overflow-x: hidden; /* falls irgendwas im Content breiter sein will */
}

h1 {
  margin: 0 0 4px 0;
  font-size: 24px;
}

h2 {
  margin: 0 0 16px 0;
  font-size: 14px;
  font-weight: 400;
  color: #bbb;
}

h2 a {
  color: #bbb;
  text-decoration: none;
}

h2 a:hover {
  text-decoration: underline;
}

p {
  font-size: 13px;
  line-height: 1.5;
}

label {
  display: block;
  margin-top: 10px;
  font-size: 13px;
}

label span {
  display: block;
  margin-bottom: 4px;
}

input[type="text"],
input[type="range"],
input[type="file"],
select {
  width: 100%;
}

/* WICHTIG: Verhindert iOS-Autozoom auf Inputs */
input[type="text"],
select {
  font-size: 16px;
}

input[type="text"],
select {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid #555;
  background: #111;
  color: #fff;
}

input[type="text"]:focus,
select:focus {
  outline: none;
  border-color: #0af;
}

small {
  font-size: 11px;
  color: #aaa;
}

/* Speziell für das Haupt-Textfeld */

#textInput {
  margin-top: 6px;
  box-sizing: border-box;
}

/* Buttons */

button {
  border: none;
  border-radius: 999px;
  padding: 6px 12px;
  background: #0af;
  color: #000;
  font-size: 13px;
  cursor: pointer;
  margin: 2px 4px 2px 0;
}

/* Farbige Text-→Bild Buttons */

#textToPlainBtn {
  background: #0a84ff;   /* blau */
  color: #000;
}

#textToBinaryBtn {
  background: #2ecc71;   /* grün */
  color: #000;
}

#textToHexBtn {
  background: #e67e22;   /* orange */
  color: #000;
}

#textToBase64Btn {
  background: #ff6ad5;   /* pink */
  color: #000;
}

/* Start-Button breiter */

#startBtn {
  display: block;
  width: 100%;
  margin-top: 14px;
  background: #00c853;
  color: #000;
}

/* Install-Buttons */

#installButtons {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

#iosInstallBtn {
  background: #ffffff;
  color: #000;
}

#androidInstallBtn {
  background: #a4c639;
  color: #000;
}

button:hover {
  filter: brightness(1.1);
}

button:active {
  transform: translateY(1px);
}

/* Preview */

#previewWrapper {
  margin-top: 10px;
  padding: 8px;
  border-radius: 12px;
  background: #050505;
  border: 1px solid #333;
  max-width: 100%;
  overflow-x: auto;      /* hier: horizontal scrollen ERLAUBEN */
  overflow-y: hidden;    /* vertikal hidden */
  -webkit-overflow-scrolling: touch; /* smoother Scroll auf iOS */
}

#previewCanvas {
  display: block;        /* Breite kommt aus JS (imgCanvas.width) */
}
