/* Ultra-Minimalist Optical Sender Styling */
:root {
  --bg: #0e1311;
  --surface: #161e1a;
  --surface-border: #23302a;
  --text: #e6ede8;
  --text-muted: #809187;
  --green: #7dc444;
  --green-glow: rgba(125, 196, 68, 0.15);
  --lime: #c5ed71;
  --white: #ffffff;
  --mono: 'Consolas', 'Courier New', monospace;
  --sans: 'Microsoft JhengHei', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --qr-size: 480px;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 24px;
  overflow-x: hidden;
}

/* Minimal Topbar */
.min-topbar {
  width: min(100%, calc(var(--qr-size, 480px) + 20px));
  max-width: 640px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0 16px;
}

.min-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .02em;
}

.min-brand-mark {
  width: 14px;
  height: 14px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 2px;
}

.min-brand-mark i {
  background: var(--green);
  border-radius: 1px;
}

.min-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.min-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid transparent;
  transition: all .15s;
}

.min-link:hover {
  color: var(--text);
  border-color: var(--surface-border);
  background: var(--surface);
}

/* Main Minimal Stage */
.min-stage-container {
  width: min(100%, calc(var(--qr-size, 480px) + 20px));
  max-width: 640px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin: auto 0;
  transition: width .2s ease;
}

/* High-Contrast QR Frame */
.min-qr-frame {
  position: relative;
  width: min(100%, var(--qr-size, 480px));
  max-width: 600px;
  aspect-ratio: 1;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.08);
  display: grid;
  place-items: center;
  padding: 18px;
  overflow: hidden;
  cursor: pointer;
  transition: transform .2s, box-shadow .2s, width .2s ease;
}

.min-qr-frame:hover {
  box-shadow: 0 20px 56px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(125, 196, 68, 0.3);
}

.min-qr-frame canvas {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
  border-radius: 4px;
}

/* Drop Placeholder Inside QR Frame */
.min-drop-zone {
  position: absolute;
  inset: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: #55665e;
  border: 2px dashed #d5ded8;
  border-radius: 12px;
  background: #fbfdfc;
  text-align: center;
  transition: all .2s;
}

.min-drop-zone.dragover {
  border-color: var(--green);
  background: #f1f8ed;
  color: var(--green);
}

.min-drop-glyph {
  font-size: 32px;
  color: #728c7c;
}

.min-drop-title {
  font-size: 13px;
  font-weight: 700;
  color: #2c3832;
}

.min-drop-sub {
  font-size: 10px;
  color: #889990;
}

/* Hidden real file input */
.min-file-input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

/* Thin progress indicator below QR */
.min-progress-bar {
  width: min(100%, var(--qr-size, 480px));
  max-width: 600px;
  height: 3px;
  background: #1b2420;
  border-radius: 3px;
  overflow: hidden;
}

.min-progress-fill {
  width: 0%;
  height: 100%;
  background: var(--green);
  transition: width .1s linear;
}

/* Floating Status & Speed Pill */
.min-speed-pill {
  width: min(100%, var(--qr-size, 480px));
  max-width: 600px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 30px;
  font-size: 11px;
}

.min-speed-left {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
}

.min-speed-icon {
  color: var(--green);
}

.min-speed-val {
  color: var(--text);
  font-weight: 700;
}

.min-speed-sub {
  color: var(--text-muted);
  font-size: 9px;
}

.min-speed-right {
  font-family: var(--mono);
  color: var(--green);
  font-size: 10px;
  font-weight: 600;
}

/* Minimal Action Controls Bar */
.min-controls-bar {
  width: min(100%, var(--qr-size, 480px));
  max-width: 600px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.min-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  padding: 0 16px;
  border-radius: 8px;
  border: 1px solid var(--surface-border);
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}

.min-btn:hover:not(:disabled) {
  background: #202b25;
  border-color: #34473e;
}

.min-btn:active:not(:disabled) {
  transform: translateY(1px);
}

.min-btn:disabled {
  opacity: .35;
  cursor: not-allowed;
}

.min-btn-primary {
  background: var(--green);
  border-color: var(--green);
  color: #0b140f;
  font-weight: 700;
}

.min-btn-primary:hover:not(:disabled) {
  background: #8ede4e;
  border-color: #8ede4e;
}

.min-btn-icon {
  width: 38px;
  padding: 0;
}

/* File Name Tag with click to change */
.min-file-tag {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  height: 38px;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  font-size: 11px;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.min-file-tag:hover {
  border-color: var(--green);
}

.min-file-tag strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-weight: 500;
}

.min-file-tag span {
  color: var(--text-muted);
  font-size: 9px;
  font-family: var(--mono);
}

/* Settings Drawer / Toggle */
.min-settings-drawer {
  width: min(100%, var(--qr-size, 480px));
  max-width: 600px;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.min-size-btn-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.min-size-btn {
  padding: 3px 8px;
  border-radius: 4px;
  background: #1e2823;
  border: 1px solid var(--surface-border);
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 10px;
  cursor: pointer;
  transition: all .15s;
}

.min-size-btn:hover {
  color: var(--text);
  border-color: #3b5045;
}

.min-size-btn.active {
  background: var(--green);
  border-color: var(--green);
  color: #0b140f;
  font-weight: 700;
}

.min-setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
}

.min-setting-row span.label {
  color: var(--text);
  font-weight: 500;
}

.min-setting-val {
  font-family: var(--mono);
  color: var(--green);
  font-size: 10px;
}

.min-range {
  width: 120px;
  height: 3px;
  accent-color: var(--green);
  background: #25332c;
  cursor: pointer;
}

/* Minimal Switch */
.min-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.min-switch input { position: absolute; opacity: 0; width: 0; height: 0; }

.min-switch-track {
  width: 28px;
  height: 16px;
  background: #2a3831;
  border-radius: 16px;
  position: relative;
  transition: background .2s;
}

.min-switch-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  transition: transform .2s;
}

.min-switch input:checked + .min-switch-track {
  background: var(--green);
}

.min-switch input:checked + .min-switch-track::after {
  transform: translateX(12px);
}

/* Bottom minimal footer */
.min-footer {
  width: min(100%, calc(var(--qr-size, 480px) + 20px));
  max-width: 640px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 9px;
  font-family: var(--mono);
  color: #4f6358;
  padding-top: 12px;
}

.hidden { display: none !important; }
