:root {
  font-family: Inter, "Segoe UI", "Microsoft YaHei", sans-serif;
  color: #e8ecea;
  background: #101412;
  font-synthesis: none;
  --green: #beef98;
  --muted: #9ca79f;
  --line: #303a33;
  --surface: #181f1b;
  --radius: 20px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100dvh;
  background: radial-gradient(ellipse at 80% 2%, #24332570, transparent 45%), #101412;
}
button, input, textarea { font: inherit; }
button, a, input, textarea { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .38; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--green); outline-offset: 4px; }
textarea, input {
  width: 100%;
  border: 1px solid #3a463d;
  background: #111713;
  color: #e8ecea;
  border-radius: 10px;
  padding: 15px;
}
input { resize: none; }
textarea { resize: vertical; }
textarea::placeholder, input::placeholder { color: #748178; font-size: 13px; }
textarea { line-height: 1.65; }
h1, h2, p { margin: 0; }
[hidden] { display: none !important; }

.app-shell { width: min(560px, 100% - 40px); margin: auto; }

.site-header {
  height: 92px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: transparent;
  border: 0;
  padding: 6px;
  border-radius: 12px;
}
.brand-mark {
  display: grid;
  place-content: center;
  background: var(--green);
  color: #172213;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 750;
  letter-spacing: -.5px;
  line-height: 1;
}
.room-code {
  font-family: Consolas, monospace;
  font-size: 17px;
  letter-spacing: 2px;
  color: #cfe6b8;
  background: #1d271c;
  border: 1px solid #405338;
  padding: 6px 11px;
  border-radius: 8px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.notice { display: none; }

.eyebrow {
  font-family: Consolas, monospace;
  font-size: 10px;
  letter-spacing: 2.5px;
  color: #a3b398;
  display: flex;
  align-items: center;
  gap: 10px;
}
.eyebrow > span { width: 22px; height: 1px; background: var(--green); }

.contacts {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 28px;
}
.contact {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 14px;
  background: rgba(190, 239, 152, .1);
  border: 1px solid rgba(190, 239, 152, .38);
  border-radius: 12px;
  padding: 10px 14px;
  text-align: left;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
.contact.is-dragging {
  z-index: 1000;
  opacity: .97;
  border-color: var(--green);
  box-shadow: 0 14px 32px rgba(0, 0, 0, .55);
  cursor: grabbing;
}
.contact-placeholder {
  border: 1px dashed rgba(190, 239, 152, .5);
  border-radius: 12px;
  background: rgba(190, 239, 152, .04);
}
.contact-avatar {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #000;
  border: 1px solid #3a463d;
  display: grid;
  place-content: center;
}
.contact-number {
  color: #e8ecea;
  font-size: 16px;
  font-weight: 650;
  line-height: 1;
}
.contact-dot {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #e05555;
  border: 2px solid #101412;
}
.contact-dot.online { background: #6fd16f; }
.contact-code {
  font-family: Consolas, monospace;
  font-size: 15px;
  letter-spacing: 2px;
  color: #cfe6b8;
}
.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-content: center;
  background: rgba(0, 0, 0, .62);
  z-index: 10;
  padding: 20px;
}
.modal-box {
  background: #171e19;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  width: min(320px, 90vw);
}
.modal-title { font-size: 16px; font-weight: 600; margin-bottom: 14px; }
.modal-label { display: block; font-size: 11px; color: #a4b19f; margin-bottom: 8px; }
#modal-number { text-align: center; font-size: 22px; letter-spacing: 2px; margin-bottom: 18px; }
.modal-actions { display: flex; gap: 10px; }
.modal-actions .button { flex: 1; justify-content: center; }

.enter-form {
  margin-top: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #171d19;
  padding: 24px;
}
.enter-form input {
  text-align: center;
  font-family: Consolas, monospace;
  font-size: 28px;
  letter-spacing: 12px;
  margin-bottom: 14px;
  min-height: 60px;
}
.enter-form .button { width: 100%; }
.code-field { position: relative; }
.code-field input.masked { color: transparent; caret-color: transparent; }
.code-mask {
  position: absolute;
  inset: 0 0 14px;
  display: grid;
  place-content: center;
  pointer-events: none;
  font-family: Consolas, monospace;
  font-size: 28px;
  letter-spacing: 12px;
  color: #e8ecea;
}

.button {
  border-radius: 9px;
  padding: 13px 18px;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  font-size: 13px;
  font-weight: 600;
  min-height: 45px;
  transition: background .15s, transform .15s;
}
.button:active:not(:disabled) { transform: translateY(1px); }
.button-primary { background: var(--green); color: #1a2914; }
.button-primary:hover:not(:disabled) { background: #d0ffa9; }
.button-secondary { background: #273028; border-color: #42513f; color: #e3ecdd; }
.button-secondary:hover:not(:disabled) { background: #354331; }

.chat-panel {
  margin: 24px auto 34px;
  background: #171e19;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px;
}
.chat-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.chat-header .eyebrow { font-size: 9px; letter-spacing: 2px; }
.chat-header h1 { font-size: 20px; font-weight: 500; display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.connection-dot { width: 12px; height: 12px; background: #b8b895; border-radius: 50%; flex-shrink: 0; }
.connection-dot.is-active { background: var(--green); box-shadow: 0 0 12px #beef9850; }
.button-quiet { background: transparent; border-color: #465144; color: #b6c1b2; font-size: 11px; padding: 10px 13px; white-space: nowrap; }
.button-quiet:hover { border-color: #b8c5af; }
.room-meta { display: flex; justify-content: space-between; gap: 12px; font-size: 10px; color: #94a08f; padding: 20px 0 16px; border-bottom: 1px solid var(--line); }

.conversation { min-height: 268px; position: relative; padding: 22px 0; }
.empty-messages { text-align: center; padding: 36px 0 30px; color: #a2af9e; }
.empty-messages > span { font-size: 35px; letter-spacing: 7px; color: #89a37b; }
.empty-messages h2 { font-size: 17px; font-weight: 450; letter-spacing: 1px; margin: 16px 0 12px; }
.empty-messages p { font-size: 12px; color: #8d9d87; line-height: 1.9; }

.messages { display: flex; flex-direction: column; gap: 16px; }
.message { display: flex; gap: 10px; align-items: flex-end; max-width: 86%; align-self: flex-start; }
.message-mine { align-self: flex-end; flex-direction: row-reverse; }
.message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #000;
  border: 1px solid #3a463d;
  flex-shrink: 0;
  display: grid;
  place-content: center;
  color: #e8ecea;
  font-size: 12px;
  font-weight: 600;
}
.message-avatar.is-clickable { cursor: pointer; }
.message-body { min-width: 0; max-width: 100%; }
.message-reveal {
  display: block;
  width: 100%;
  min-height: 46px;
  border: 1px solid #405039;
  background: #253122;
  color: #bacbb2;
  border-radius: 4px 14px 14px 14px;
  padding: 14px 18px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  text-align: left;
}
.message-mine .message-reveal { background: #35492b; border-color: #527243; border-radius: 14px 4px 14px 14px; }
.message-reveal.is-revealed { background: #c2e8a9; border-color: #c2e8a9; color: #15200f; }
.message-hint { display: block; letter-spacing: 3px; font-size: 12px; color: #8fa38a; }
.message-content { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; line-height: 1.8; }

.composer { background: #101712; border: 1px solid #3c4937; border-radius: 12px; padding: 5px; }
.composer textarea { border: none; background: transparent; min-height: 78px; max-height: 220px; resize: vertical; padding: 13px; font-size: 14px; }
.composer textarea:focus { outline: none; }
.composer:focus-within { border-color: #92b37e; }
.composer-bottom { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 6px; }
.composer-hint { font-size: 9px; color: #8d9c85; line-height: 1.8; padding-left: 7px; }
.composer-hint > span { margin-left: 14px; font-family: Consolas, monospace; }
.composer .button { padding: 10px 18px; min-height: 38px; }
#send-button {
  min-width: 56px;
  min-height: 56px;
  padding: 0;
  justify-content: center;
  gap: 0;
  font-size: 22px;
  border-radius: 50%;
  flex-shrink: 0;
}
.session-footnote { font-size: 10px; color: #95a48d; text-align: center; margin-top: 16px; line-height: 1.7; }

.is-error { color: #ffb5a3; }
.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; }

@media (max-width: 640px) {
  .app-shell { width: calc(100% - 36px); }
  .site-header { height: 78px; }
  .brand-mark { width: 36px; height: 36px; font-size: 14px; border-radius: 11px; }
  .room-code { font-size: 15px; letter-spacing: 1.5px; padding: 5px 9px; }
  .enter-form { padding: 20px; }
  .enter-form input { font-size: 24px; }
  .chat-panel { padding: 16px; margin: 20px auto; }
  .chat-header h1 { font-size: 16px; gap: 7px; }
  .chat-header .eyebrow { font-size: 8px; letter-spacing: 1px; }
  .button-quiet { font-size: 10px; padding: 8px 10px; min-height: 38px; }
  .room-meta { font-size: 9px; padding-top: 16px; }
  .conversation { min-height: 240px; }
  .composer-hint { font-size: 8px; }
  .composer-hint > span { display: block; margin-left: 0; }
  .message { max-width: 92%; }
  .message-avatar { width: 28px; height: 28px; }
  .message-reveal { padding: 13px 16px; }
  .session-footnote { font-size: 9px; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
