:root {
  --ink: #060309;
  --accent: #ff3d81;
  --accent2: #b23bff;
  --text: #f2e7f2;
  --panel: rgba(18, 10, 22, .72);
  --panel-border: rgba(255, 61, 129, .16);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: clamp(15px, 0.55vw + 8.5px, 22px); }
html, body { height: 100%; }
body {
  background: var(--ink);
  color: var(--text);
  font-family: Georgia, 'Times New Roman', serif;
  min-height: 100vh;
  font-size: 1rem;
}
* { scrollbar-width: thin; scrollbar-color: rgba(255, 61, 129, .35) rgba(255, 255, 255, .04); }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: rgba(255, 255, 255, .03); }
::-webkit-scrollbar-thumb { background: rgba(255, 61, 129, .3); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 61, 129, .55); }
a { color: var(--accent); text-decoration: none; }
a:hover { color: #fff; }
input::placeholder { color: rgba(242, 231, 242, .28); font-style: italic; }

.glow-top {
  position: fixed; top: -20vh; left: 50%; transform: translateX(-50%);
  width: 70vw; height: 55vh; pointer-events: none;
  background: radial-gradient(closest-side, rgba(178, 59, 255, .12), rgba(178, 59, 255, 0));
}
.glow-bottom {
  position: fixed; bottom: -25vh; left: 50%; transform: translateX(-50%);
  width: 85vw; height: 58vh; pointer-events: none;
  background: radial-gradient(closest-side, rgba(255, 61, 129, .10), rgba(255, 61, 129, 0));
}

.label {
  font-family: system-ui, sans-serif; text-transform: uppercase;
  letter-spacing: .35em; font-size: .68rem; color: rgba(242, 231, 242, .45);
  padding-left: .35em;
}
.dim { color: rgba(242, 231, 242, .5); }
.wordmark {
  letter-spacing: .18em; padding-left: .18em; color: #fff; font-weight: 400;
  text-shadow: 0 0 24px rgba(255, 61, 129, .6), 0 0 70px rgba(178, 59, 255, .45);
}

.auth-wrap {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; position: relative;
}
.auth-head { display: flex; flex-direction: column; align-items: center; gap: 1.1rem; margin-bottom: 3.2rem; }
.auth-head .eyebrow {
  color: var(--accent); text-shadow: 0 0 12px rgba(255, 61, 129, .7);
  letter-spacing: .5em; padding-left: .5em;
}
.auth-head h1 { font-size: clamp(3rem, 5.5vw, 4.8rem); line-height: 1; }
.auth-form { display: flex; flex-direction: column; gap: 1.2rem; width: min(28rem, 90vw); }
.fieldgroup { display: flex; flex-direction: column; gap: .5rem; }
.field {
  width: 100%; background: rgba(255, 255, 255, .03); border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 6px; padding: .9rem 1rem; color: var(--text);
  font-family: Georgia, serif; font-size: 1rem; outline: none;
}
.field:focus { border-color: rgba(255, 61, 129, .5); }
textarea.field { resize: vertical; min-height: 4.5rem; }
.btn-enter {
  width: 100%; text-align: center; padding: 1rem 0; border: 1px solid rgba(255, 61, 129, .55);
  border-radius: 6px; color: #fff; font-family: system-ui, sans-serif;
  text-transform: uppercase; letter-spacing: .4em; text-indent: .4em; font-size: .8rem;
  background: linear-gradient(180deg, rgba(255, 61, 129, .16), rgba(178, 59, 255, .10));
  box-shadow: 0 0 24px rgba(255, 61, 129, .22); cursor: pointer;
}
.btn-enter:hover { border-color: var(--accent); }
.auth-alt { text-align: center; font-size: .9rem; color: rgba(242, 231, 242, .42); }
.auth-error {
  text-align: center; font-style: italic; font-size: .95rem; color: #ffb3cd;
  border: 1px solid rgba(255, 61, 129, .3); border-radius: 6px; padding: .7rem 1rem;
}
.checkrow { display: flex; gap: .7rem; align-items: flex-start; font-size: .9rem; color: rgba(242, 231, 242, .7); }
.checkrow input { margin-top: .25rem; accent-color: var(--accent); }
.auth-foot { position: absolute; bottom: 5vh; left: 0; right: 0; text-align: center; }

.dash {
  position: relative; height: 100vh; display: flex; flex-direction: column;
  width: 100%; overflow: hidden;
}
.dash-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.4rem 2.5vw .9rem;
}
.dash-header .wordmark { font-size: 1.4rem; }
.dash-id { display: flex; align-items: center; gap: 1rem; }
.dot {
  width: .55rem; height: .55rem; border-radius: 50%;
  background: #d9b6ff; box-shadow: 0 0 10px rgba(178, 59, 255, .8);
}
.dash-cols { flex: 1; display: flex; justify-content: center; gap: clamp(1.4rem, 2vw, 2.6rem); padding: .5rem 4.5vw 1.8rem; min-height: 0; }
.col-side { width: clamp(19rem, 22vw, 27rem); display: flex; flex-direction: column; gap: 1.2rem; flex-shrink: 0; }
.col-center { flex: 0 0 auto; width: clamp(24rem, 31vw, 42rem); display: flex; flex-direction: column; align-items: center; gap: 1.2rem; min-height: 0; }

.card {
  background: var(--panel); border: 1px solid var(--panel-border);
  border-radius: 8px; padding: 1.2rem 1.35rem; display: flex; flex-direction: column; gap: .7rem;
  font-size: 1rem;
}
.cardtitle {
  font-family: system-ui, sans-serif; text-transform: uppercase;
  letter-spacing: .35em; font-size: .68rem; color: var(--accent); padding-left: .35em;
}
.chip {
  display: inline-block; font-family: system-ui, sans-serif; font-size: .68rem;
  text-transform: uppercase; letter-spacing: .2em; padding: .3rem .7rem .3rem .85rem;
  border: 1px solid rgba(178, 59, 255, .45); border-radius: 999px; color: #d9b6ff;
  width: fit-content;
}
.chip.pink { border-color: rgba(255, 61, 129, .5); color: #ffb3cd; }
.expand-btn {
  font-family: system-ui, sans-serif; font-size: .68rem; text-transform: uppercase;
  letter-spacing: .25em; color: rgba(242, 231, 242, .35); cursor: pointer;
  background: none; border: none; text-align: left; padding: .3rem 0 0;
}
.expand-btn:hover { color: var(--accent); }
.lock-word {
  font-size: 2.4rem; color: #fff; letter-spacing: .12em;
  text-shadow: 0 0 22px rgba(255, 61, 129, .55);
}
.feed { display: flex; flex-direction: column; gap: .55rem; font-size: .9rem; }

.portrait {
  position: relative; width: 100%; flex: 1 1 0; min-height: 0;
  border-radius: 10px; overflow: hidden;
  border: 1px solid rgba(255, 61, 129, .25); box-shadow: 0 0 45px rgba(178, 59, 255, .25);
}
.portrait video { width: 100%; height: 100%; object-fit: cover; object-position: center 45%; display: block; }
.portrait .veil {
  position: absolute; inset: 0; z-index: 2;
  background: linear-gradient(to bottom, rgba(6, 3, 9, 0) 62%, rgba(6, 3, 9, .85) 100%);
}
.portrait .presence { z-index: 3; }
.portrait .presence {
  position: absolute; bottom: .8rem; left: 0; right: 0; text-align: center;
  font-family: system-ui, sans-serif; font-size: .68rem; text-transform: uppercase;
  letter-spacing: .35em; text-indent: .35em; color: rgba(242, 231, 242, .8);
}

.chat {
  width: 100%; display: flex; flex-direction: column; gap: .7rem; flex: 1 1 0; min-height: 10rem;
  background: var(--panel); border: 1px solid var(--panel-border);
  border-radius: 8px; padding: 1.2rem 1.35rem;
}
.chat-log { display: flex; flex-direction: column; gap: .7rem; overflow-y: auto; flex: 1 1 0; min-height: 0; padding-right: .3rem; }
.bubble { max-width: 88%; border-radius: 10px; padding: .8rem 1.1rem; font-size: 1rem; line-height: 1.55; }
.bubble.her { align-self: flex-start; background: rgba(255, 61, 129, .10); border: 1px solid rgba(255, 61, 129, .22); }
.bubble.user { align-self: flex-end; background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .10); }
.bubble.system { align-self: center; background: none; border: 1px dashed rgba(255, 255, 255, .15); color: rgba(242, 231, 242, .55); font-size: .85rem; }
.bubble audio { display: block; margin-top: .5rem; width: 100%; height: 2rem; }
.bubble.her.tg { background: rgba(178, 59, 255, .10); border-color: rgba(178, 59, 255, .30); }
.bubble.user.tg { background: rgba(178, 59, 255, .06); border-color: rgba(178, 59, 255, .18); }
.chat-input { display: flex; gap: .7rem; align-items: center; }
.chat-input .field { flex: 1; font-style: italic; }
.btn-send {
  padding: .85rem 1.5rem; border: 1px solid rgba(255, 61, 129, .55); border-radius: 6px;
  font-family: system-ui, sans-serif; font-size: .68rem; text-transform: uppercase;
  letter-spacing: .3em; text-indent: .3em; color: #fff;
  background: rgba(255, 61, 129, .12); cursor: pointer;
}
.chat-foot {
  text-align: center; font-family: system-ui, sans-serif; font-size: .68rem;
  letter-spacing: .2em; text-transform: uppercase; color: rgba(242, 231, 242, .3);
}

.card.emergency {
  margin-top: auto; align-self: center; width: fit-content; aspect-ratio: 1 / 1;
  justify-content: center; align-items: center; gap: .45rem; padding: .7rem 1rem;
}
.card.emergency .cardtitle { color: rgba(255, 255, 255, .7); text-align: center; font-size: .55rem; }
.btn-release {
  width: 3.4rem; height: 3.4rem; border-radius: 6px; background: var(--accent);
  border: none; display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.btn-release svg { width: 1.7rem; height: 1.7rem; }
.btn-release:active { filter: brightness(.85); }

.overlay {
  position: fixed; inset: 0; background: rgba(6, 3, 9, .78);
  backdrop-filter: blur(3px); display: none; align-items: center; justify-content: center; z-index: 20;
}
.overlay.open { display: flex; }
.modal {
  width: min(60rem, 92vw); max-height: 88vh; overflow-y: auto;
  background: rgba(18, 10, 22, .94); border: 1px solid rgba(255, 61, 129, .3);
  border-radius: 10px; box-shadow: 0 0 60px rgba(178, 59, 255, .3);
  padding: 2rem 2.4rem 2.2rem; display: flex; flex-direction: column; gap: 1.5rem;
}
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; }
.modal-close { font-family: system-ui, sans-serif; font-size: 1.2rem; color: rgba(242, 231, 242, .45); cursor: pointer; background: none; border: none; padding: .1rem .5rem; }
.modal-close:hover { color: #fff; }
.statgrid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.2rem; }
.stat { display: flex; flex-direction: column; gap: .4rem; }
.statlabel {
  font-family: system-ui, sans-serif; text-transform: uppercase;
  letter-spacing: .25em; font-size: .62rem; color: rgba(242, 231, 242, .4);
}
.statval { font-size: 1.4rem; color: #fff; }
.bar-track { height: .5rem; border-radius: 999px; background: rgba(255, 255, 255, .06); overflow: hidden; }
.bar-fill {
  width: 100%; height: 100%;
  background: linear-gradient(90deg, rgba(178, 59, 255, .7), rgba(255, 61, 129, .8) 45%, rgba(255, 61, 129, 0) 92%);
}
.rows { display: flex; flex-direction: column; gap: .3rem; }
.row {
  display: flex; justify-content: space-between; font-size: .9rem;
  padding: .6rem 0; border-bottom: 1px solid rgba(255, 255, 255, .06); gap: 1rem;
}
.row:last-child { border-bottom: none; }

@media (max-width: 1100px) {
  .dash-cols { flex-direction: column; }
  .col-side { width: 100%; }
  .card.emergency { margin-top: 0; }
  .portrait { width: min(85vw, 24rem); }
}
