@font-face {
  font-family: "Resistance Generale";
  src: url("fonts/resistance-generale.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: block;
}

@font-face {
  font-family: "Silkscreen";
  src: url("fonts/silkscreen-regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #050505;
  --panel: #0b0b0b;
  --panel-strong: #111;
  --line: #2a2a2a;
  --line-strong: #f5f5f5;
  --text: #f5f5f5;
  --muted: #858585;
  --danger: #ff4d4d;
  --ready: #7cff9b;
  --send: #9bd0ff;
  --receive: #ffd27c;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.room-mode {
  height: 100vh;
  overflow: hidden;
}

button,
input {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 0;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
}

button:hover,
button:focus-visible,
input:focus-visible,
a:focus-visible {
  border-color: var(--line-strong);
  outline: none;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 0;
  background: #000;
  color: var(--text);
}

input::placeholder {
  color: var(--muted);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.home {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.home-form {
  display: grid;
  justify-items: center;
  gap: 1.15rem;
}

.home h1 {
  margin: 0;
  font-family: "Resistance Generale", ui-sans-serif, system-ui, sans-serif;
  font-size: clamp(3rem, 13vw, 7rem);
  font-weight: 400;
  letter-spacing: 0.01em;
  line-height: 0.9;
}

.home-tagline {
  margin: -0.2rem 0 0;
  color: var(--muted);
  font-family: "Silkscreen", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: clamp(0.58rem, 1.4vw, 0.8rem);
  line-height: 1.2;
  text-align: center;
}

.create-button,
.text-button,
.card-button,
.remove-file {
  position: relative;
}

.create-button {
  width: 3.25rem;
  height: 3.25rem;
}

.create-button::before,
.create-button::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  display: block;
  background: currentColor;
  transform: translate(-50%, -50%);
}

.create-button::before {
  width: 1rem;
  height: 1px;
}

.create-button::after {
  width: 1px;
  height: 1rem;
}

.error {
  position: fixed;
  left: 1rem;
  right: 1rem;
  bottom: 1rem;
  margin: 0;
  color: var(--danger);
  font-size: 0.8rem;
  text-align: center;
}

.room-shell {
  display: grid;
  grid-template-columns: clamp(8rem, 16vw, 12rem) minmax(0, 1fr);
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
}

.sidebar {
  display: flex;
  min-width: 0;
  height: 100vh;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid var(--line);
  background: var(--panel);
}

.sidebar-actions {
  display: grid;
  flex: 0 0 4.25rem;
  border-bottom: 1px solid var(--line);
}

.sidebar-actions button {
  border-width: 0;
}

.text-button,
.card-button,
.remove-file {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  padding: 0 0.65rem;
  font-family: "Silkscreen", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.62rem;
  font-weight: 400;
  line-height: 1.05;
  text-align: center;
  text-transform: lowercase;
  white-space: normal;
}

.logs {
  flex: 1 1 auto;
  min-height: 0;
  margin: 0;
  padding: 0.65rem 0.65rem 0.65rem 1.35rem;
  overflow: auto;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.66rem;
  line-height: 1.25;
}

.logs li {
  margin: 0 0 0.35rem;
  overflow-wrap: anywhere;
}

.main-pane {
  position: relative;
  min-width: 0;
  height: 100vh;
  overflow: hidden;
  background: #000;
}

.file-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.panel {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: var(--panel);
}

.panel:last-child {
  border-right: 0;
}

.panel-head {
  display: grid;
  gap: 0.75rem;
  flex: 0 0 auto;
  min-height: 5rem;
  padding: 0.75rem;
  border-bottom: 1px solid var(--line);
  background: var(--panel-strong);
}

.identity-head {
  grid-template-columns: minmax(0, 1fr) minmax(8rem, 14rem);
  align-items: center;
}

.panel-title-block {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
  align-content: center;
}

.panel-head h2,
.panel-subtitle {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.panel-head h2 {
  margin: 0;
  color: var(--text);
  font-family: "Silkscreen", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: clamp(0.72rem, 1.25vw, 0.95rem);
  font-weight: 400;
  letter-spacing: 0.02em;
}

.panel-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.2;
}

.alias-label {
  display: block;
  min-width: 0;
}

.alias-input {
  height: 2.4rem;
  padding: 0 0.75rem;
  font-size: 0.78rem;
}

.file-list {
  display: grid;
  align-content: start;
  gap: 0.5rem;
  min-height: 0;
  margin: 0;
  padding: 0.5rem;
  overflow: auto;
  list-style: none;
}

.file-card,
.empty-list {
  border: 1px solid var(--line);
  background: #000;
}

.empty-list {
  padding: 0.75rem;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.3;
}

.file-card {
  display: grid;
  gap: 0.65rem;
  padding: 0.7rem;
}

.file-card.is-local {
  border-left: 3px solid var(--send);
}

.file-card.is-remote {
  border-left: 3px solid var(--receive);
}

.file-card.is-ready {
  border-color: var(--ready);
}

.file-card.is-failed {
  border-color: var(--danger);
}

.file-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 0.75rem;
}

.file-main {
  display: grid;
  min-width: 0;
  gap: 0.35rem;
}

.file-name {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 0.86rem;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-meta,
.file-status {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.66rem;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-status.is-error {
  color: var(--danger);
  white-space: normal;
}

.file-status.is-ready {
  color: var(--ready);
}

.file-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: flex-end;
}

.card-button,
.download-link {
  min-height: 2rem;
  border: 1px solid var(--line);
  background: var(--panel);
}

.card-button {
  min-width: 4.5rem;
}

.remove-file {
  width: 2rem;
  padding: 0;
}

.download-link {
  display: inline-grid;
  place-items: center;
  padding: 0 0.75rem;
  color: var(--text);
  font-family: "Silkscreen", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.58rem;
  line-height: 1;
  text-decoration: none;
  text-transform: lowercase;
}

.progress {
  height: 0.45rem;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--panel);
}

.progress-bar {
  width: 0;
  height: 100%;
  background: var(--line-strong);
  transition: width 120ms linear;
}

.file-card.is-local .progress-bar {
  background: var(--send);
}

.file-card.is-remote .progress-bar {
  background: var(--receive);
}

.drop-overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  background:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px),
    rgba(0, 0, 0, 0.88);
  background-size: 3.25rem 3.25rem;
  color: var(--text);
  font-family: "Silkscreen", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: clamp(0.8rem, 2vw, 1.15rem);
  line-height: 1.2;
  text-align: center;
  pointer-events: none;
}

@media (max-width: 900px) {
  .room-shell {
    grid-template-columns: 7.5rem minmax(0, 1fr);
  }

  .logs {
    font-size: 0.55rem;
    padding-left: 0.9rem;
  }

  .identity-head {
    grid-template-columns: 1fr;
  }

  .file-columns {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
  }

  .panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .panel:last-child {
    border-bottom: 0;
  }
}

@media (max-width: 620px) {
  body.room-mode {
    height: auto;
    min-height: 100vh;
    overflow: auto;
  }

  .room-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(34rem, 1fr);
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .sidebar {
    height: auto;
    max-height: none;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .sidebar-actions {
    flex-basis: 3.25rem;
  }

  .logs {
    flex-basis: 7rem;
  }

  .main-pane {
    height: 75vh;
    min-height: 34rem;
  }
}
