:root {
  color-scheme: light;
  --bg: #f5f7f6;
  --surface: #ffffff;
  --surface-soft: #f8faf9;
  --ink: #11181c;
  --muted: #647077;
  --quiet: #879199;
  --line: #dce3e0;
  --line-strong: #c6d0cc;
  --accent: #0d7f78;
  --accent-dark: #075d58;
  --accent-soft: #e4f3f1;
  --warm: #c9643d;
  --warm-soft: #faede5;
  --good: #207a55;
  --warn: #b65035;
  --shadow-sm: 0 1px 2px rgba(17, 24, 28, 0.05);
  --shadow-md: 0 18px 50px rgba(17, 24, 28, 0.1);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(135deg, rgba(13, 127, 120, 0.08), transparent 28%),
    linear-gradient(315deg, rgba(201, 100, 61, 0.08), transparent 30%),
    var(--bg);
  color: var(--ink);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(17, 24, 28, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(17, 24, 28, 0.035) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, black, transparent 72%);
}

button,
input,
textarea {
  font: inherit;
}

button,
.download-button {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 16px;
  text-decoration: none;
  font-weight: 800;
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease, border-color 140ms ease;
}

button:active,
.download-button:active {
  transform: translateY(1px);
}

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

.download-button:disabled:hover {
  background: var(--accent);
}

.primary-button,
.download-button {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 10px 22px rgba(13, 127, 120, 0.18);
}

.primary-button:hover,
.download-button:hover {
  background: var(--accent-dark);
}

.secondary-button,
.ghost-button {
  background: #eef3f1;
  color: var(--ink);
  border: 1px solid transparent;
}

.secondary-button:hover,
.ghost-button:hover {
  background: #e2ebe7;
  border-color: var(--line-strong);
}

.button-icon {
  position: relative;
  display: inline-block;
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}

.enter-icon::before,
.send-icon::before,
.download-icon::before {
  content: "";
  position: absolute;
  inset: 3px 2px 2px 5px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
}

.send-icon::before {
  inset: 2px 3px 3px 4px;
}

.download-icon::before {
  inset: 1px 4px 5px 4px;
  transform: rotate(45deg);
}

.copy-icon::before,
.copy-icon::after {
  content: "";
  position: absolute;
  border: 2px solid currentColor;
  border-radius: 3px;
}

.copy-icon::before {
  inset: 2px 1px 1px 5px;
}

.copy-icon::after {
  inset: 0 5px 5px 1px;
  opacity: 0.55;
}

.page {
  position: relative;
  min-height: 100vh;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.join-view {
  min-height: calc(100vh - 64px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(330px, 410px);
  gap: 28px;
  align-items: center;
}

.join-hero {
  display: grid;
  align-content: center;
  justify-items: start;
}

.app-mark {
  width: 62px;
  height: 62px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  margin-bottom: 22px;
  background: var(--ink);
  color: #fff;
  font-size: 30px;
  font-weight: 900;
  box-shadow: 9px 9px 0 var(--warm-soft);
}

.app-mark.small {
  width: 44px;
  height: 44px;
  margin: 0;
  font-size: 22px;
  box-shadow: 6px 6px 0 var(--warm-soft);
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.13em;
}

.join-hero h1,
.room-header h1 {
  margin: 8px 0 10px;
  max-width: 720px;
  font-size: clamp(48px, 7vw, 88px);
  line-height: 0.92;
  letter-spacing: 0;
}

.lede {
  margin: 0 0 26px;
  color: var(--muted);
  font-size: 22px;
  line-height: 1.45;
}

.join-panel,
.composer,
.feed-shell {
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(220, 227, 224, 0.9);
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(18px);
}

.join-panel {
  display: grid;
  gap: 18px;
  padding: 24px;
}

.panel-head h2,
.feed-head h2 {
  margin: 4px 0 0;
  font-size: 27px;
  line-height: 1.15;
  letter-spacing: 0;
}

.field {
  display: grid;
  gap: 8px;
}

label {
  color: #2d393d;
  font-size: 13px;
  font-weight: 850;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface-soft);
  outline: none;
  box-shadow: inset 0 1px 0 rgba(17, 24, 28, 0.02);
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

input {
  min-height: 48px;
  padding: 0 14px;
}

textarea {
  resize: vertical;
  min-height: 190px;
  padding: 14px;
  line-height: 1.55;
}

input:focus,
textarea:focus,
.drop-zone:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(13, 127, 120, 0.13);
}

.form-error {
  min-height: 19px;
  margin: -4px 0 0;
  color: var(--warn);
  font-size: 13px;
}

.room-view {
  display: grid;
  gap: 20px;
  isolation: isolate;
}

.room-header {
  position: relative;
  z-index: 30;
  overflow: visible;
  min-height: 72px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 14px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(220, 227, 224, 0.9);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(18px);
}

.room-title-block {
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 16px;
}

.room-heading-text {
  min-width: 0;
}

.room-name-row {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.room-name-row h1 {
  min-width: 0;
}

.qr-hover-wrap {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  z-index: 40;
}

.qr-button {
  width: 38px;
  min-width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 0;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.qr-button:hover {
  border-color: var(--accent);
  background: #fff;
}

.qr-icon {
  width: 22px;
  height: 22px;
  display: block;
  color: var(--ink);
}

.qr-icon rect {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

.qr-icon rect:nth-of-type(n + 4) {
  fill: currentColor;
  stroke: none;
}

.qr-icon path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.qr-hover-card {
  position: absolute;
  left: 50%;
  top: calc(100% + 10px);
  z-index: 100;
  width: 236px;
  display: grid;
  gap: 10px;
  justify-items: center;
  padding: 14px;
  border: 1px solid rgba(220, 227, 224, 0.95);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 6px);
  transition: opacity 140ms ease, transform 140ms ease;
}

.qr-hover-card::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -7px;
  width: 12px;
  height: 12px;
  background: rgba(255, 255, 255, 0.96);
  border-left: 1px solid rgba(220, 227, 224, 0.95);
  border-top: 1px solid rgba(220, 227, 224, 0.95);
  transform: translateX(-50%) rotate(45deg);
}

.qr-hover-wrap:hover .qr-hover-card,
.qr-hover-wrap:focus-within .qr-hover-card {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0);
}

.qr-hover-card canvas {
  width: 180px;
  height: 180px;
  border: 8px solid #fff;
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  image-rendering: pixelated;
}

.room-header h1 {
  margin: 2px 0 0;
  font-size: clamp(28px, 4vw, 44px);
  overflow-wrap: anywhere;
}

.room-stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
}

.status-pill {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 0 12px;
  color: var(--muted);
  font-weight: 850;
  font-size: 13px;
}

.status-pill.is-online {
  border-color: rgba(32, 122, 85, 0.26);
  background: #eef8f3;
  color: var(--good);
}

.workspace {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(300px, 390px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.composer,
.feed-shell {
  box-shadow: var(--shadow-sm);
}

.composer {
  display: grid;
  gap: 18px;
  padding: 16px;
  position: sticky;
  top: 18px;
}

.composer-section {
  display: grid;
  gap: 10px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-head span {
  color: var(--quiet);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.composer-actions,
.item-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.drop-zone {
  position: relative;
  min-height: 150px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(228, 243, 241, 0.55), rgba(250, 237, 229, 0.45)),
    var(--surface-soft);
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 18px;
  cursor: pointer;
}

.drop-zone.is-dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.drop-zone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.drop-icon {
  position: relative;
  width: 46px;
  height: 46px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
}

.drop-icon::before,
.drop-icon::after {
  content: "";
  position: absolute;
}

.drop-icon::before {
  width: 14px;
  height: 18px;
  border: 2px solid var(--accent);
  border-radius: 3px;
}

.drop-icon::after {
  width: 10px;
  height: 10px;
  border-left: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  transform: translateY(-1px) rotate(-45deg);
}

.drop-zone strong {
  display: block;
  font-size: 18px;
}

.drop-zone p {
  margin: 3px 0 0;
  color: var(--muted);
}

.file-limit-note {
  font-size: 13px;
}

.file-limit-note span {
  color: var(--accent-dark);
  font-weight: 900;
}

.upload-queue {
  display: grid;
  gap: 8px;
}

.upload-row {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 10px;
}

.upload-row.is-error {
  border-color: rgba(182, 80, 53, 0.34);
  background: #fff5f1;
}

.upload-row span {
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.progress {
  height: 7px;
  border-radius: 8px;
  background: #e1e8e5;
  overflow: hidden;
}

.progress div {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--warm));
  transition: width 140ms ease;
}

.feed-shell {
  min-height: calc(100vh - 124px);
  padding: 18px;
}

.feed-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
}

.empty-state {
  min-height: 360px;
  display: grid;
  align-content: center;
  justify-items: center;
  text-align: center;
  color: var(--muted);
}

.empty-state::before {
  content: "";
  width: 72px;
  height: 72px;
  margin-bottom: 16px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background:
    linear-gradient(90deg, transparent 18px, rgba(13, 127, 120, 0.18) 18px 22px, transparent 22px),
    linear-gradient(rgba(201, 100, 61, 0.18) 18px, transparent 18px 22px, rgba(201, 100, 61, 0.18) 22px 26px, transparent 26px),
    var(--surface-soft);
}

.empty-state strong {
  color: var(--ink);
  font-size: 20px;
}

.empty-state p {
  margin: 8px 0 0;
}

.feed {
  display: grid;
  gap: 12px;
  padding-top: 16px;
}

.feed-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 14px;
  box-shadow: 0 1px 0 rgba(17, 24, 28, 0.03);
}

.item-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.item-meta-main {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.item-kind {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 900;
}

.item-source {
  max-width: min(280px, 100%);
  color: var(--muted);
  font-weight: 800;
  overflow-wrap: anywhere;
}

.text-item pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 13px 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  line-height: 1.58;
}

.file-main {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin: 12px 0;
}

.file-icon {
  width: 54px;
  height: 54px;
  border-radius: 8px;
  background: var(--warm-soft);
  color: #874727;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 900;
  border: 1px solid rgba(201, 100, 61, 0.18);
}

.file-item h3 {
  margin: 0;
  font-size: 17px;
  overflow-wrap: anywhere;
}

.file-item p {
  margin: 4px 0 0;
  color: var(--muted);
}

.file-item.is-unavailable {
  opacity: 0.72;
}

.image-preview {
  display: block;
  margin: 12px 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #fff;
}

.image-preview img {
  display: block;
  width: 100%;
  max-height: 440px;
  object-fit: contain;
  background: #fff;
}

.file-item.is-image .file-icon {
  background: var(--accent-soft);
  color: var(--accent-dark);
  border-color: rgba(13, 127, 120, 0.18);
}

.qr-link-text {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  text-align: center;
  overflow-wrap: anywhere;
}

@media (max-width: 840px) {
  .page {
    width: min(100% - 24px, 680px);
    padding: 18px 0;
  }

  .join-view,
  .workspace {
    grid-template-columns: 1fr;
  }

  .join-view {
    align-content: center;
  }

  .join-hero h1 {
    font-size: clamp(42px, 12vw, 64px);
  }

  .room-header {
    align-items: stretch;
    flex-direction: column;
  }

  .room-stats {
    justify-content: flex-start;
  }

  .composer {
    position: static;
  }

  .feed-shell {
    min-height: 520px;
  }
}

@media (max-width: 480px) {
  .page {
    width: min(100% - 18px, 680px);
  }

  .join-panel,
  .composer,
  .feed-shell,
  .room-header {
    padding: 14px;
  }

  .join-hero h1 {
    font-size: 42px;
  }

  .lede {
    margin-bottom: 20px;
    font-size: 18px;
  }

  .room-title-block {
    grid-template-columns: 1fr;
  }

  .room-header h1 {
    font-size: 31px;
  }

  button,
  .download-button {
    width: 100%;
  }

  .qr-button {
    width: 38px;
    min-width: 38px;
  }

  .qr-hover-card {
    left: auto;
    right: 0;
    transform: translate(0, 6px);
  }

  .qr-hover-wrap:hover .qr-hover-card,
  .qr-hover-wrap:focus-within .qr-hover-card {
    transform: translate(0, 0);
  }

  .drop-zone {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .feed-head {
    align-items: stretch;
    flex-direction: column;
  }
}
