:root {
  --bg: #090C13;
  --panel: #10141F;
  --panel-2: #141926;
  --ink: #EAF1F7;
  --ink-soft: #8B96AC;
  --line: #232A3B;
  --line-soft: rgba(255, 255, 255, .06);

  --accent: #2BE9DD;
  --accent-dim: #17B8C4;
  --accent-2: #8C6BFF;
  --accent-soft: rgba(43, 233, 221, .12);
  --accent-text-on: #04211F;

  --danger: #FF6B6B;
  --danger-soft: rgba(255, 107, 107, .12);

  --radius: 12px;
  --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 12px 32px rgba(0, 0, 0, .5);

  --mono: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

/* WICHTIG: Ohne diese Regel gewinnen spaeter definierte "display: flex"-
   Regeln (z. B. .modal, .field) gegen das hidden-Attribut, weil
   Autoren-Styles bei gleicher Spezifitaet immer vor den
   Browser-Standardstilen stehen. Damit [hidden] zuverlaessig
   funktioniert (Passwort-Modal, ein-/ausblendbare Felder, ...), muss
   diese Regel ganz oben stehen und !important verwenden. */
[hidden] {
  display: none !important;
}

html {
  scrollbar-color: var(--line) transparent;
  scrollbar-width: thin;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 8px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(43, 233, 221, .45);
}

::selection {
  background: rgba(43, 233, 221, .3);
  color: #fff;
}

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  background-color: var(--bg);
  background-image:
    radial-gradient(680px circle at 12% -8%, rgba(43, 233, 221, .16), transparent 60%),
    radial-gradient(620px circle at 105% 0%, rgba(140, 107, 255, .14), transparent 55%),
    radial-gradient(760px circle at 50% 115%, rgba(43, 233, 221, .08), transparent 60%);
  background-repeat: no-repeat;
  background-attachment: fixed;
}

h1,
h2 {
  line-height: 1.25;
}

a {
  color: var(--accent);
  text-decoration-color: rgba(43, 233, 221, .35);
}

a:hover {
  text-decoration-color: var(--accent);
}

.brand {
  display: flex;
  align-items: center;
  gap: .55rem;
  text-decoration: none;
  color: var(--ink);
}

.brand__mark {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  flex: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 14px rgba(43, 233, 221, .55);
}

.brand__name {
  font-weight: 700;
  letter-spacing: -.01em;
}

.brand--small .brand__name {
  font-size: .95rem;
}

/* ---------------- Home page ---------------- */
.home {
  max-width: 560px;
  margin: 0 auto;
  padding: 3rem 1.25rem 4rem;
}

.home__header {
  text-align: center;
  margin-bottom: 2rem;
}

.home__header .brand {
  justify-content: center;
}

.home__lead {
  color: var(--ink-soft);
  margin-top: .75rem;
}

.home__foot {
  text-align: center;
  color: var(--ink-soft);
  font-size: .8rem;
  margin-top: 2rem;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  transition: border-color .2s ease, box-shadow .2s ease;
}

.panel:focus-within {
  border-color: rgba(43, 233, 221, .4);
  box-shadow: var(--shadow), 0 0 0 1px rgba(43, 233, 221, .15), 0 0 28px rgba(43, 233, 221, .12);
}

.panel h2 {
  margin: 0 0 1rem;
  font-size: 1.05rem;
}

.divider {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin: 1.25rem 0;
  color: var(--ink-soft);
  font-size: .8rem;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: .9rem;
  margin: 0;
}

.field {
  display: flex;
  flex-direction: column;
  gap: .35rem;
}

.field label {
  font-size: .85rem;
  color: var(--ink-soft);
}

.checkbox {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .9rem;
  color: var(--ink-soft);
}

.checkbox input {
  accent-color: var(--accent);
}

input[type=text],
input[type=password],
textarea {
  font: inherit;
  padding: .65rem .75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0D111C;
  color: var(--ink);
  width: 100%;
  transition: border-color .2s ease, box-shadow .2s ease;
}

input[type=text]::placeholder,
input[type=password]::placeholder,
textarea::placeholder {
  color: #55617A;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(43, 233, 221, .15), 0 0 20px rgba(43, 233, 221, .25);
}

button:focus-visible,
.drop-zone:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(43, 233, 221, .28), 0 0 20px rgba(43, 233, 221, .3);
}

#join-code {
  font-family: var(--mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent);
  text-shadow: 0 0 10px rgba(43, 233, 221, .35);
}

.btn {
  font: inherit;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: .65rem 1.1rem;
  cursor: pointer;
  font-weight: 600;
  white-space: nowrap;
  transition: transform .15s ease, box-shadow .2s ease, background .2s ease, border-color .2s ease, color .2s ease;
}

.btn--primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-dim));
  color: var(--accent-text-on);
  box-shadow: 0 0 0 1px rgba(43, 233, 221, .3), 0 8px 24px rgba(43, 233, 221, .22);
}

.btn--primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 0 1px rgba(43, 233, 221, .45), 0 10px 32px rgba(43, 233, 221, .38);
}

.btn--secondary {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(43, 233, 221, .35);
}

.btn--secondary:hover {
  background: rgba(43, 233, 221, .2);
  box-shadow: 0 0 18px rgba(43, 233, 221, .2);
}

.btn--ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--ink-soft);
}

.btn--ghost:hover {
  background: rgba(255, 255, 255, .04);
  border-color: rgba(255, 255, 255, .18);
  color: var(--ink);
}

.btn--danger {
  color: #FF9089;
}

.btn--danger:hover {
  background: var(--danger-soft);
  border-color: rgba(255, 107, 107, .35);
  box-shadow: 0 0 18px rgba(255, 107, 107, .22);
}

.btn:disabled {
  opacity: .55;
  cursor: default;
  transform: none;
  box-shadow: none;
}

.error {
  color: var(--danger);
  font-size: .85rem;
  min-height: 1em;
  margin: 0;
}

.link-btn {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
}

.link-btn:hover {
  color: var(--accent-dim);
}

#recent-panel {
  margin-top: 2rem;
}

.recent-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: .55rem;
}

.recent-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  background: rgba(255, 255, 255, .02);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: .6rem .7rem;
  transition: border-color .2s ease;
}

.recent-item:hover {
  border-color: rgba(43, 233, 221, .3);
}

.recent-item__code {
  flex: none;
  font-family: var(--mono);
  font-size: .85rem;
  letter-spacing: .08em;
  background: var(--accent-soft);
  color: var(--accent);
  text-decoration: none;
  padding: .25rem .55rem;
  border-radius: 6px;
  text-shadow: 0 0 8px rgba(43, 233, 221, .35);
}

.recent-item__code:hover {
  background: rgba(43, 233, 221, .22);
}

.recent-item__body {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
  font-size: .85rem;
}

.recent-item__time {
  color: var(--ink-soft);
  font-size: .75rem;
  flex: none;
}

.recent-item__preview {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 220px;
  font-family: var(--mono);
  color: var(--ink);
}

.recent-item__empty,
.recent-item__locked {
  color: var(--ink-soft);
}

.recent-item__remove {
  flex: none;
  background: none;
  border: none;
  color: var(--ink-soft);
  cursor: pointer;
  font-size: .85rem;
  line-height: 1;
  padding: .25rem .35rem;
  border-radius: 4px;
}

.recent-item__remove:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

/* ---------------- Room page ---------------- */
.room {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 2rem;
}

.room__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .75rem;
  padding: .75rem 0 1rem;
}

.room__code-wrap {
  display: flex;
  align-items: center;
  gap: .6rem;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #3A4356;
  flex: none;
  transition: background .3s ease;
}

.status-dot.is-live {
  background: var(--accent);
  box-shadow: 0 0 8px 2px rgba(43, 233, 221, .7);
  animation: mcb-pulse 2s ease-in-out infinite;
}

@keyframes mcb-pulse {

  0%,
  100% {
    box-shadow: 0 0 6px 1px rgba(43, 233, 221, .55), 0 0 0 0 rgba(43, 233, 221, .45);
  }

  50% {
    box-shadow: 0 0 16px 4px rgba(43, 233, 221, .9), 0 0 0 7px rgba(43, 233, 221, 0);
  }
}

.room__code {
  font-family: var(--mono);
  font-size: 1.1rem;
  letter-spacing: .2em;
  background: rgba(43, 233, 221, .1);
  color: var(--accent);
  border: 1px solid rgba(43, 233, 221, .4);
  padding: .32rem .7rem;
  border-radius: 8px;
  text-shadow: 0 0 12px rgba(43, 233, 221, .5);
  box-shadow: 0 0 22px rgba(43, 233, 221, .15);
}

.room__actions {
  display: flex;
  gap: .5rem;
}

.room__hint {
  color: var(--ink-soft);
  font-size: .8rem;
  margin: 0 0 1rem;
}

.item-list {
  list-style: none;
  margin: 0 0 1.25rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: .6rem;
}

.item {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: .85rem 1rem;
  box-shadow: var(--shadow);
  transition: border-color .2s ease;
}

.item:hover {
  border-color: rgba(43, 233, 221, .3);
}

.item__meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: .4rem;
  gap: .5rem;
}

.item__time {
  font-size: .75rem;
  color: var(--ink-soft);
}

.item__delete {
  background: none;
  border: none;
  color: var(--ink-soft);
  cursor: pointer;
  font-size: .85rem;
  line-height: 1;
  padding: .2rem .4rem;
  border-radius: 4px;
  transition: background .15s ease, color .15s ease;
}

.item__delete:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.item__text {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--mono);
  font-size: .88rem;
  margin: 0 0 .55rem;
  max-height: 280px;
  overflow: auto;
  background: rgba(255, 255, 255, .025);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: .6rem .7rem;
  color: var(--ink);
}

.item__copy {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .02);
  border-radius: 6px;
  padding: .3rem .7rem;
  font-size: .8rem;
  cursor: pointer;
  color: var(--ink);
  transition: border-color .15s ease, color .15s ease, box-shadow .15s ease;
}

.item__copy:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 12px rgba(43, 233, 221, .2);
}

.item__file {
  display: flex;
  align-items: baseline;
  gap: .55rem;
  margin-bottom: .55rem;
  flex-wrap: wrap;
}

.item__filename {
  font-weight: 600;
  word-break: break-all;
}

.item__filesize {
  color: var(--ink-soft);
  font-size: .8rem;
}

.item__download {
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: .3rem .7rem;
  font-size: .8rem;
  text-decoration: none;
  color: var(--ink);
  transition: border-color .15s ease, color .15s ease, box-shadow .15s ease;
}

.item__download:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 12px rgba(43, 233, 221, .2);
}

.empty-state {
  text-align: center;
  color: var(--ink-soft);
  padding: 2.5rem 0;
}

.composer {
  position: sticky;
  top: .75rem;
  z-index: 5;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow), 0 0 34px rgba(43, 233, 221, .07);
}

.composer textarea {
  min-height: 70px;
  resize: vertical;
  font-family: var(--mono);
  font-size: .88rem;
}

.composer__row {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-top: .65rem;
  flex-wrap: wrap;
}

.drop-zone {
  flex: 1;
  min-width: 200px;
  border: 1px dashed var(--line);
  border-radius: 9px;
  padding: .6rem .8rem;
  font-size: .8rem;
  color: var(--ink-soft);
  cursor: pointer;
  text-align: center;
  transition: border-color .2s ease, color .2s ease, box-shadow .2s ease, background .2s ease;
}

.drop-zone:hover {
  border-color: rgba(43, 233, 221, .4);
  color: var(--ink);
}

.drop-zone.is-dragover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(43, 233, 221, .08);
  box-shadow: 0 0 26px rgba(43, 233, 221, .28);
}

#upload-progress {
  width: 100%;
  margin-top: .5rem;
  accent-color: var(--accent);
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(3, 5, 9, .78);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 10;
}

.modal__card {
  background: var(--panel-2);
  border: 1px solid rgba(43, 233, 221, .3);
  border-radius: var(--radius);
  padding: 1.5rem;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .65), 0 0 42px rgba(43, 233, 221, .14);
}

.modal__card h2 {
  margin-top: 0;
  font-size: 1.05rem;
}

.state-message {
  max-width: 480px;
  margin: 4rem auto;
  text-align: center;
  padding: 0 1.25rem;
}

.state-message h1 {
  font-size: 1.3rem;
}

@media (max-width: 520px) {
  .room__header {
    flex-direction: column;
    align-items: flex-start;
  }

  .room__actions {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .status-dot.is-live {
    animation: none;
  }

  .btn,
  .item,
  .drop-zone,
  .panel,
  input,
  textarea {
    transition: none;
  }
}