:root {
  --bg: #0f1117;
  --panel: #2a2d36;
  --panel-dark: #1d2028;
  --ink: #e8edf8;
  --ink-dim: #9ca8c0;
  --ink-faint: #7f8aa1;
  --line: rgba(128, 156, 218, 0.24);
  --accent: #4f8cff;
  --accent-strong: #2f6fd8;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  font-family:
    "SF Pro Display",
    "Manrope",
    "Noto Sans SC",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  background:
    radial-gradient(58rem 34rem at -8% -14%, rgba(79, 140, 255, 0.2), transparent 58%),
    radial-gradient(56rem 28rem at 110% 104%, rgba(48, 111, 216, 0.16), transparent 62%),
    var(--bg);
  color: var(--ink);
  position: relative;
  -webkit-font-smoothing: antialiased;
}

.ambient {
  position: fixed;
  width: 28rem;
  height: 28rem;
  filter: blur(88px);
  pointer-events: none;
  z-index: 0;
}

.ambient-a {
  left: -10rem;
  top: -12rem;
  background: rgba(79, 140, 255, 0.32);
}

.ambient-b {
  right: -8rem;
  bottom: -10rem;
  background: rgba(58, 103, 192, 0.24);
}

.top-entry {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  width: min(1100px, calc(100% - 2rem));
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 5;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.52rem;
  text-decoration: none;
  color: var(--ink);
  font-weight: 600;
  letter-spacing: 0.01em;
}

.brand-logo {
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 0.7rem;
  border: 1px solid rgba(129, 158, 219, 0.38);
}

.entry-icons {
  display: inline-flex;
  align-items: center;
  gap: 0.46rem;
}

.icon-btn {
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 999px;
  border: 1px solid rgba(126, 160, 224, 0.44);
  background: rgba(22, 29, 42, 0.72);
  color: #d9e8ff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 140ms ease, transform 140ms ease, background 140ms ease;
}

.icon-btn svg {
  width: 1.06rem;
  height: 1.06rem;
  fill: currentColor;
}

.locale-btn {
  width: auto;
  min-width: 2.36rem;
  padding: 0 0.56rem;
  font-size: 0.76rem;
  font-weight: 700;
}

.icon-btn:hover {
  border-color: rgba(128, 187, 255, 0.82);
  background: rgba(28, 38, 56, 0.84);
  transform: translateY(-1px);
}

.landing {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  width: min(1100px, calc(100% - 2rem));
  margin-inline: auto;
  padding-top: 11rem;
  display: grid;
  justify-items: center;
  align-content: start;
}

.headline {
  margin: 0;
  text-align: center;
  font-size: clamp(1.8rem, 3.3vw, 2.88rem);
  font-weight: 700;
  letter-spacing: 0.01em;
}

.entry-status {
  margin: 0.52rem 0 0;
  color: var(--ink-faint);
  font-size: 0.84rem;
}

.chat-shell {
  margin-top: 1.3rem;
  width: min(860px, 100%);
  display: grid;
  gap: 0.6rem;
}

.chat-thread {
  max-height: 38vh;
  overflow: auto;
  padding: 0 0.2rem;
  display: grid;
  gap: 0.48rem;
}

.chat-thread::-webkit-scrollbar {
  width: 6px;
}

.chat-thread::-webkit-scrollbar-thumb {
  background: rgba(104, 146, 226, 0.55);
  border-radius: 999px;
}

.chat-empty {
  margin: 0;
  color: var(--ink-faint);
  font-size: 0.9rem;
}

.chat-bubble {
  max-width: min(74ch, 94%);
  padding: 0.62rem 0.72rem;
  border-radius: 0.86rem;
  line-height: 1.56;
  font-size: 0.88rem;
  white-space: pre-wrap;
  border: 1px solid rgba(122, 150, 204, 0.24);
}

.chat-bubble.user {
  margin-left: auto;
  background: rgba(79, 140, 255, 0.2);
  border-color: rgba(109, 167, 255, 0.45);
}

.chat-bubble.assistant {
  margin-right: auto;
  background: rgba(20, 26, 38, 0.88);
}

.quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.quick-reply {
  border: 1px solid rgba(112, 150, 223, 0.48);
  border-radius: 999px;
  padding: 0.22rem 0.56rem;
  background: transparent;
  color: #c7dcff;
  font-size: 0.75rem;
  cursor: pointer;
}

.quick-reply:hover {
  border-color: rgba(133, 197, 255, 0.82);
  color: #ecf5ff;
}

.composer {
  border-radius: 1.1rem;
  border: 1px solid rgba(121, 150, 206, 0.42);
  background: linear-gradient(180deg, rgba(35, 38, 47, 0.92), rgba(31, 34, 43, 0.9));
  padding: 0.56rem;
  display: grid;
  gap: 0.56rem;
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(208, 224, 255, 0.12);
}

textarea,
input {
  width: 100%;
  font: inherit;
  color: var(--ink);
  border-radius: 0.9rem;
  border: 1px solid rgba(122, 152, 210, 0.3);
  background: rgba(18, 22, 31, 0.7);
  padding: 0.72rem 0.82rem;
  resize: vertical;
}

textarea {
  min-height: 7.2rem;
  line-height: 1.58;
}

textarea::placeholder,
input::placeholder {
  color: rgba(189, 203, 226, 0.48);
}

textarea:focus-visible,
input:focus-visible,
button:focus-visible {
  outline: none;
  border-color: rgba(130, 178, 255, 0.7);
  box-shadow: 0 0 0 3px rgba(79, 140, 255, 0.18);
}

.composer-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.game-hint {
  margin: 0;
  color: var(--ink-dim);
  font-size: 0.78rem;
}

.game-hint code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  color: #e5f1ff;
  border: 1px solid rgba(108, 141, 198, 0.44);
  border-radius: 0.45rem;
  background: rgba(18, 25, 36, 0.8);
  padding: 0.06rem 0.3rem;
}

.composer-actions {
  display: inline-grid;
  grid-template-columns: auto auto;
  gap: 0.5rem;
}

.btn {
  min-height: 2.46rem;
  min-width: 8rem;
  border-radius: 0.9rem;
  border: 1px solid rgba(122, 152, 210, 0.46);
  background: rgba(26, 33, 45, 0.76);
  color: #deebff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.btn.primary {
  border-color: rgba(107, 164, 255, 0.9);
  background: linear-gradient(180deg, var(--accent), var(--accent-strong));
  color: #fff;
}

.btn.ghost {
  background: rgba(23, 31, 44, 0.7);
}

.status-line {
  font-size: 0.76rem;
  color: var(--ink-faint);
  padding: 0 0.2rem;
  text-align: left;
}

.auth-dialog {
  border: none;
  width: min(460px, calc(100% - 1.2rem));
  border-radius: 1rem;
  padding: 0;
  background: transparent;
}

.auth-dialog::backdrop {
  background: rgba(4, 8, 16, 0.62);
  backdrop-filter: blur(6px);
}

.auth-dialog-card {
  margin: 0;
  border-radius: 1rem;
  border: 1px solid rgba(120, 151, 208, 0.44);
  background: linear-gradient(168deg, rgba(21, 28, 41, 0.96), rgba(14, 20, 31, 0.98));
  padding: 0.96rem;
  display: grid;
  gap: 0.62rem;
}

.auth-dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.auth-dialog-head h3 {
  margin: 0;
  font-size: 1.02rem;
}

.auth-tip {
  margin: 0;
  color: var(--ink-dim);
  font-size: 0.82rem;
}

.auth-dialog-card label {
  display: grid;
  gap: 0.34rem;
}

.auth-dialog-card label span {
  color: #a9b9d6;
  font-size: 0.78rem;
}

.auth-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.5rem;
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--ink-faint);
}

@media (max-width: 900px) {
  .top-entry,
  .landing {
    width: calc(100% - 1rem);
  }

  .landing {
    padding-top: 8.6rem;
  }

  .headline {
    font-size: clamp(1.34rem, 7vw, 2rem);
  }

  .chat-shell {
    padding: 0.6rem;
    border-radius: 1rem;
  }

  .composer-meta,
  .auth-actions {
    grid-template-columns: 1fr;
    display: grid;
  }

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

  .brand span {
    font-size: 0.92rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}
