:root {
  --blue: #4c86ef;
  --blue-dark: #3475ed;
  --ink: #142033;
  --muted: #7d8797;
  --line: #e2e6ee;
  --page: #f3f4f6;
  --white: #ffffff;
  --accent: #4c86ef;
  --teal: #237b72;
  font-family:
    "PingFang SC",
    "Microsoft YaHei",
    "Noto Sans CJK SC",
    sans-serif;
  color: var(--ink);
  background: #111827;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  background: #111827;
}

body[data-view="chat"] {
  height: 100dvh;
  overflow: hidden;
}

button,
input,
textarea {
  font: inherit;
}

button,
input,
textarea {
  outline: none;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  justify-content: center;
}

.app-frame {
  width: 100%;
  min-height: 100dvh;
  overflow: hidden;
  background: var(--page);
}

.screen {
  min-height: 100dvh;
}

.coze-header {
  color: #fff;
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-dark) 100%);
}

.picker-header {
  padding: max(28px, env(safe-area-inset-top)) 22px 26px;
}

.header-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.header-avatar,
.avatar {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: rgba(255, 255, 255, 0.18);
  font-size: 17px;
  font-weight: 900;
}

.header-row h1 {
  margin: 0;
  font-size: 25px;
  line-height: 1.18;
  font-weight: 950;
}

.header-row p {
  margin: 5px 0 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 14px;
}

.picker-main {
  padding: 16px 16px 20px;
}

.school-search {
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

.school-search:focus-within {
  border-color: color-mix(in srgb, var(--blue) 58%, white);
  box-shadow: 0 0 0 4px rgba(76, 134, 239, 0.12);
}

.search-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  position: relative;
  border: 2px solid #8791a2;
  border-radius: 50%;
}

.search-icon::after {
  content: "";
  position: absolute;
  right: -6px;
  bottom: -4px;
  width: 8px;
  height: 2px;
  border-radius: 999px;
  background: #8791a2;
  transform: rotate(45deg);
}

.school-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  color: var(--ink);
  background: transparent;
  font-size: 15px;
}

.school-search input::placeholder {
  color: #a0a7b4;
}

.result-count {
  color: #a0a7b4;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  font-weight: 900;
}

.school-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.school-button {
  min-height: 82px;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  color: var(--ink);
  background: #fff;
  text-align: left;
  cursor: pointer;
  transition:
    transform 0.16s ease,
    border-color 0.16s ease;
}

.school-button:active {
  transform: scale(0.985);
}

.school-button:hover,
.school-button:focus-visible {
  border-color: color-mix(in srgb, var(--blue) 45%, white);
}

.school-card-copy {
  min-width: 0;
}

.school-card-top {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #3f7ff0;
  font-size: 12px;
  font-weight: 900;
}

.school-code {
  color: #a0a7b4;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-weight: 900;
}

.school-name {
  display: block;
  margin-top: 3px;
  color: var(--ink);
  font-size: 16px;
  font-weight: 900;
  line-height: 1.24;
  overflow-wrap: anywhere;
}

.school-signature {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.school-tags {
  display: none;
}

.enter-pill {
  min-width: 44px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  padding: 0 10px;
  border-radius: 999px;
  color: #fff;
  background: var(--blue);
  font-size: 12px;
  font-weight: 900;
}

.empty-school-state,
.page-note {
  color: #8d96a6;
  font-size: 12px;
  text-align: center;
}

.empty-school-state {
  margin: 0;
  padding: 28px 0;
}

.page-note {
  padding: 0 18px max(18px, env(safe-area-inset-bottom));
  line-height: 1.6;
}

.school-logo {
  --logo-accent: var(--school-accent, var(--accent));
  width: 54px;
  aspect-ratio: 1;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  background: #fff;
  box-shadow:
    0 0 0 2px #fff,
    0 0 0 4px color-mix(in srgb, var(--logo-accent) 46%, transparent);
}

.school-logo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.logo-core {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--blue);
  font-weight: 900;
}

.logo-core small,
.logo-symbol {
  display: none;
}

.list-logo {
  width: 56px;
}

.mini-logo {
  width: 42px;
}

.large-logo {
  width: 54px;
}

.chat-screen {
  height: 100dvh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: 0;
  background: var(--page);
}

.chat-header {
  flex: 0 0 auto;
  min-height: 132px;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 40px;
  gap: 10px;
  align-items: start;
  padding: max(24px, env(safe-area-inset-top)) 18px 24px;
}

.back-button,
.clear-button {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 0;
  color: #fff;
  background: transparent;
  cursor: pointer;
}

.back-button span,
.clear-button span,
.composer button span {
  position: relative;
  display: block;
}

.back-button span {
  width: 22px;
  height: 22px;
}

.back-button span::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-left: 3px solid currentColor;
  border-bottom: 3px solid currentColor;
  transform: rotate(45deg);
}

.clear-button span {
  width: 22px;
  height: 22px;
}

.clear-button span::before,
.clear-button span::after {
  content: "";
  position: absolute;
  left: 2px;
  top: 10px;
  width: 18px;
  height: 3px;
  border-radius: 999px;
  background: currentColor;
}

.clear-button span::before {
  transform: rotate(45deg);
}

.clear-button span::after {
  transform: rotate(-45deg);
}

.school-pill {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.school-pill strong {
  display: block;
  max-width: 250px;
  overflow: hidden;
  color: #fff;
  font-size: 20px;
  font-weight: 950;
  line-height: 1.18;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.school-pill small {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.84);
  font-size: 14px;
}

.school-pill small i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #1f806e;
}

.chat-main {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  padding: 16px 18px 0;
}

.school-mini-card {
  display: none;
}

.chat-messages {
  flex: 1 1 auto;
  width: 100%;
  max-width: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-bottom: 14px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.chat-messages::-webkit-scrollbar {
  display: none;
}

.message-row {
  width: 100%;
  max-width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.message-row.user {
  flex-direction: row-reverse;
}

.avatar {
  background: var(--blue);
  font-size: 15px;
}

.message-content {
  width: fit-content;
  max-width: min(360px, calc(100% - 56px));
  min-width: 0;
}

.bubble {
  padding: 15px 16px;
  border: 1px solid #dfe4ec;
  border-radius: 18px;
  color: #111827;
  background: #fff;
  font-size: 16px;
  line-height: 1.72;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.message-row.user .bubble {
  border-color: var(--blue);
  color: #fff;
  background: var(--blue);
}

.copy-button {
  margin: 7px 0 0 4px;
  padding: 0;
  border: 0;
  color: #a2a9b5;
  background: transparent;
  font-size: 12px;
  cursor: pointer;
}

.message-row.user .copy-button {
  display: none;
}

.qr-dock {
  margin-left: 56px;
  width: calc(100% - 56px);
  max-width: calc(100% - 56px);
  padding: 12px;
  border: 1px solid #dfe6f2;
  border-radius: 20px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(244, 248, 255, 0.88)),
    #fff;
  box-shadow: 0 14px 34px rgba(24, 39, 75, 0.08);
}

.qr-dock-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.qr-dock-head strong {
  color: #1d2d4f;
  font-size: 14px;
  font-weight: 950;
}

.qr-dock-head span {
  color: #8b95a7;
  font-size: 11px;
}

.qr-dock-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.qr-count-1 .qr-dock-grid {
  grid-template-columns: 1fr;
}

.qr-card {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px;
  border: 1px solid #e2e8f3;
  border-radius: 16px;
  color: #23324f;
  background: #fff;
  text-align: left;
  cursor: pointer;
}

.qr-card img {
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  border-radius: 10px;
  object-fit: cover;
}

.qr-card b,
.qr-card small {
  display: block;
  min-width: 0;
}

.qr-card b {
  overflow: hidden;
  font-size: 12px;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qr-card small {
  margin-top: 2px;
  color: #8b95a7;
  font-size: 10px;
  line-height: 1.35;
}

.qr-preview {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 28px;
  background: rgba(9, 16, 31, 0.72);
  backdrop-filter: blur(10px);
}

.qr-preview button {
  position: absolute;
  top: 22px;
  right: 22px;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: rgba(255, 255, 255, 0.18);
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
}

.qr-preview img {
  max-width: min(78vw, 360px);
  max-height: 74vh;
  padding: 12px;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.35);
}

.typing::after {
  content: "";
  display: inline-block;
  width: 7px;
  height: 16px;
  margin-left: 3px;
  vertical-align: -2px;
  background: currentColor;
  animation: blink 0.8s infinite;
}

.chat-bottom-panel {
  flex: 0 0 auto;
  width: 100%;
  max-width: 100vw;
  overflow: hidden;
  padding: 10px 18px max(10px, env(safe-area-inset-bottom));
  background: var(--page);
}

.quick-section {
  padding: 0 0 8px;
}

.quick-grid {
  width: 100%;
  max-width: 100%;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.quick-button {
  min-width: 0;
  overflow: hidden;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 7px;
  border: 1px solid #dde3ee;
  border-radius: 999px;
  color: var(--blue);
  background: #fff;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.quick-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quick-icon {
  font-size: 13px;
  line-height: 1;
}

.service-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  padding-bottom: 10px;
}

.service-card {
  min-height: 72px;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid #dde3ee;
  border-radius: 16px;
  color: var(--ink);
  background: #fff;
  text-align: left;
  cursor: pointer;
}

.quick-button:disabled,
.service-card:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.service-icon {
  width: 36px;
  height: 36px;
  position: relative;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(135deg, #4c86ef, #7aa7ff);
}

.service-icon::before,
.service-icon::after {
  content: "";
  position: absolute;
  display: block;
}

.service-icon::before {
  width: 19px;
  height: 14px;
  border: 2px solid currentColor;
  border-radius: 6px;
}

.service-icon::after {
  right: 10px;
  bottom: 10px;
  width: 7px;
  height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
}

.service-copy {
  min-width: 0;
}

.service-title {
  display: block;
  color: #22304a;
  font-size: 15px;
  font-weight: 900;
  line-height: 1.35;
}

.service-copy small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.service-arrow {
  position: relative;
  display: block;
  width: 14px;
  height: 14px;
}

.service-arrow::before {
  content: "";
  position: absolute;
  inset: 2px;
  border-top: 3px solid #a6afbd;
  border-right: 3px solid #a6afbd;
  transform: rotate(45deg);
}

.composer-wrap {
  width: 100%;
  padding: 0;
  background: transparent;
}

.composer {
  min-height: 56px;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 8px 8px 8px 16px;
  border: 1px solid #dde3ee;
  border-radius: 999px;
  background: #fff;
}

.composer textarea {
  flex: 1;
  max-height: 118px;
  min-height: 38px;
  resize: none;
  overflow-y: auto;
  border: 0;
  color: var(--ink);
  background: transparent;
  font-size: 15px;
  line-height: 1.5;
  padding: 8px 0 0;
}

.composer textarea::placeholder {
  color: #9ba4b3;
}

.composer button {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: #9fc1fa;
  cursor: pointer;
}

.composer button span {
  width: 20px;
  height: 20px;
}

.composer button span::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 9px;
  width: 15px;
  height: 3px;
  border-radius: 999px;
  background: currentColor;
  transform: rotate(-28deg);
}

.composer button span::after {
  content: "";
  position: absolute;
  right: 2px;
  top: 3px;
  width: 11px;
  height: 11px;
  border-top: 3px solid currentColor;
  border-right: 3px solid currentColor;
  transform: rotate(18deg);
}

.composer button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.disclaimer {
  padding: 9px 10px 0;
  color: #8f98a8;
  font-size: 12px;
  line-height: 1.45;
  text-align: center;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

@media (min-width: 720px) {
  .app-shell {
    padding: 24px;
    align-items: flex-start;
  }

  .app-frame {
    width: min(100%, 430px);
    min-height: calc(100vh - 48px);
    border-radius: 28px;
    box-shadow: 0 28px 72px rgba(0, 0, 0, 0.28);
  }

  .screen {
    min-height: calc(100vh - 48px);
  }

  .chat-screen {
    height: calc(100vh - 48px);
    min-height: calc(100vh - 48px);
  }

  .chat-bottom-panel {
    border-radius: 0 0 28px 28px;
  }
}

@media (max-width: 370px) {
  .school-button {
    grid-template-columns: 54px minmax(0, 1fr);
  }

  .enter-pill {
    display: none;
  }

  .school-pill strong {
    max-width: 190px;
    font-size: 17px;
  }
}

@media (max-width: 480px) {
  .quick-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .qr-dock-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }
}
