:root {
  --bg: #f2f6f3;
  --surface: #ffffff;
  --surface-soft: #f8fbf9;
  --text: #11231d;
  --muted: #567268;
  --accent: #0f766e;
  --accent-2: #0ea5e9;
  --border: #d2e3db;
  --danger: #b91c1c;
  --shadow: 0 14px 40px rgba(8, 32, 24, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(140% 90% at 14% 10%, rgba(15, 118, 110, 0.2) 0%, rgba(15, 118, 110, 0) 58%),
    radial-gradient(120% 80% at 86% 12%, rgba(14, 165, 233, 0.18) 0%, rgba(14, 165, 233, 0) 56%),
    linear-gradient(165deg, #f4faf7 0%, #eef7f3 48%, #edf6fa 100%),
    var(--bg);
  background-attachment: fixed;
}

.site-shell {
  width: calc(100% - 32px);
  max-width: 1260px;
  margin: 20px auto 30px;
}

.age-gate {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 18, 15, 0.65);
  backdrop-filter: blur(2px);
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.age-gate-card {
  width: 100%;
  max-width: 560px;
  padding: 24px;
  border-radius: 20px;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.25);
}

.age-gate-card p {
  margin: 10px 0 0;
  color: #2b4a41;
}

.age-gate-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}

body.gate-active {
  overflow: hidden;
}

body.gate-active .age-gate {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.topbar {
  padding: 14px 18px;
  margin-bottom: 18px;
  background: linear-gradient(120deg, #ffffff 10%, #f1f8f5 90%);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 46px;
  height: 46px;
}

h1,
h2,
h3 {
  margin: 0;
}

h1 {
  font-size: 1.4rem;
  letter-spacing: 0.03em;
  text-transform: lowercase;
}

h2 {
  margin-bottom: 10px;
  font-size: 1.1rem;
}

.brand-sub {
  margin: 2px 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 18px;
}

.chat-column {
  display: grid;
  gap: 14px;
}

.auth-column {
  align-self: start;
  padding: 16px;
}

.chat-panel,
.compose-panel {
  padding: 16px;
}

#messages {
  display: grid;
  gap: 8px;
  max-height: 500px;
  overflow-y: auto;
  padding-right: 4px;
}

.msg {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 11px;
  background: var(--surface-soft);
}

.meta {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 5px;
}

.grid {
  display: grid;
  gap: 10px;
}

input,
button {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 15px;
}

input {
  background: #fff;
}

input:focus {
  outline: none;
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.14);
}

input:disabled {
  background: #eef3f1;
  color: #6f847b;
  cursor: not-allowed;
}

button {
  background: linear-gradient(135deg, var(--accent), #0f9c8f);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  border-color: transparent;
}

button:hover {
  filter: brightness(1.03);
}

.btn-secondary {
  background: #e6efea;
  color: #244237;
  border-color: #c5d8cf;
}

.btn-secondary:hover {
  filter: none;
  background: #dbe9e3;
}

.error {
  color: var(--danger);
  min-height: 20px;
}

.hint {
  font-size: 12px;
  color: var(--muted);
}

.security-footer {
  margin-top: 18px;
  padding: 18px;
  background: linear-gradient(120deg, #ffffff 0%, #f5fbf8 100%);
}

.security-footer h2 {
  margin-bottom: 12px;
}

.thesis-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.thesis-item {
  border: 1px solid #b8d2c7;
  border-radius: 22px;
  padding: 22px 20px;
  background: #eef1ef;
}

.thesis-item p {
  margin: 14px 0 0;
  font-size: 1.05rem;
  line-height: 1.35;
  color: #2b4a41;
}

.thesis-badge {
  display: inline-block;
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  color: #0f766e;
  background: #cfe4de;
  border-radius: 999px;
  padding: 10px 20px;
}

@media (max-width: 1080px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .chat-column,
  .auth-column {
    grid-column: auto;
  }

  .auth-column {
    order: -1;
  }

  .thesis-grid {
    grid-template-columns: 1fr;
  }

  .thesis-badge {
    font-size: 0.82rem;
  }

  .thesis-item p {
    font-size: 1rem;
  }

  .age-gate-actions {
    grid-template-columns: 1fr;
  }
}
