:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #070a10;
  color: #f8fafc;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 0%, rgba(56, 189, 248, 0.13), transparent 32rem),
    radial-gradient(circle at 100% 20%, rgba(167, 139, 250, 0.11), transparent 30rem),
    #070a10;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: max(1.25rem, env(safe-area-inset-top)) max(1.25rem, env(safe-area-inset-right)) 1rem max(1.25rem, env(safe-area-inset-left));
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
}

.brand {
  color: inherit;
  font-size: 1.05rem;
  font-weight: 750;
  letter-spacing: -0.03em;
  text-decoration: none;
}

#connection-state {
  color: #94a3b8;
  font-size: 0.78rem;
}

main {
  width: min(48rem, 100%);
  margin: 0 auto;
  padding: 4rem 1.25rem calc(4rem + env(safe-area-inset-bottom));
}

.eyebrow,
.card-label {
  margin: 0 0 0.55rem;
  color: #38bdf8;
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.18em;
}

h1 {
  margin: 0;
  font-size: clamp(2.35rem, 9vw, 4.8rem);
  line-height: 0.96;
  letter-spacing: -0.065em;
}

#intro > p:last-child {
  max-width: 34rem;
  margin: 1.5rem 0 0;
  color: #94a3b8;
  line-height: 1.75;
}

#message {
  min-height: 1.5rem;
  margin: 2rem 0 0;
  color: #fbbf24;
}

#cards {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

.group-card {
  margin-top: 1rem;
  padding: 1.35rem;
  overflow-wrap: anywhere;
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 1.15rem;
  background: rgba(8, 47, 73, 0.28);
}

.error-card {
  border-color: rgba(248, 113, 113, 0.45);
  background: rgba(127, 29, 29, 0.2);
}

.error-card h2 {
  margin: 0.25rem 0 0.75rem;
}

.group-card h2 {
  margin: 0;
  font-size: 1.15rem;
}

body.managing-devices #intro,
body.managing-devices #device-summary,
body.managing-devices #join-device,
body.managing-devices #cards,
body.managing-devices #empty {
  display: none;
}

#invitation {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(148, 163, 184, 0.16);
}

#invitation-qr {
  width: min(22rem, 100%);
  margin: 1rem auto;
}

#invitation-qr svg {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 0.75rem;
}

#pending-devices section,
#group-devices {
  margin-top: 1rem;
}

.device-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 3.5rem;
  border-top: 1px solid rgba(148, 163, 184, 0.16);
}

.verification-code {
  margin: 1rem 0 0;
  color: #7dd3fc;
  font-size: 2rem;
  font-weight: 750;
  letter-spacing: 0.18em;
}

.card {
  padding: 1.35rem;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 1.15rem;
  background: rgba(15, 23, 42, 0.76);
  background: linear-gradient(135deg, color-mix(in srgb, var(--session-color, #cdeff2) 24%, #0f172a), rgba(15, 23, 42, 0.82));
  box-shadow: 0 1rem 4rem rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(1rem);
}

.feedback {
  display: flex;
  justify-content: flex-end;
  margin-top: 1rem;
}

.feedback-toggle {
  min-width: 2.75rem;
  padding-inline: 0.75rem;
}

.feedback-form {
  width: 100%;
}

.feedback-form label {
  display: grid;
  gap: 0.5rem;
  color: #bae6fd;
  font-size: 0.85rem;
}

.feedback-message {
  box-sizing: border-box;
  width: 100%;
  min-height: 5rem;
  padding: 0.75rem;
  border: 1px solid rgba(56, 189, 248, 0.38);
  border-radius: 0.75rem;
  background: rgba(15, 23, 42, 0.72);
  color: #f8fafc;
  font: inherit;
  resize: vertical;
}

.feedback-photo {
  margin-top: 0.75rem;
}

.feedback-preview {
  display: block;
  width: min(100%, 24rem);
  max-height: 18rem;
  overflow: auto;
  border-radius: 0.75rem;
}

.feedback-image {
  color: #f8fafc;
  font: inherit;
}

.feedback-actions {
  display: flex;
  gap: 0.65rem;
  margin-top: 0.75rem;
}

.card-head {
  display: flex;
  gap: 1rem;
  justify-content: space-between;
}

.session-title {
  margin: 0;
  font-size: 1.15rem;
}

.expiry {
  color: #64748b;
  font-size: 0.72rem;
  white-space: nowrap;
}

.card-meta {
  display: grid;
  justify-items: end;
  gap: 0.2rem;
}

.unresolved-count {
  min-width: 1.5rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: #38bdf8;
  color: #082f49;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
}

.relative-time {
  color: #94a3b8;
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.status {
  margin: 1.2rem 0 0;
  color: #7dd3fc;
  font-size: 0.85rem;
}

.notifications {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.75rem;
}

.notification {
  display: flex;
  align-items: start;
  gap: 0.75rem;
}

.notification-content {
  flex: 1;
  min-width: 0;
}

.notification p {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.55;
  white-space: pre-wrap;
}

.request-content {
  flex: 1;
  min-width: 0;
}

.request {
  margin-top: 1.25rem;
  padding-top: 1.1rem;
  border-top: 1px solid rgba(148, 163, 184, 0.16);
}

.request-prompt {
  flex: 1;
  margin: 0;
  font-weight: 650;
}

.request-head {
  display: flex;
  align-items: start;
  gap: 0.75rem;
}

button.dismiss-item {
  flex: 0 0 auto;
  min-height: 2rem;
  width: 2rem;
  padding: 0;
  border-color: transparent;
  background: transparent;
  color: #94a3b8;
  font-size: 1.25rem;
}

.request-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1rem;
}

button {
  min-height: 2.75rem;
  padding: 0.6rem 1rem;
  border: 1px solid rgba(56, 189, 248, 0.38);
  border-radius: 999px;
  background: rgba(14, 165, 233, 0.1);
  color: #e0f2fe;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}

button:disabled {
  cursor: default;
  opacity: 0.45;
}

button.destructive {
  margin-top: 1.25rem;
  border-color: rgba(248, 113, 113, 0.45);
  background: rgba(127, 29, 29, 0.2);
  color: #fecaca;
}

#empty {
  margin-top: 2rem;
  padding: 3rem 1rem;
  border: 1px dashed rgba(148, 163, 184, 0.22);
  border-radius: 1rem;
  color: #64748b;
  text-align: center;
}

.empty-mark {
  font-size: 2.5rem;
}

@media (max-width: 36rem) {
  main {
    padding-top: 3rem;
  }

  .card-head {
    display: block;
  }

  .expiry {
    display: block;
    margin-top: 0.5rem;
  }
}

.feedback-preview img { max-width: 160px; max-height: 160px; object-fit: contain; }
.feedback-preview figure { display: inline-flex; flex-direction: column; margin: 4px; }
