:root {
  color-scheme: light;
  --bg: #eef2f7;
  --panel: #ffffff;
  --text: #172033;
  --muted: #627089;
  --line: #dbe3ef;
  --primary: #245cff;
  --primary-dark: #1642c7;
  --danger-bg: #fff1f0;
  --danger-text: #9f1d16;
  font-size: 14px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(36, 92, 255, 0.18), transparent 34rem),
    linear-gradient(135deg, #f8fafc 0%, var(--bg) 100%);
}

code {
  padding: 0.12rem 0.35rem;
  border-radius: 0.4rem;
  background: #e7ecf5;
  color: #27344d;
}

.page {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 56px 0;
}

.hero {
  margin-bottom: 28px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(1.9rem, 4.2vw, 3.8rem);
  letter-spacing: -0.06em;
}

.subtitle {
  max-width: 720px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.7;
}

.summary,
.alert,
.port-panel,
.empty {
  margin-bottom: 18px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 18px 50px rgba(47, 64, 91, 0.08);
}

.summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
}

.port-tip {
  flex-basis: 100%;
  color: var(--muted);
}

.alert {
  display: flex;
  gap: 8px;
  color: var(--danger-text);
  background: var(--danger-bg);
  border-color: #ffd1cc;
}

.port-panel {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.port-panel label {
  color: var(--muted);
  font-weight: 800;
  white-space: nowrap;
}

.port-panel input {
  width: 130px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  background: #fff;
  font: inherit;
  outline: none;
}

.port-panel input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(36, 92, 255, 0.12);
}

.port-button {
  margin-top: 0;
}

.port-error {
  flex-basis: 100%;
  color: var(--danger-text);
  font-size: 0.82rem;
  font-weight: 700;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
}

.card-actions .button {
  margin-top: 0;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 220px;
  padding: 22px;
  border: 1px solid rgba(219, 227, 239, 0.9);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: 0 18px 50px rgba(47, 64, 91, 0.1);
  backdrop-filter: blur(14px);
}

.login-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(100%, 420px);
  padding: 32px;
  border: 1px solid rgba(219, 227, 239, 0.9);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 24px 70px rgba(47, 64, 91, 0.14);
  backdrop-filter: blur(14px);
}

.login-card h1 {
  margin-bottom: 24px;
  font-size: clamp(2rem, 7vw, 3.2rem);
}

.login-card label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-weight: 700;
}

.login-card input {
  width: 100%;
  margin-bottom: 16px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--text);
  background: #fff;
  font: inherit;
  outline: none;
}

.login-card input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(36, 92, 255, 0.12);
}

.form-error {
  margin: 0 0 16px;
  color: var(--danger-text);
  font-weight: 700;
}

.card h2 {
  margin: 0 0 12px;
  overflow-wrap: anywhere;
  font-size: 1.12rem;
}

.card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.session-count {
  font-weight: 700;
}

.session-list {
  display: grid;
  gap: 10px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.session-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(248, 250, 252, 0.9);
}

.session-info {
  flex: 1 1 auto;
  min-width: 0;
}

.session-list strong,
.session-list span {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.small-button {
  flex: 0 0 auto;
  padding: 7px 11px;
  border-radius: 999px;
  color: var(--primary);
  background: rgba(36, 92, 255, 0.1);
  font-size: 0.78rem;
  font-weight: 800;
  text-decoration: none;
}

.small-button:hover,
.small-button:focus-visible {
  background: rgba(36, 92, 255, 0.16);
}

.message-list {
  display: grid;
  gap: 16px;
}

.message-card {
  padding: 20px;
  border: 1px solid rgba(219, 227, 239, 0.9);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: 0 18px 50px rgba(47, 64, 91, 0.08);
}

.message-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.message-header div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.message-header span,
.message-header time,
.muted {
  color: var(--muted);
}

.message-parts {
  display: grid;
  gap: 10px;
}

.message-part {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(248, 250, 252, 0.92);
}

.part-type {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.message-part pre {
  margin: 0;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font: 0.9rem/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.session-list strong {
  font-size: 0.92rem;
}

.session-list span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.78rem;
}

.button {
  align-self: flex-start;
  margin-top: 24px;
  padding: 9px 15px;
  border-radius: 999px;
  color: #fff;
  background: var(--primary);
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 12px 24px rgba(36, 92, 255, 0.28);
  transition: transform 140ms ease, background 140ms ease;
}

.button:hover,
.button:focus-visible {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.empty h2 {
  margin: 0 0 8px;
}

.empty p {
  margin: 0;
  color: var(--muted);
}

@media (max-width: 640px) {
  :root {
    font-size: 13px;
  }

  .page {
    width: min(100% - 24px, 1120px);
    padding: 32px 0;
  }

  .card {
    min-height: 160px;
  }

  .alert {
    flex-direction: column;
  }

  .port-panel,
  .card-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .port-panel input,
  .port-panel .button,
  .card-actions .button {
    width: 100%;
  }
}
