:root {
  color-scheme: light;
  --ink: #243044;
  --muted: #6f7787;
  --paper: #fffaf0;
  --line: #27324a;
  --sky: #c8efff;
  --mint: #bdf4d2;
  --peach: #ffd2b8;
  --sun: #ffe277;
  --rose: #ff9fbc;
  --blue: #7cb7ff;
  --violet: #c9b8ff;
  --shadow: 8px 8px 0 #27324a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family:
    Inter, "Segoe UI", "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  background:
    radial-gradient(circle at 12% 18%, rgba(255, 226, 119, 0.55) 0 7rem, transparent 7.2rem),
    radial-gradient(circle at 88% 10%, rgba(189, 244, 210, 0.65) 0 8rem, transparent 8.2rem),
    linear-gradient(135deg, #fff7cf 0%, #d7f3ff 48%, #ffe0ec 100%);
}

button,
textarea,
select,
input {
  font: inherit;
}

button {
  border: 2px solid var(--line);
  border-radius: 8px;
  color: var(--line);
  cursor: pointer;
  font-weight: 900;
}

button:disabled {
  cursor: wait;
  opacity: 0.68;
}

button:not(:disabled):active {
  transform: translate(3px, 3px);
  box-shadow: 1px 1px 0 var(--line);
}

.workspace {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 28px;
}

.eyebrow,
.panel-kicker {
  margin: 0 0 6px;
  color: #d15078;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 4vw, 3.8rem);
  line-height: 1;
}

h2 {
  margin-bottom: 0;
  font-size: 1.35rem;
}

.status-pill {
  flex: 0 0 auto;
  min-width: 96px;
  padding: 10px 14px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--mint);
  box-shadow: 4px 4px 0 var(--line);
  font-weight: 800;
  text-align: center;
}

.home-view,
.tool-view {
  min-height: calc(100vh - 158px);
}

.is-hidden {
  display: none;
}

.launcher-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 22px;
  align-items: stretch;
}

.app-icon {
  min-height: 170px;
  padding: 18px 14px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 10px;
  background: rgba(255, 250, 240, 0.94);
  box-shadow: var(--shadow);
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

.app-icon:nth-child(2) {
  background: #d8f6dd;
}

.app-icon:nth-child(3) {
  background: #ffd7c8;
}

.app-icon:nth-child(4) {
  background: #d9e5ff;
}

.app-icon:nth-child(5) {
  background: #f2dcff;
}

.app-icon:nth-child(6) {
  background: #fff0ba;
}

.app-icon:hover,
.app-icon:focus-visible {
  transform: translate(-2px, -2px);
  box-shadow: 10px 10px 0 var(--line);
  outline: none;
}

.app-icon-active {
  background: linear-gradient(160deg, #fff8c9, #c8efff);
}

.icon-title {
  font-size: 1.04rem;
}

.icon-subtitle {
  min-height: 20px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.icon-face,
.icon-symbol,
.mini-bot {
  position: relative;
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border: 3px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 5px 5px 0 var(--line);
}

.icon-face {
  background: var(--sky);
}

.icon-face::before,
.icon-face::after,
.mini-bot::before,
.mini-bot::after {
  content: "";
  position: absolute;
  top: -11px;
  width: 13px;
  height: 13px;
  border: 3px solid var(--line);
  border-radius: 50%;
  background: var(--rose);
}

.icon-face::before,
.mini-bot::before {
  left: 10px;
}

.icon-face::after,
.mini-bot::after {
  right: 10px;
}

.icon-eye {
  position: absolute;
  top: 25px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--line);
}

.icon-eye:first-child {
  left: 22px;
}

.icon-eye:nth-child(2) {
  right: 22px;
}

.icon-mouth {
  position: absolute;
  left: 26px;
  top: 40px;
  width: 20px;
  height: 9px;
  border-bottom: 3px solid var(--line);
  border-radius: 0 0 14px 14px;
}

.icon-symbol {
  color: #d15078;
  font-size: 1.6rem;
  font-weight: 900;
}

.tool-panel {
  min-height: calc(100vh - 158px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 3px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 240, 0.94);
  box-shadow: var(--shadow);
}

.tool-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 18px;
  border-bottom: 3px solid var(--line);
  background: linear-gradient(90deg, var(--sun), var(--peach));
}

.back-button,
.send-button {
  min-width: 96px;
  min-height: 46px;
  background: var(--rose);
  box-shadow: 4px 4px 0 var(--line);
}

.back-button {
  background: #ffffff;
}

.mini-bot {
  width: 58px;
  height: 46px;
  flex: 0 0 auto;
  background: var(--sky);
}

.mini-bot .icon-eye {
  top: 15px;
  width: 7px;
  height: 7px;
}

.mini-bot .icon-eye:first-child {
  left: 17px;
}

.mini-bot .icon-eye:nth-child(2) {
  right: 17px;
}

.mini-bot .icon-mouth {
  left: 21px;
  top: 25px;
  width: 16px;
  height: 8px;
}

.header-symbol {
  width: 58px;
  height: 46px;
  background: #ffffff;
  color: #d15078;
  font-size: 1.35rem;
}

.chat-log {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 18px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.62) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.62) 1px, transparent 1px),
    #fffdf6;
  background-size: 28px 28px;
}

.message {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  margin-bottom: 14px;
}

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

.avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: var(--sun);
  color: var(--line);
  font-size: 0.76rem;
  font-weight: 900;
}

.message.user .avatar {
  background: var(--blue);
}

.bubble {
  max-width: min(76%, 640px);
  padding: 12px 14px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 3px 3px 0 var(--line);
  line-height: 1.58;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.message.user .bubble {
  background: #dff2ff;
}

.message.error .bubble {
  background: #ffe0e8;
}

.composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 16px;
  border-top: 3px solid var(--line);
  background: #fff0ba;
}

textarea {
  width: 100%;
  min-height: 56px;
  max-height: 150px;
  resize: vertical;
  border: 2px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: #fffdf8;
  color: var(--ink);
  outline: none;
  box-shadow: inset 3px 3px 0 rgba(39, 50, 74, 0.12);
}

textarea:focus {
  border-color: #d15078;
}

.image-panel,
.tts-panel,
.vision-panel,
.asr-panel,
.rerank-panel,
.audio-panel,
.math-panel {
  min-height: calc(100vh - 158px);
}

.image-workbench,
.tts-workbench,
.vision-workbench,
.asr-workbench,
.rerank-workbench,
.audio-analysis-workbench,
.math-workbench {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(260px, 0.82fr) minmax(320px, 1.18fr);
  gap: 18px;
  padding: 18px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.62) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.62) 1px, transparent 1px),
    #fffdf6;
  background-size: 28px 28px;
}

.image-form,
.tts-form,
.vision-form,
.asr-form,
.rerank-form,
.audio-analysis-form,
.math-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-self: stretch;
  padding: 16px;
  border: 3px solid var(--line);
  border-radius: 8px;
  background: #fff0ba;
  box-shadow: 5px 5px 0 var(--line);
}

.image-form label,
.tts-form label,
.vision-form label,
.asr-form label,
.rerank-form label,
.audio-analysis-form label,
.math-form label {
  font-weight: 900;
}

.image-form textarea,
.tts-form textarea,
.vision-form textarea {
  min-height: 190px;
  resize: vertical;
}

.vision-form textarea {
  min-height: 120px;
}

.rerank-form textarea {
  min-height: 120px;
}

#rerankDocumentsInput {
  min-height: 240px;
}

.audio-analysis-form textarea,
.math-form textarea {
  min-height: 150px;
}

.control-row {
  display: grid;
  gap: 8px;
}

select,
input[type="file"] {
  width: 100%;
  min-height: 46px;
  border: 2px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #fffdf8;
  color: var(--ink);
  box-shadow: inset 3px 3px 0 rgba(39, 50, 74, 0.12);
}

select:focus,
input[type="file"]:focus {
  border-color: #d15078;
  outline: none;
}

.math-form input[type="file"] {
  background: #fffdf8;
}

.form-note {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.image-preview,
.audio-preview,
.uploaded-preview,
.vision-result {
  min-height: 430px;
  display: grid;
  place-items: center;
  padding: 18px;
  border: 3px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 5px 5px 0 var(--line);
}

.vision-preview {
  display: grid;
  grid-template-rows: minmax(220px, 0.82fr) minmax(280px, 1fr);
  gap: 18px;
}

.uploaded-preview {
  min-height: 220px;
  overflow: hidden;
}

.vision-result {
  min-height: 280px;
  align-items: stretch;
}

.preview-empty {
  display: grid;
  justify-items: center;
  gap: 12px;
  color: var(--muted);
  font-weight: 900;
  text-align: center;
}

.preview-empty p {
  margin-bottom: 0;
  overflow-wrap: anywhere;
}

.preview-error .icon-symbol {
  color: #d15078;
  background: #ffe0e8;
}

.generated-figure {
  width: 100%;
  margin: 0;
  display: grid;
  gap: 12px;
}

.generated-image {
  width: 100%;
  max-height: min(62vh, 720px);
  object-fit: contain;
  border: 3px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.uploaded-image {
  width: 100%;
  max-height: 320px;
  object-fit: contain;
  border: 3px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.generated-figure figcaption {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.result-card {
  width: 100%;
  min-height: 100%;
  padding: 16px;
  border: 3px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  color: var(--ink);
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.audio-card {
  width: min(100%, 640px);
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 3px solid var(--line);
  border-radius: 8px;
  background: #fff0ba;
  box-shadow: 5px 5px 0 var(--line);
}

.audio-card audio {
  width: 100%;
}

.audio-card p {
  margin-bottom: 0;
  color: var(--muted);
  font-weight: 800;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.record-stage {
  display: grid;
  justify-items: center;
  gap: 14px;
  padding: 22px;
  border: 3px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.asr-form input[type="file"] {
  background: #fffdf8;
}

.record-button {
  width: min(100%, 280px);
  min-height: 86px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: var(--rose);
  box-shadow: 5px 5px 0 var(--line);
  font-size: 1.1rem;
}

.record-button.is-recording {
  background: #ffd2b8;
}

.record-dot {
  width: 16px;
  height: 16px;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: #d15078;
}

.record-button.is-recording .record-dot {
  animation: pulse 900ms infinite;
}

.record-time {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.3rem;
  font-weight: 900;
}

.asr-result-grid {
  display: grid;
  grid-template-rows: 1fr 1fr;
  gap: 18px;
  min-height: 430px;
}

.asr-card {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 10px;
  min-height: 0;
}

.asr-card h3 {
  margin: 0;
  font-size: 1rem;
}

.asr-card .result-card {
  overflow-y: auto;
}

.rerank-results,
.audio-player-card,
.math-result {
  min-height: 430px;
  padding: 18px;
  border: 3px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 5px 5px 0 var(--line);
}

.audio-analysis-results {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 18px;
  min-height: 430px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.audio-player-card {
  min-height: 160px;
  padding: 18px;
}

#audioAnalysisResult {
  min-height: 260px;
  overflow-y: auto;
}

.rank-list {
  display: grid;
  gap: 14px;
}

.rank-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 3px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
}

.rank-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #d15078;
  font-weight: 900;
}

.rank-card p {
  margin-bottom: 0;
  line-height: 1.58;
  overflow-wrap: anywhere;
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.28);
  }
  100% {
    transform: scale(1);
  }
}

.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: 760px) {
  .workspace {
    width: min(100% - 20px, 1180px);
    padding: 18px 0;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .launcher-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }

  .app-icon {
    min-height: 148px;
    padding: 14px 10px;
  }

  .tool-header {
    grid-template-columns: 1fr auto;
  }

  .tool-header .back-button {
    grid-column: 1 / -1;
    justify-self: start;
  }

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

  .image-workbench,
  .tts-workbench,
  .vision-workbench,
  .asr-workbench,
  .rerank-workbench,
  .audio-analysis-workbench,
  .math-workbench {
    grid-template-columns: 1fr;
  }

  .image-preview,
  .audio-preview,
  .uploaded-preview,
  .vision-result {
    min-height: 320px;
  }

  .send-button {
    min-height: 48px;
  }

  .bubble {
    max-width: calc(100% - 46px);
  }
}

@media (max-width: 420px) {
  .launcher-grid {
    grid-template-columns: 1fr;
  }
}
