:root {
  color-scheme: dark;
  --text: rgba(250, 251, 255, 0.96);
  --line: rgba(235, 240, 255, 0.16);
  --glass: rgba(2, 3, 9, 0.62);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #000;
  color: var(--text);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

button,
input {
  font: inherit;
}

#starfield {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  background: #000;
}

#app {
  position: fixed;
  inset: 0;
  overflow: hidden;
}

.brand {
  position: absolute;
  z-index: 20;
  top: max(18px, env(safe-area-inset-top));
  left: max(20px, env(safe-area-inset-left));
  color: rgba(235, 239, 252, 0.25);
  font-size: 10px;
  letter-spacing: 0.34em;
  user-select: none;
  pointer-events: none;
}

.thought-layer {
  position: absolute;
  inset: 0;
  perspective: 1200px;
  transform-style: preserve-3d;
  pointer-events: none;
}

.thought {
  --thought-color: 235, 243, 255;
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(680px, 78vw);
  margin: 0;
  color: rgba(var(--thought-color), 0.95);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(20px, 2.75vw, 40px);
  font-weight: 400;
  font-style: italic;
  line-height: 1.38;
  letter-spacing: 0.012em;
  text-align: center;
  text-wrap: balance;
  opacity: 0;
  filter: blur(11px);
  text-shadow:
    0 0 8px rgba(var(--thought-color), 0.58),
    0 0 22px rgba(var(--thought-color), 0.38),
    0 0 52px rgba(var(--thought-color), 0.24),
    0 0 100px rgba(var(--thought-color), 0.13);
  transform-origin: center;
  will-change: transform, opacity, filter;
  user-select: none;
}

.thought-form {
  position: absolute;
  z-index: 30;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  width: min(780px, calc(100vw - 34px));
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  padding: 7px;
  border: 1px solid var(--line);
  background: var(--glass);
  box-shadow:
    0 18px 55px rgba(0, 0, 0, 0.58),
    inset 0 1px rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.thought-form:focus-within {
  border-color: rgba(235, 240, 255, 0.24);
  box-shadow:
    0 18px 55px rgba(0, 0, 0, 0.58),
    0 0 28px rgba(125, 153, 240, 0.08),
    inset 0 1px rgba(255, 255, 255, 0.035);
}

.thought-form input {
  min-width: 0;
  border: 0;
  outline: 0;
  padding: 12px 14px;
  background: transparent;
  color: var(--text);
  caret-color: #fff;
}

.thought-form input::placeholder {
  color: rgba(228, 233, 248, 0.3);
}

.character-count {
  min-width: 24px;
  color: rgba(225, 231, 248, 0.4);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-align: right;
  pointer-events: none;
}

.character-count.near-limit {
  color: rgba(255, 220, 190, 0.82);
}

.character-count.at-limit {
  color: rgba(255, 170, 170, 0.95);
}

.thought-form button {
  min-height: 40px;
  border: 1px solid rgba(228, 234, 251, 0.14);
  padding: 0 18px;
  color: rgba(245, 247, 255, 0.82);
  background: rgba(255, 255, 255, 0.035);
  cursor: pointer;
  transition:
    background 150ms ease,
    border-color 150ms ease,
    transform 150ms ease;
}

.thought-form button:hover {
  background: rgba(255, 255, 255, 0.075);
  border-color: rgba(230, 236, 253, 0.24);
}

.thought-form button:active {
  transform: translateY(1px);
}

.thought-form button:disabled {
  opacity: 0.34;
  cursor: default;
  transform: none;
}

@media (max-width: 640px) {
  .thought {
    width: min(88vw, 560px);
    font-size: clamp(18px, 5.3vw, 28px);
  }

  .thought-form {
    bottom: max(12px, env(safe-area-inset-bottom));
  }

  .thought-form button {
    padding: 0 14px;
  }
}


.outgoing-layer {
  position: absolute;
  inset: 0;
  perspective: 1200px;
  transform-style: preserve-3d;
  pointer-events: none;
  z-index: 18;
}

.outgoing-thought {
  --outgoing-color: 112, 207, 255;
  position: absolute;
  left: 50%;
  top: 76%;
  width: min(660px, 76vw);
  margin: 0;
  color: rgba(var(--outgoing-color), 0.96);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(18px, 2.35vw, 34px);
  font-weight: 400;
  font-style: italic;
  line-height: 1.35;
  letter-spacing: 0.012em;
  text-align: center;
  text-wrap: balance;
  opacity: 0;
  filter: blur(0);
  text-shadow:
    0 0 8px rgba(var(--outgoing-color), 0.7),
    0 0 24px rgba(var(--outgoing-color), 0.42),
    0 0 58px rgba(var(--outgoing-color), 0.26);
  transform-origin: center;
  will-change: transform, opacity, filter;
  user-select: none;
}


.thought.own-thought {
  --thought-color: 112, 207, 255;
  color: rgba(var(--thought-color), 0.98);
  text-shadow:
    0 0 9px rgba(var(--thought-color), 0.72),
    0 0 25px rgba(var(--thought-color), 0.46),
    0 0 58px rgba(var(--thought-color), 0.29),
    0 0 105px rgba(var(--thought-color), 0.16);
}


.thought-text,
.outgoing-text {
  display: block;
}

.thought-time,
.outgoing-time {
  display: block;
  margin-top: 10px;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: clamp(9px, 0.78vw, 12px);
  font-style: normal;
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.thought-time {
  color: rgba(var(--thought-color), 0.52);
  text-shadow:
    0 0 9px rgba(var(--thought-color), 0.25),
    0 0 22px rgba(var(--thought-color), 0.12);
}

.outgoing-time {
  color: rgba(var(--outgoing-color), 0.62);
  text-shadow:
    0 0 9px rgba(var(--outgoing-color), 0.32),
    0 0 22px rgba(var(--outgoing-color), 0.16);
}


.stream-status {
  position: absolute;
  z-index: 31;
  left: 50%;
  bottom: max(96px, calc(env(safe-area-inset-bottom) + 78px));
  width: min(780px, calc(100vw - 34px));
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px;
  color: rgba(225, 232, 248, 0.42);
  font-size: 10px;
  line-height: 1;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  pointer-events: none;
}

.status-separator {
  color: rgba(225, 232, 248, 0.2);
}


@media (max-width: 640px) {
  .stream-status {
    bottom: max(90px, calc(env(safe-area-inset-bottom) + 76px));
    gap: 6px;
    font-size: 9px;
  }
}
