/* Superdrop
   Same family as the Sensor Phone site: black ground, white type, Archivo,
   1px hairlines, almost no rounding. One accent: Amber 600.

   #ffb300 statt des frueheren #ff9800: Sensor Phone behaelt sein Orange,
   Superdrop bekommt einen eigenen, etwas goldeneren Ton. Bei 0.56 Deckkraft
   auf Schwarz kippt Amber ins Olivbraune, deshalb steht der Long Shadow im
   App-Symbol auf 0.70. */

:root {
  --ink: #111111;
  --ink-2: #1a1a1a;
  --paper: #ffffff;
  --muted: #9e9e9e;
  --line: #2a2a2a;
  --accent: #ffb300;
  --bad: #f44336;

  --font: 'Archivo', system-ui, sans-serif;
}

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

html, body { height: 100%; }

body {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

main { flex: 1; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 28px; }

.hidden { display: none !important; }

a { color: inherit; }

a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, label:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ── Top bar: brand left, status + language right ── */

.top { border-bottom: 1px solid var(--line); }
.top .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  padding-bottom: 10px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 900;
  letter-spacing: -0.02em;
  text-decoration: none;
}
/* Die Marke faerbt sich ueber currentColor aus dieser Regel. */
.brand svg {
  display: block;
  width: 1.15em;
  height: 1.15em;
  flex: none;
  color: var(--accent);
}
.top-right { display: flex; align-items: center; gap: 10px; }

/* Same language bar as the Sensor Phone pages */
.langbar { display: flex; gap: 2px; }
.langbar button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: .86rem;
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 2px;
}
.langbar button:hover { color: var(--paper); }
.langbar button.on { color: var(--paper); background: var(--ink-2); }

/* Konto oben rechts: Umriss wie jeder Button, angemeldet in Weiss,
   mit Pro zusaetzlich das Abzeichen. */
.account-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px;
  font-size: .86rem;
  color: var(--muted);
  border-color: var(--line);
}
.account-btn:hover { color: var(--paper); border-color: var(--paper); }
.account-btn.signed-in { color: var(--paper); }
.account-btn svg {
  display: block;
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

/* Stufen-Abzeichen. Gratis nur umrandet, damit Pro hervorsticht; beide gleich
   gross, deshalb hat auch Pro einen Rand. */
.pro-badge, .free-badge {
  display: inline-block;
  padding: 1px 6px;
  border: 1px solid var(--accent);
  border-radius: 2px;
  font-size: .68rem;
  font-weight: 900;
  line-height: 1.5;
  letter-spacing: .08em;
  color: var(--ink);
  background: var(--accent);
}
.free-badge { color: var(--muted); background: none; border-color: var(--muted); }
.pro-badge[hidden], .free-badge[hidden] { display: none; }
button.pro-badge, button.free-badge { cursor: pointer; }
button.free-badge:hover { color: var(--paper); border-color: var(--paper); }

/* ── Start ──────────────────────────────────────── */

.start {
  max-width: 560px;
  padding: 96px 0 72px;
}

h1 {
  font-size: clamp(2.4rem, 5.2vw, 4rem);
  font-weight: 900;
  line-height: 1.02;
  letter-spacing: -0.03em;
}

.lede {
  margin-top: 20px;
  font-size: 1.15rem;
  color: var(--muted);
  max-width: 44ch;
}

.or {
  margin: 44px 0 12px;
  padding-top: 32px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .94rem;
}

.join { display: flex; gap: 8px; max-width: 420px; }

.note {
  min-height: 1.6em;
  margin-top: 16px;
  font-size: .94rem;
  color: var(--muted);
}
.note.error { color: var(--bad); }
/* Kein Fehler, sondern ein Hinweis auf Pro: als Kasten, mit Knopf. */
.note.pro {
  padding: 14px 16px;
  border: 1px solid var(--accent);
  border-radius: 2px;
  color: var(--paper);
  line-height: 1.5;
}
.note.pro #btn-note-pro { margin-top: 12px; }
.session-note { margin: 0 0 28px; }
.session-note[hidden] { display: none; }
.session-note.error { padding: 14px 16px; border: 1px solid var(--bad); border-radius: 2px; }
.session-note-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
#wait-status { color: var(--accent); font-weight: 700; }
#wait-status:empty { display: none; }

.stores {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  font-size: .94rem;
  color: var(--muted);
}

/* ── Controls ───────────────────────────────────── */

button, input, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button {
  border: 1px solid transparent;
  border-radius: 2px;
  padding: 12px 24px;
  background: none;
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}
button:disabled { opacity: .45; cursor: default; }

button.primary {
  margin-top: 32px;
  padding: 15px 30px;
  background: var(--paper);
  color: var(--ink);
  font-weight: 700;
}
button.primary:hover:not(:disabled) { background: var(--accent); color: var(--ink); }

button.secondary {
  border-color: var(--line);
  color: var(--paper);
}
button.secondary:hover:not(:disabled) { border-color: var(--paper); }

/* Every button carries a border so it reads as a button, not as text. */
button.small {
  padding: 6px 14px;
  font-size: .86rem;
  border-color: var(--line);
  color: var(--muted);
}
button.small:hover:not(:disabled) { color: var(--paper); border-color: var(--paper); }

button.danger { color: var(--muted); }
button.danger:hover:not(:disabled) { color: var(--bad); border-color: var(--bad); }

/* Link, der aussieht wie ein zweitrangiger Knopf, etwa "Abo verwalten" */
a.link-button {
  display: inline-block;
  padding: 10px 18px;
  border: 1px solid var(--line);
  border-radius: 2px;
  color: var(--paper);
  font-size: .9rem;
  text-decoration: none;
  transition: border-color 120ms ease;
}
a.link-button:hover { border-color: var(--paper); }
a.link-button[hidden] { display: none; }

input.code-input {
  flex: 1;
  min-width: 0;
  padding: 10px 14px;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: .22em;
  text-transform: uppercase;
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: 2px;
}
input.code-input::placeholder { color: #555; }

/* Ein Eingabefeld ist von Haus aus etwa 20 Zeichen breit. In einer
   Flex-Zeile drueckt das auf schmalen Bildschirmen die ganze Seite breiter
   als den Bildschirm. Mit width 0 waechst das Feld nur noch ueber flex. */
input.code-input { width: 0; }
input.code-input:focus { border-color: var(--accent); outline: none; }

textarea {
  display: block;
  width: 100%;
  resize: vertical;
  padding: 12px 14px;
  margin-bottom: 12px;
  line-height: 1.5;
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: 2px;
}
textarea::placeholder { color: #666; }
textarea:focus { border-color: var(--accent); outline: none; }

/* ── The code ───────────────────────────────────── */

.wait {
  max-width: 560px;
  padding: 96px 0 72px;
}

.code-display {
  margin: 28px 0 32px;
  font-size: clamp(3.2rem, 9vw, 5.5rem);
  font-weight: 900;
  line-height: 1;
  letter-spacing: .2em;
  color: var(--accent);
  user-select: all;
}

.qr {
  display: inline-block;
  padding: 12px;
  margin-bottom: 20px;
  background: var(--paper);
  border-radius: 2px;
}
.qr:empty { display: none; }
.qr img, .qr canvas { display: block; }

.wait .note { margin-bottom: 24px; }

/* ── Session ────────────────────────────────────── */

#screen-session { padding: 40px 0 72px; }

.session-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px 24px;
  padding: 0 0 20px;
  margin-bottom: 40px;
  border-bottom: 1px solid var(--line);
}

.conn { display: flex; align-items: center; gap: 10px; font-weight: 700; }

.dot { width: 11px; height: 11px; border-radius: 50%; flex: none; background: var(--accent); }

.path {
  padding: 2px 10px;
  font-size: .86rem;
  font-weight: 400;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 2px;
}
.path.relay { color: var(--accent); border-color: var(--accent); }

/* Gepaart, aber die Gegenstelle ist gerade nicht da. Senden bleibt
   gesperrt, statt Dateien fuer spaeter anzusammeln. */
body.offline .dot { background: var(--muted); }
body.offline .path { display: none; }
body.offline .col:first-child {
  opacity: .4;
  pointer-events: none;
}

.folder {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
  font-size: .94rem;
  color: var(--muted);
}
.folder button { padding: 8px 16px; }

.columns {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 48px;
}
.col { min-width: 0; }

h2 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 14px;
}

.dropzone {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 150px;
  padding: 24px;
  margin-bottom: 12px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 2px;
  cursor: pointer;
  transition: border-color 120ms ease, background-color 120ms ease, color 120ms ease;
}
.dropzone:hover { border-color: var(--muted); color: var(--paper); }
.dropzone.over {
  border-color: var(--accent);
  border-style: solid;
  background: var(--ink-2);
  color: var(--accent);
}
.dropzone u { text-decoration-thickness: 1px; text-underline-offset: 3px; }

#btn-send-text { margin-top: 0; }


/* ── History ────────────────────────────────────── */

.log { list-style: none; border-top: 1px solid var(--line); }
.log:empty { display: none; }

.empty {
  padding: 24px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .94rem;
}
.empty[hidden] { display: none; }

.item { padding: 16px 0; border-bottom: 1px solid var(--line); }

/* Hinweiszeile: etwas lief anders als gedacht, aber nichts ist kaputt. */
.item.notice {
  color: var(--accent);
  font-size: .9rem;
  line-height: 1.5;
}

.dir {
  display: inline-block;
  width: 22px;
  flex: 0 0 22px;
  font-weight: 900;
  color: var(--muted);
}
.dir.in { color: var(--accent); }

.item.text {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}
.item.text pre {
  font: inherit;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 220px;
  overflow: auto;
}
.item.text pre a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.file-head { display: flex; align-items: baseline; gap: 12px; }

/* Vorschaubare Datei: der Name selbst ist der Knopf */
.file-name.openable {
  cursor: zoom-in;
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-underline-offset: 3px;
}
.file-name.openable:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

/* Großansicht */
.viewer {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 20px;
  background: rgba(0, 0, 0, .92);
  cursor: zoom-out;
}
.viewer img, .viewer video {
  max-width: 100%;
  max-height: calc(100vh - 110px);
  object-fit: contain;
  cursor: default;
}
.viewer-bar {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  justify-content: center;
  cursor: default;
}
.viewer-bar span {
  color: var(--paper);
  font-size: .94rem;
  max-width: 50vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.viewer-bar a { color: var(--accent); font-size: .9rem; }
.file-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-meta { flex: none; font-size: .86rem; color: var(--muted); }

.bar {
  height: 3px;
  margin: 10px 0 8px 34px;
  background: var(--line);
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 120ms linear;
}
.item.done .bar-fill { background: var(--paper); }

/* Größe noch unbekannt: kein Balken, nur die gezählten Bytes. Das ist beim
   Packen im Strom der Normalfall — vorher weiß niemand, wie groß es wird. */
.item.unknown .bar { background: transparent; }
.item.unknown .bar-fill {
  width: 30%;
  background: var(--accent);
  animation: slide 1.4s ease-in-out infinite;
}
@keyframes slide {
  0%   { margin-left: 0; }
  50%  { margin-left: 70%; }
  100% { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .item.unknown .bar-fill { animation: none; width: 100%; opacity: .4; }
}
.item.error .bar-fill { background: var(--bad); }

.file-status { margin-left: 34px; font-size: .86rem; color: var(--muted); }
.item.error .file-status { color: var(--bad); }
.file-status a { color: var(--accent); }

/* ── Footer, same as the Sensor Phone page ──────── */

footer { padding: 56px 0 72px; }
.foot {
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
  justify-content: space-between;
  align-items: baseline;
}
.foot nav { display: flex; flex-wrap: wrap; gap: 24px; }
.foot a { color: var(--muted); text-decoration: none; font-size: .94rem; }
.foot a:hover { color: var(--paper); text-decoration: underline; }

/* ── Konto-Fenster ──────────────────────────────── */

/* Kein eigener Abstand am dialog: So trifft ein Klick auf das Element
   selbst nur den Hintergrund daneben, und der schliesst das Fenster. */
dialog.sheet {
  width: min(440px, calc(100% - 32px));
  max-height: calc(100% - 32px);
  margin: auto;
  padding: 0;
  color: var(--paper);
  background: var(--ink);
  border: 1px solid var(--line);
  border-radius: 2px;
}
dialog.sheet::backdrop { background: rgba(0, 0, 0, .72); }
.sheet-body { padding: 22px 24px 18px; }
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
.sheet-head h2 { margin: 0; font-size: 1.3rem; font-weight: 900; letter-spacing: -.02em; }
.sheet-text { color: var(--muted); font-size: .94rem; margin-bottom: 18px; }
button.primary.wide { width: 100%; margin-top: 0; }
.sheet-hint { margin-top: 10px; color: var(--muted); font-size: .86rem; }
#account-plan-text:empty { display: none; }

/* Einmaliger Hinweis unter dem Kontoknopf */
/* Volle Breite wie der Kopf, damit die Spitze unter dem Kontoknopf sitzt */
.pro-tip-row { display: flex; justify-content: flex-end; width: 100%; margin-top: 12px; }
.pro-tip-row[hidden] { display: none; }
.pro-tip {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  max-width: 100%;
  padding: 8px 6px 8px 12px;
  background: var(--ink-2);
  border: 1px solid var(--accent);
  border-radius: 2px;
  font-size: .88rem;
}
.pro-tip::before {
  /* Spitze zum Kontoknopf */
  content: '';
  position: absolute;
  top: -7px;
  right: 36px;
  border: 7px solid transparent;
  border-top: 0;
  border-bottom-color: var(--accent);
}
.pro-tip button { padding: 4px 6px; border: none; }
.pro-tip-open { color: var(--accent); font-weight: 700; }
.pro-tip-open:hover { text-decoration: underline; }
.pro-tip-close { color: var(--muted); font-size: 1.15rem; line-height: 1; }
.pro-tip-close:hover { color: var(--paper); }
.account-who { margin-bottom: 12px; color: var(--muted); font-size: .9rem; }
/* Eigene Zeile fuer die Adresse; umbrechen nur, wenn sie allein nicht passt */
.account-who strong {
  display: block;
  color: var(--paper);
  font-size: 1rem;
  overflow-wrap: anywhere;
}
.plan-yours { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; color: var(--muted); font-size: .9rem; }

/* Gratis und Pro im Vergleich */
.plan-table { width: 100%; border-collapse: collapse; margin: 2px 0 16px; font-size: .9rem; }
.plan-table th, .plan-table td { padding: 8px 6px; text-align: left; border-bottom: 1px solid var(--line); }
.plan-table thead th { padding-top: 0; }
.plan-table tr > :first-child { padding-left: 0; }
.plan-table tbody th { font-weight: 400; color: var(--muted); }
.plan-table td { color: var(--muted); white-space: nowrap; }
/* Nur "Mobilfunk + WLAN" darf umbrechen, in schmalen Fenstern nach
   "Mobilfunk"; das geschuetzte Leerzeichen haelt "+ WLAN" zusammen. */
.plan-table td.breakable { white-space: normal; }
/* Zweite Zeile unter dem Wert: wie die Verbindung zustande kommt */
.plan-table td small { display: block; font-size: .78rem; font-weight: 400; color: var(--muted); }
.plan-table td:last-child { color: var(--paper); }
.plan-table td.yes { color: var(--accent); font-weight: 900; }
.plan-table tbody tr:last-child > * { border-bottom: 0; }
/* Die eigene Stufe hervorheben */
.plan-table.is-free td:nth-child(2) { color: var(--paper); font-weight: 700; }
.plan-table.is-pro td:last-child { color: var(--accent); font-weight: 700; }

/* Laufendes Play-Abo unter dem Plan-Text */
.account-sub { margin: -8px 0 20px; }
.account-sub[hidden] { display: none; }
.account-sub p { margin-bottom: 12px; color: var(--muted); font-size: .9rem; }

.uid { margin-bottom: 18px; font-size: .8rem; color: var(--muted); }
.uid code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--paper);
  overflow-wrap: anywhere;
  user-select: all;
}
.sheet-actions { display: flex; flex-wrap: wrap; gap: 8px; }
#account-note:empty { display: none; }

/* ── Small screens / motion ─────────────────────── */

@media (max-width: 720px) {
  .top-right { gap: 6px; }
  .langbar button { padding: 6px 8px; }
  /* Nur das Symbol, der Name bleibt fuer Screenreader erhalten */
  .account-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  .account-btn { padding: 6px 8px; }
  /* Kein Platz fuer das Abzeichen: Pro zeigt sich am Symbol. Im Fenster
     und in der Sitzungsleiste steht PRO weiterhin ausgeschrieben. */
  .account-btn .pro-badge { display: none; }
  .pro-tip::before { right: 10px; }
  .account-btn.is-pro { color: var(--accent); border-color: var(--accent); }
  .sheet-body { padding: 18px 18px 14px; }
  .start, .wait { padding: 56px 0 48px; }
  #screen-session { padding: 28px 0 48px; }
  .columns { grid-template-columns: 1fr; gap: 40px; }
  .folder { margin-left: 0; }
}

@media (max-width: 380px) {
  .wrap { padding: 0 20px; }
  .top-right { gap: 4px; }
  .langbar button { padding: 6px 6px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
