:root {
  --ink: #121410;
  --paper: #e7e9e1;
  --card: #f5f6f0;
  --acid: #d8ff43;
  --muted: #73796d;
  --line: #c7cbc0;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }

body {
  margin: 0;
  color: var(--ink);
  background: #090b09;
  font-family: Arial, Helvetica, sans-serif;
}

button, input, textarea { font: inherit; }
button { cursor: pointer; }

.scene {
  min-height: 100svh;
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  padding: 28px 16px;
  background:
    radial-gradient(circle at 50% 22%, #30352b 0, #151814 35%, #090b09 75%);
}

.grain {
  position: fixed;
  inset: 0;
  opacity: .055;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitchTiles'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.8'/%3E%3C/svg%3E");
}

.phone {
  width: min(100%, 440px);
  height: min(840px, calc(100svh - 56px));
  min-height: 600px;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
  overflow: hidden;
  background: var(--paper);
  border: 1px solid #444a3e;
  border-radius: 28px;
  box-shadow: 0 30px 100px rgba(0, 0, 0, .62), 0 0 0 8px #11140f;
}

.header {
  height: 78px;
  flex: 0 0 78px;
  display: grid;
  grid-template-columns: 42px 1fr auto;
  align-items: center;
  gap: 11px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(239, 241, 234, .96);
}

.mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #050605;
  box-shadow: inset 0 0 0 1px #30362c;
}

.header h1 {
  margin: 0 0 4px;
  font: 700 13px/1 "Courier New", monospace;
  letter-spacing: .1em;
}

.header p {
  margin: 0;
  color: #68705f;
  font-size: 11px;
}

.erase {
  padding: 6px 8px;
  color: #70766b;
  background: transparent;
  border: 0;
  font: 9px/1 "Courier New", monospace;
  text-transform: uppercase;
}

.header-actions {
  display: flex;
  align-items: center;
}

.info-dialog {
  width: min(390px, calc(100% - 32px));
  padding: 0;
  color: var(--ink);
  background: #eef0e9;
  border: 1px solid #555c4e;
  border-radius: 18px;
  box-shadow: 0 28px 90px rgba(0, 0, 0, .6);
}
.info-dialog::backdrop {
  background: rgba(5, 7, 5, .78);
  backdrop-filter: blur(8px);
}
.info-dialog > div { padding: 24px; }
.info-dialog h2 { margin: 11px 0 8px; font-size: 24px; }
.info-dialog p { color: #60675b; font-size: 12px; line-height: 1.55; }
.info-dialog button { width: 100%; margin-top: 10px; padding: 11px; border-radius: 18px; }

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 26px 13px 20px;
  background:
    linear-gradient(rgba(27, 30, 26, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(27, 30, 26, .035) 1px, transparent 1px),
    #e3e5de;
  background-size: 24px 24px;
}

.intro {
  margin: 12% auto 32px;
  max-width: 300px;
  text-align: center;
}

.intro span, .eyebrow, .owner-header span {
  color: #68705f;
  font: 9px/1 "Courier New", monospace;
  letter-spacing: .15em;
}

.intro h2 {
  margin: 14px 0 8px;
  font-size: 24px;
}

.intro p { margin: 0; color: #62685e; font-size: 13px; line-height: 1.5; }

.message-row { display: flex; margin: 9px 0; animation: arrive .25s ease-out both; }
.message-row.visitor { justify-content: flex-end; }
.message-row.subconscious { justify-content: flex-start; }

.bubble {
  max-width: 84%;
  padding: 10px 11px 7px;
  border-radius: 15px;
  box-shadow: 0 1px 1px rgba(0, 0, 0, .08);
}

.visitor .bubble {
  background: var(--acid);
  border-bottom-right-radius: 4px;
}

.subconscious .bubble {
  background: var(--card);
  border: 1px solid #d7dbd1;
  border-bottom-left-radius: 4px;
}

.bubble p { margin: 0; white-space: pre-wrap; font-size: 14px; line-height: 1.45; }
.bubble time {
  display: block;
  margin-top: 4px;
  color: #747a70;
  text-align: right;
  font: 9px/1 "Courier New", monospace;
}

.composer {
  min-height: 66px;
  display: grid;
  grid-template-columns: 1fr 38px;
  gap: 8px;
  align-items: end;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  background: #eef0e9;
}

.composer textarea {
  width: 100%;
  max-height: 110px;
  resize: none;
  outline: 0;
  padding: 10px 13px;
  color: var(--ink);
  background: #fafbf7;
  border: 1px solid #cdd1c7;
  border-radius: 19px;
  font-size: 14px;
}

.composer button {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: var(--acid);
  font-size: 20px;
}
.composer button:disabled { opacity: .35; cursor: default; }

.onboarding {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(5, 7, 5, .8);
  backdrop-filter: blur(10px);
}
.onboarding[hidden] { display: none; }

.consent-card {
  width: min(100%, 430px);
  padding: 26px;
  background: #eef0e9;
  border: 1px solid #555c4e;
  border-radius: 20px;
  box-shadow: 0 28px 90px rgba(0, 0, 0, .6);
}

.consent-card h2 { margin: 11px 0 8px; font-size: 27px; }
.consent-card > p { color: #60675b; font-size: 13px; line-height: 1.5; }
.consent-card label:not(.consent) { display: block; margin-top: 16px; }
.consent-card label > span:first-child { display: block; margin-bottom: 6px; font-size: 11px; }
.consent-card input[type="text"], .consent-card input:not([type]) {
  width: 100%;
}
.consent-card input {
  padding: 11px 12px;
  border: 1px solid #c7cbc0;
  border-radius: 10px;
  background: #fafbf7;
  outline: 0;
}

.consent {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 9px;
  align-items: start;
  margin-top: 18px;
  color: #51574e;
  font-size: 11px;
  line-height: 1.45;
}
.consent input { width: 16px; height: 16px; margin: 1px 0 0; }

.actions { display: flex; gap: 8px; margin-top: 20px; }
.actions button {
  flex: 1;
  padding: 11px;
  border-radius: 18px;
  font: 10px/1 "Courier New", monospace;
  text-transform: uppercase;
}
.primary { color: #11140e; background: var(--acid); border: 1px solid #b4d52c; }
.secondary { background: transparent; border: 1px solid #9da493; }
.privacy { margin-bottom: 0; text-align: center; font-size: 10px !important; }

.shake { animation: shake .4s ease; }

.owner-body { background: #e7e9e1; }
.owner-shell { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 28px 0; }
.owner-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 22px;
  border-bottom: 1px solid #bfc4b8;
}
.owner-header h1 { margin: 7px 0 0; font-size: clamp(25px, 4vw, 46px); }
.owner-header a { color: #30362d; font-size: 12px; }
.owner-grid { display: grid; grid-template-columns: 360px 1fr; gap: 18px; margin-top: 18px; }
.session-list { display: grid; gap: 9px; }
.session-card {
  width: 100%;
  padding: 14px;
  text-align: left;
  background: #f5f6f0;
  border: 1px solid #ced2c8;
  border-radius: 12px;
}
.session-card strong, .session-card span, .session-card small { display: block; }
.session-card span { margin-top: 4px; color: #686f63; font-size: 11px; }
.session-card small { margin-top: 8px; color: #858b80; font: 9px/1 "Courier New", monospace; }
.session-card p { margin: 9px 0 0; color: #3f453d; font-size: 12px; line-height: 1.4; }
.session-detail {
  min-height: 500px;
  padding: 20px;
  background: #f5f6f0;
  border: 1px solid #ced2c8;
  border-radius: 14px;
}
.detail-heading h2 { margin: 5px 0; font-size: 28px; }
.detail-heading span { color: #70776a; font-size: 11px; }
.detail-heading p { color: #565d52; line-height: 1.5; }
.mention-box {
  display: grid;
  gap: 6px;
  margin: 18px 0;
  padding: 12px;
  background: #e8ebdf;
  border-radius: 9px;
  font-size: 11px;
}
.mention-box span { color: #5f665a; }
.transcript { display: grid; gap: 10px; }
.transcript-message { max-width: 82%; padding: 11px; border-radius: 10px; }
.transcript-message.visitor { margin-left: auto; background: rgba(216, 255, 67, .45); }
.transcript-message.subconscious { background: #e7e9e1; }
.transcript-message small { color: #747b70; font: 9px/1 "Courier New", monospace; }
.transcript-message p { margin: 6px 0 0; line-height: 1.45; }

.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;
}

@keyframes arrive {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

@media (max-width: 720px) {
  .scene { padding: 0; }
  .phone { width: 100%; height: 100svh; min-height: 100svh; border: 0; border-radius: 0; box-shadow: none; }
  .consent-card { padding: 22px 18px; }
  .actions { flex-direction: column; }
  .owner-grid { grid-template-columns: 1fr; }
  .session-detail { min-height: 300px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; }
}
