:root {
  --gradient-bg: #1e1e1e;
  --gradient-btn: linear-gradient(135deg, #3a3f51, #2c2f3a);
  --gradient-btn-hover: linear-gradient(135deg, #4b5168, #343845);
  --error: #ff4e42;
  --reset-dark: #b22222;
  --accent: #00c8ff;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  margin: 0;
  padding: 2rem 1rem;
  background: var(--gradient-bg);
  color: #f5f5f5;
  overflow: auto;
  box-sizing: border-box;
}

canvas#background-stars {
  position: fixed;
  top: 0;
  left: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.container {
  text-align: center;
  background: transparent;
  backdrop-filter: none;
  border: none;
  border-radius: 0;
  box-shadow: none;
  width: 100%;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

h1, h2 {
  font-size: 2em;
  margin: 0 0 20px;
  color: #f5f5f5;
  text-shadow: 0 0 10px rgba(0, 200, 255, 0.6);
}

h2 {
  font-size: 1.6em;
}

input[type="text"],
input[type="password"],
input[type="tel"],
input[type="email"],
input[type="url"],
input[type="number"],
input[type="datetime-local"],
textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid #555;
  border-radius: 5px;
  outline: none;
  background: #444;
  color: #f5f5f5;
  transition: border-color 0.3s;
  box-sizing: border-box;
  font-family: inherit;
  font-size: 1rem;
}

input[type="datetime-local"] {
  color-scheme: dark;
}

textarea {
  resize: vertical;
}

input[type="text"]:focus-visible {
  border-color: #00c8ff;
}

.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-weight: bold;
  transition: background 0.3s, transform 0.3s;
  margin-left: 10px;
  background: var(--gradient-btn);
  color: white;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  font-family: inherit;
  font-size: 1em;
  line-height: 1.2;
}

.btn:hover {
  background: var(--gradient-btn-hover);
  transform: scale(1.05);
}
.btn:disabled {
  background: #888;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.qr-container {
  display: flex;
  justify-content: center;
  margin-top: 20px;
}
#qrCanvas {
  width: 100%;
  max-width: 450px;
  height: auto;
}

.btn-download:hover {
  transform: scale(1.07);
}
.btn-reset {
  background: linear-gradient(135deg, var(--error), var(--reset-dark));
}
.btn-reset:hover {
  background: linear-gradient(135deg, var(--reset-dark), #7a1616);
  transform: scale(1.07);
}

.buttons-row {
  margin-top: 20px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 10px;
}
.buttons-row .btn {
  margin-left: 0;
}

.error-message {
  margin-top: 15px;
  color: var(--error);
  font-weight: bold;
}
.hidden {
  display: none;
}

.scanner .notice {
  margin-top: 10px;
  font-size: 0.95em;
  opacity: 0.9;
}
.hidden-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.video-wrap {
  margin-top: 16px;
  width: 100%;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: #111;
  max-height: 70vh;
}
video {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
  aspect-ratio: 4 / 3;
}

.viewport {
  position: relative;
  width: 100%;
  max-width: 720px;
  overflow: hidden;
  border-radius: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  transition: height 420ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.track {
  display: flex;
  width: 200%;
  align-items: flex-start;
  transition: transform 420ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.track--show-panel1 {
  transform: translateX(0%);
}
.track--show-panel2 {
  transform: translateX(-50%);
}

.panel {
  width: 50%;
  position: relative;
  padding: 30px 48px;
  box-sizing: border-box;
  background: linear-gradient(
    145deg,
    rgba(20, 20, 20, 0.7) 0%,
    rgba(30, 30, 30, 0.6) 40%,
    rgba(40, 40, 40, 0.5) 70%,
    rgba(60, 60, 60, 0.4) 100%
  );
  backdrop-filter: blur(12px);
}

.switcher {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 32px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: #eaeaea;
  cursor: pointer;
  transition: background 0.2s ease;
  z-index: 10;
}

.switcher:hover {
  background: rgba(255, 255, 255, 0.15);
}
.switcher--right {
  right: 0;
  border-left: 1px solid rgba(255, 255, 255, 0.15);
}
.switcher--left {
  left: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.15);
}
.switcher span {
  display: block;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
  font-weight: 600;
  letter-spacing: 1px;
}

#toggleScanBtn.active-scan {
  background: linear-gradient(135deg, var(--error), var(--reset-dark));
}

#toggleScanBtn.active-scan:hover {
  background: linear-gradient(135deg, var(--reset-dark), #7a1616);
}

.custom-options {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin: 20px 0;
  flex-wrap: wrap;
}

.option-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.option-group label {
  font-weight: 600;
  color: #ccc;
}

.custom-options select {
  padding: 5px;
  border: 1px solid #555;
  border-radius: 5px;
  background: #444;
  color: #f5f5f5;
  outline: none;
}

.custom-options input[type="color"] {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 30px;
  height: 30px;
  background-color: transparent;
  border: 1px solid #555;
  border-radius: 50%;
  cursor: pointer;
}

.custom-options input[type="color"]::-webkit-color-swatch {
  border-radius: 50%;
  border: none;
}

.custom-options input[type="color"]::-moz-color-swatch {
  border-radius: 50%;
  border: none;
}

.data-type-tabs {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
  background-color: rgba(0, 0, 0, 0.2);
  border-radius: 10px;
  padding: 5px;
  width: 100%;
  flex-wrap: wrap;
}

.tab-btn {
  flex: 1 1 auto;
  padding: 8px 10px;
  background: transparent;
  border: none;
  color: #ccc;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s, color 0.3s;
  border-radius: 7px;
}

.tab-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.tab-btn.active {
  background: var(--gradient-btn);
  color: white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

#formContainer {
  width: 100%;
}

.form-content {
  width: 100%;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 15px;
  margin-bottom: 20px;
}

.form-grid.two-col {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

#calendarForm label {
  text-align: left;
  margin: auto 0;
  color: #ccc;
}

#wifiForm select {
  width: 100%;
  padding: 10px;
  border: 1px solid #555;
  border-radius: 5px;
  background: #444;
  color: #f5f5f5;
  outline: none;
}

#resultDisplay {
  width: 100%;
  margin-top: 16px;
}

#resultDisplay textarea {
  margin-bottom: 10px;
}

.drop-zone {
  margin-top: 15px;
  border: 2px dashed rgba(255, 255, 255, 0.25);
  border-radius: 10px;
  padding: 15px;
  font-size: 0.9rem;
  text-align: center;
  opacity: 0.7;
  transition: all .2s ease;
  user-select: none;
}

.drop-zone.is-dragover {
  opacity: 1;
  border-color: var(--accent);
  background: rgba(0, 200, 255, 0.08);
}

#qrSize {
  width: 120px;
}
#qrSizeValue {
  min-width: 60px;
  text-align: left;
  font-weight: 600;
  color: #ccc;
}

.toggle-switch {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}
.toggle-switch label {
  font-weight: 600;
  color: #ccc;
  cursor: pointer;
}
.toggle-switch input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  width: 44px;
  height: 24px;
  background: #333;
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.3s;
}
.toggle-switch input[type="checkbox"]::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  top: 3px;
  left: 3px;
  transition: transform 0.3s;
}
.toggle-switch input[type="checkbox"]:checked {
  background: var(--accent);
}
.toggle-switch input[type="checkbox"]:checked::before {
  transform: translateX(20px);
}