  @import url('https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&family=Syne:wght@400;600;800&display=swap');

  :root {
    --bg: #0a0a0a;
    --surface: #141414;
    --border: #222;
    --accent: #00ff88;
    --accent2: #00ccff;
    --danger: #ff3355;
    --text: #f0f0f0;
    --muted: #555;
  }

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

  body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Syne', sans-serif;
    min-height: 100dvh;
    overflow-x: hidden;
  }

  header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    position: sticky;
    top: 0;
    z-index: 100;
  }

  .logo {
    font-family: 'Space Mono', monospace;
    font-size: 13px;
    color: var(--accent);
    letter-spacing: 2px;
    text-transform: uppercase;
  }

  .status-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--muted);
    animation: none;
    transition: background 0.3s;
  }
  .status-dot.active {
    background: var(--accent);
    animation: pulse 1.5s infinite;
  }

  @keyframes pulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(0,255,136,0.4); }
    50% { opacity: 0.8; box-shadow: 0 0 0 6px rgba(0,255,136,0); }
  }

  main { padding: 20px; max-width: 480px; margin: 0 auto; }

  .camera-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 20px;
    position: relative;
  }

  .camera-label {
    padding: 14px 18px 10px;
    font-size: 11px;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--muted);
    font-family: 'Space Mono', monospace;
  }

  #scanner-viewport {
    position: relative;
    width: 100%;
    aspect-ratio: 4/3;
    background: #000;
    overflow: hidden;
  }

  #scanner-viewport video {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
  }

  #scanner-viewport > div {
    width: 100% !important;
    height: 100% !important;
    border: none !important;
  }

  .scan-frame {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 10;
  }

  .scan-box {
    width: 65%;
    aspect-ratio: 1/1;
    position: relative;
  }

  .scan-box::before, .scan-box::after,
  .scan-box .corner-tl, .scan-box .corner-br {
    content: '';
    position: absolute;
    width: 20px; height: 20px;
    border-color: var(--accent);
    border-style: solid;
  }
  .scan-box::before { top: 0; left: 0; border-width: 2px 0 0 2px; }
  .scan-box::after { top: 0; right: 0; border-width: 2px 2px 0 0; }
  .scan-box .corner-tl { bottom: 0; left: 0; border-width: 0 0 2px 2px; }
  .scan-box .corner-br { bottom: 0; right: 0; border-width: 0 2px 2px 0; }

  .scan-line {
    position: absolute;
    left: 8%; right: 8%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    animation: scanline 2s ease-in-out infinite;
    opacity: 0;
  }
  .scan-line.running { opacity: 1; }

  @keyframes scanline {
    0% { top: 10%; }
    50% { top: 90%; }
    100% { top: 10%; }
  }

  .camera-placeholder {
    width: 100%;
    aspect-ratio: 4/3;
    background: #0a0a0a;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--muted);
  }

  .camera-placeholder svg { opacity: 0.3; }
  .camera-placeholder span { font-size: 12px; letter-spacing: 1px; }

  .btn-row {
    display: flex;
    gap: 10px;
    padding: 14px 18px;
    border-top: 1px solid var(--border);
  }

  .btn {
    flex: 1;
    padding: 12px;
    border-radius: 8px;
    border: none;
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    letter-spacing: 1px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.15s;
    outline: none;
    -webkit-tap-highlight-color: transparent;
  }

  .btn-primary {
    background: var(--accent);
    color: #000;
    font-weight: 700;
  }
  .btn-primary:active { transform: scale(0.96); background: #00cc6e; }
  .btn-primary:disabled { background: #1a3d2b; color: #2a6644; cursor: not-allowed; }

  .btn-secondary {
    background: transparent;
    color: var(--danger);
    border: 1px solid var(--danger);
  }
  .btn-secondary:active { background: rgba(255,51,85,0.1); }
  .btn-secondary:disabled { opacity: 0.3; cursor: not-allowed; }

  .btn-outline {
    background: transparent;
    color: var(--accent2);
    border: 1px solid var(--accent2);
  }
  .btn-outline:active { background: rgba(0,204,255,0.1); }

  /* ROOM CARD */
  .room-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 18px;
    margin-bottom: 20px;
  }

  .room-label {
    font-size: 10px;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--muted);
    font-family: 'Space Mono', monospace;
    margin-bottom: 10px;
  }

  #roomDisplay {
    font-family: 'Space Mono', monospace;
    font-size: 20px;
    color: var(--accent2);
    margin-bottom: 14px;
  }

  .result-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 18px;
    margin-bottom: 20px;
    display: none;
    animation: slideUp 0.3s ease;
  }

  .result-card.visible { display: block; }

  @keyframes slideUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
  }

  .result-label {
    font-size: 10px;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--muted);
    font-family: 'Space Mono', monospace;
    margin-bottom: 10px;
  }

  .result-code {
    font-family: 'Space Mono', monospace;
    font-size: 22px;
    color: var(--accent);
    word-break: break-all;
    margin-bottom: 6px;
  }

  .result-meta {
    font-size: 11px;
    color: var(--muted);
    font-family: 'Space Mono', monospace;
  }

  /* ATTRIBUTE (Bewertung) */
  .attr-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    display: none;
  }
  .attr-section.visible { display: block; }

  .attr-label {
    font-size: 10px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--muted);
    font-family: 'Space Mono', monospace;
    margin-bottom: 10px;
  }
  .attr-label .req { color: var(--danger); }

  .attr-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 4px;
  }

  .attr-btn {
    padding: 10px 8px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #0a0a0a;
    color: var(--text);
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s;
    -webkit-tap-highlight-color: transparent;
  }
  .attr-btn:active { transform: scale(0.96); }
  .attr-btn.selected {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
    font-weight: 700;
  }
  .attr-btn.austausch { grid-column: 1 / -1; }
  .attr-btn.austausch.selected { background: var(--danger); border-color: var(--danger); color: #fff; }

  /* PHOTOS */
  .photo-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
  }

  .photo-btn-row {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
  }

  .photo-btn {
    flex: 1;
    padding: 10px;
    border-radius: 8px;
    border: 1px dashed var(--border);
    background: transparent;
    color: var(--muted);
    font-family: 'Space Mono', monospace;
    font-size: 10px;
    letter-spacing: 1px;
    text-transform: uppercase;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .photo-btn:active { background: rgba(0,255,136,0.05); }
  .photo-btn:disabled { opacity: 0.3; cursor: not-allowed; }

  .photo-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
  }

  .photo-thumb {
    position: relative;
    aspect-ratio: 1/1;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--border);
  }
  .photo-thumb img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
  }
  .photo-thumb .remove {
    position: absolute;
    top: 2px; right: 2px;
    width: 18px; height: 18px;
    border-radius: 50%;
    background: rgba(10,10,10,0.85);
    color: var(--danger);
    border: none;
    font-size: 12px;
    line-height: 18px;
    text-align: center;
    cursor: pointer;
    padding: 0;
  }

  .photo-count {
    font-size: 10px;
    color: var(--muted);
    font-family: 'Space Mono', monospace;
    margin-top: 8px;
  }

  /* NOTIZ */
  .note-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
  }

  .note-textarea {
    width: 100%;
    min-height: 70px;
    resize: vertical;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    color: var(--text);
    font-family: 'Syne', sans-serif;
    font-size: 13px;
    line-height: 1.4;
    outline: none;
  }
  .note-textarea:focus { border-color: var(--accent2); }
  .note-textarea::placeholder { color: var(--muted); }

  .note-count {
    font-size: 10px;
    color: var(--muted);
    font-family: 'Space Mono', monospace;
    margin-top: 6px;
    text-align: right;
  }

  .send-row {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
  }

  .send-status {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    font-size: 11px;
    font-family: 'Space Mono', monospace;
  }

  .send-status .icon { font-size: 14px; }
  .send-status.success { color: var(--accent); }
  .send-status.error { color: var(--danger); }
  .send-status.sending { color: var(--accent2); }

  /* LOG */
  .log-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 20px;
  }

  .log-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
  }

  .log-title {
    font-size: 11px;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--muted);
    font-family: 'Space Mono', monospace;
  }

  .log-count {
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    background: #1a1a1a;
    color: var(--accent);
    padding: 2px 8px;
    border-radius: 4px;
  }

  .log-list {
    max-height: 220px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
  }

  .log-item-wrap {
    position: relative;
    overflow: hidden;
    border-bottom: 1px solid #1a1a1a;
    animation: fadeIn 0.2s ease;
  }
  .log-item-wrap:last-child { border-bottom: none; }

  .log-delete-bg {
    position: absolute;
    inset: 0;
    background: var(--danger);
    color: #fff;
    display: flex;
    align-items: center;
    gap: 6px;
    padding-left: 18px;
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
  }

  .log-item {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 10px;
    padding: 10px 18px;
    background: var(--surface);
    touch-action: pan-y;
    cursor: grab;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
  }

  .log-note {
    width: 100%;
    font-size: 11px;
    color: var(--muted);
    padding-left: 16px;
    white-space: pre-wrap;
    word-break: break-word;
  }

  @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

  .log-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
  }
  .log-dot.ok { background: var(--accent); }
  .log-dot.err { background: var(--danger); }
  .log-dot.pending { background: #f5a623; }

  .log-code {
    font-family: 'Space Mono', monospace;
    font-size: 12px;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .log-time {
    font-family: 'Space Mono', monospace;
    font-size: 10px;
    color: var(--muted);
    flex-shrink: 0;
  }

  .log-empty {
    padding: 30px 18px;
    text-align: center;
    font-size: 12px;
    color: var(--muted);
    font-family: 'Space Mono', monospace;
  }

  .log-hint {
    padding: 8px 18px;
    font-size: 10px;
    color: var(--muted);
    font-family: 'Space Mono', monospace;
    border-bottom: 1px solid var(--border);
  }

  .config-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 20px;
  }

  .config-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    font-size: 11px;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--muted);
    font-family: 'Space Mono', monospace;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    -webkit-tap-highlight-color: transparent;
  }

  .config-body { display: none; padding: 16px 18px; }
  .config-body.open { display: block; }

  .sync-status {
    font-size: 11px;
    color: var(--muted);
    font-family: 'Space Mono', monospace;
    line-height: 1.5;
  }

  label {
    display: block;
    font-size: 10px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--muted);
    font-family: 'Space Mono', monospace;
    margin-bottom: 6px;
  }

  input[type="text"], input[type="url"] {
    width: 100%;
    background: #0a0a0a;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-family: 'Space Mono', monospace;
    font-size: 12px;
    padding: 10px 12px;
    margin-bottom: 14px;
    outline: none;
    transition: border-color 0.2s;
  }
  input[type="text"]:focus, input[type="url"]:focus {
    border-color: var(--accent);
  }

  .toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(80px);
    background: var(--surface);
    border: 1px solid var(--accent);
    color: var(--accent);
    font-family: 'Space Mono', monospace;
    font-size: 12px;
    padding: 10px 20px;
    border-radius: 8px;
    transition: transform 0.3s ease;
    z-index: 999;
    white-space: nowrap;
  }
  .toast.show { transform: translateX(-50%) translateY(0); }
  .toast.err { border-color: var(--danger); color: var(--danger); }
