/*
代码介绍：
  这是“教师助手（Father's Edition）”网页样式文件，负责首页布局、视觉资产、任务入口、聊天气泡和响应式适配。
使用说明：
  由 static/index.html 自动引用；无需单独运行。
参数说明：
  本文件无命令行 arg；颜色和尺寸通过 CSS 变量在 :root 中配置。
*/
:root {
  color-scheme: light;
  --paper: #f8f5ee;
  --surface: #fffdf8;
  --surface-strong: #ffffff;
  --ink: #20242a;
  --muted: #65717f;
  --line: #ded6c7;
  --green: #286b5a;
  --green-dark: #1c4f43;
  --blue: #315f8c;
  --gold: #b7892f;
  --wine: #8b3f4d;
  --user-bubble: #e8f0f7;
  --assistant-bubble: #fff6df;
  --shadow: 0 18px 48px rgba(44, 37, 28, 0.14);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui,
    sans-serif;
  color: var(--ink);
  background:
    linear-gradient(115deg, rgba(49, 95, 140, 0.12), transparent 38%),
    linear-gradient(245deg, rgba(183, 137, 47, 0.16), transparent 42%),
    var(--paper);
  letter-spacing: 0;
}

button,
textarea,
input {
  font: inherit;
}

button {
  border: 0;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(420px, 1.1fr);
  gap: 24px;
  padding: 28px;
}

.intro-panel,
.chat-panel {
  min-width: 0;
}

.intro-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 24px;
  padding: 18px 12px 18px 4px;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-mark {
  width: 112px;
  height: 112px;
  flex: 0 0 112px;
  object-fit: contain;
  filter: drop-shadow(0 12px 20px rgba(56, 42, 22, 0.16));
}

.edition {
  margin: 0 0 8px;
  color: var(--wine);
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 42px;
  line-height: 1.1;
  font-weight: 850;
}

.welcome-copy {
  display: grid;
  gap: 10px;
}

.professor-line {
  margin: 0;
  color: var(--green-dark);
  font-size: 24px;
  line-height: 1.35;
  font-weight: 760;
}

.today-line {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
}

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

.task-chip {
  min-height: 58px;
  display: grid;
  grid-template-columns: 30px 1fr;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(40, 107, 90, 0.18);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 253, 248, 0.76);
  box-shadow: 0 8px 20px rgba(44, 37, 28, 0.07);
  cursor: pointer;
  text-align: left;
  line-height: 1.35;
}

.task-chip:hover,
.task-chip:focus-visible {
  outline: none;
  border-color: rgba(40, 107, 90, 0.44);
  background: #ffffff;
}

.task-chip span:first-child {
  font-size: 22px;
  line-height: 1;
}

.task-chip span:last-child {
  overflow-wrap: anywhere;
  font-size: 14px;
  font-weight: 720;
}

.holiday-note {
  margin: 0;
  padding-left: 14px;
  border-left: 4px solid var(--gold);
  color: #4d4438;
  font-size: 17px;
  line-height: 1.7;
}

.chat-panel {
  height: calc(100vh - 56px);
  min-height: 640px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.94);
  box-shadow: var(--shadow);
}

.chat-header {
  min-height: 72px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(40, 107, 90, 0.12), rgba(49, 95, 140, 0.1));
}

.assistant-name {
  margin: 0 0 5px;
  color: var(--green-dark);
  font-size: 18px;
  line-height: 1.3;
  font-weight: 780;
}

#modelLine {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.messages {
  overflow-y: auto;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background:
    linear-gradient(rgba(255, 253, 248, 0.82), rgba(255, 253, 248, 0.82)),
    repeating-linear-gradient(
      0deg,
      rgba(49, 95, 140, 0.045),
      rgba(49, 95, 140, 0.045) 1px,
      transparent 1px,
      transparent 34px
    );
}

.access-panel {
  display: grid;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: #fff4d9;
}

.access-panel[hidden] {
  display: none;
}

.access-copy {
  display: grid;
  gap: 3px;
}

.access-panel label {
  color: var(--green-dark);
  font-size: 15px;
  font-weight: 760;
}

.access-hint,
#accessHint {
  margin: 0;
  color: #6c5941;
  font-size: 12px;
  line-height: 1.35;
}

.access-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

input {
  min-width: 0;
  border: 1px solid #cfc6b7;
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--ink);
  background: #ffffff;
  outline: none;
}

input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(40, 107, 90, 0.14);
}

.access-button {
  min-height: 42px;
  border-radius: 8px;
  padding: 0 14px;
  color: #ffffff;
  background: var(--blue);
  cursor: pointer;
  font-weight: 760;
}

.message {
  max-width: min(720px, 88%);
  display: grid;
  gap: 6px;
}

.message.user {
  align-self: flex-end;
}

.message.assistant {
  align-self: flex-start;
}

.message-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.role {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.message.user .role,
.message.user .message-actions {
  text-align: right;
}

.message-actions {
  min-height: 22px;
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 5px;
}

.mini-action {
  border-radius: 8px;
  padding: 4px 7px;
  color: var(--blue);
  background: rgba(237, 241, 242, 0.88);
  cursor: pointer;
  font-size: 11px;
  font-weight: 760;
  line-height: 1.2;
}

.mini-action:hover,
.mini-action:focus-visible {
  outline: none;
  background: #e4eaec;
}

.bubble {
  border: 1px solid rgba(101, 113, 127, 0.18);
  border-radius: 8px;
  padding: 13px 15px;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  box-shadow: 0 7px 18px rgba(32, 36, 42, 0.07);
}

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

.message.assistant .bubble {
  background: var(--assistant-bubble);
}

.bubble.markdown {
  white-space: normal;
}

.bubble.markdown p,
.bubble.markdown ul,
.bubble.markdown ol,
.bubble.markdown pre,
.bubble.markdown blockquote {
  margin: 0 0 12px;
}

.bubble.markdown :last-child {
  margin-bottom: 0;
}

.bubble.markdown h2,
.bubble.markdown h3,
.bubble.markdown h4 {
  margin: 12px 0 8px;
  color: var(--green-dark);
  line-height: 1.35;
  font-weight: 820;
}

.bubble.markdown h2:first-child,
.bubble.markdown h3:first-child,
.bubble.markdown h4:first-child {
  margin-top: 0;
}

.bubble.markdown h2 {
  font-size: 19px;
}

.bubble.markdown h3 {
  font-size: 17px;
}

.bubble.markdown h4 {
  font-size: 15px;
}

.bubble.markdown p {
  white-space: pre-wrap;
}

.bubble.markdown strong {
  font-weight: 820;
}

.bubble.markdown ul,
.bubble.markdown ol {
  padding-left: 22px;
}

.bubble.markdown li {
  margin: 4px 0;
  padding-left: 2px;
}

.bubble.markdown code {
  border-radius: 6px;
  padding: 1px 5px;
  color: #193b56;
  background: rgba(49, 95, 140, 0.12);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.92em;
}

.bubble.markdown pre {
  overflow-x: auto;
  border: 1px solid rgba(49, 95, 140, 0.18);
  border-radius: 8px;
  padding: 10px 12px;
  background: #f7faf9;
}

.bubble.markdown pre code {
  display: block;
  padding: 0;
  color: var(--ink);
  background: transparent;
  white-space: pre;
}

.bubble.markdown blockquote {
  border-left: 4px solid rgba(183, 137, 47, 0.55);
  padding-left: 12px;
  color: #4d4438;
}

.bubble.markdown hr {
  height: 1px;
  margin: 14px 0;
  border: 0;
  background: rgba(101, 113, 127, 0.22);
}

.composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 16px;
  border-top: 1px solid var(--line);
  background: var(--surface-strong);
}

.composer-main {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.attachment-bar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.attach-button {
  flex: 0 0 auto;
  border-radius: 8px;
  padding: 8px 11px;
  color: var(--blue);
  background: #edf1f2;
  font-size: 13px;
  font-weight: 760;
  cursor: pointer;
}

.attach-button:hover {
  background: #e4eaec;
}

.attachment-status {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.attachment-list {
  display: grid;
  gap: 6px;
}

.attachment-list[hidden] {
  display: none;
}

.attachment-item {
  min-width: 0;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(49, 95, 140, 0.18);
  border-radius: 8px;
  padding: 8px 9px;
  color: var(--ink);
  background: #f7faf9;
  font-size: 12px;
  line-height: 1.35;
}

.attachment-item span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.attachment-remove {
  border-radius: 8px;
  padding: 6px 8px;
  color: var(--wine);
  background: #f5ecec;
  cursor: pointer;
  font-size: 12px;
  font-weight: 760;
}

textarea {
  width: 100%;
  min-height: 56px;
  max-height: 180px;
  resize: vertical;
  border: 1px solid #cfc6b7;
  border-radius: 8px;
  padding: 12px 13px;
  color: var(--ink);
  background: #ffffff;
  outline: none;
  line-height: 1.5;
}

textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(40, 107, 90, 0.14);
}

.composer-actions {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.icon-button,
.send-button {
  min-height: 46px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 760;
  white-space: nowrap;
}

.icon-button {
  width: 46px;
  color: var(--blue);
  background: #edf1f2;
  font-size: 21px;
}

.send-button {
  min-width: 88px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  color: #ffffff;
  background: var(--green);
}

.send-button:hover:not(:disabled) {
  background: var(--green-dark);
}

.icon-button:hover:not(:disabled) {
  background: #e4eaec;
}

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

.composer-locked {
  opacity: 0.72;
}

.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: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    min-height: 100dvh;
    padding: 20px;
  }

  .intro-panel {
    justify-content: flex-start;
    gap: 16px;
    padding: 4px 0 0;
  }

  .chat-panel {
    height: min(720px, 72dvh);
    min-height: 560px;
  }

  .task-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  html,
  body {
    min-height: 100dvh;
  }

  .app-shell {
    min-height: 100dvh;
    height: 100dvh;
    gap: 8px;
    padding: 10px;
    overflow: hidden;
  }

  .intro-panel {
    gap: 8px;
    padding: 0;
  }

  .brand-row {
    align-items: center;
    gap: 10px;
  }

  .brand-mark {
    width: 48px;
    height: 48px;
    flex-basis: 48px;
  }

  .edition {
    margin-bottom: 3px;
    font-size: 11px;
  }

  h1 {
    font-size: 25px;
  }

  .welcome-copy {
    gap: 4px;
  }

  .professor-line {
    font-size: 16px;
  }

  .today-line {
    display: none;
  }

  .task-grid {
    display: flex;
    gap: 7px;
    margin-inline: -10px;
    padding: 0 10px 2px;
    overflow-x: auto;
    scrollbar-width: thin;
  }

  .task-chip {
    min-width: 150px;
    min-height: 40px;
    padding: 8px;
    grid-template-columns: 20px 1fr;
    gap: 7px;
  }

  .task-chip span:first-child {
    font-size: 16px;
  }

  .task-chip span:last-child {
    font-size: 12px;
  }

  .holiday-note {
    display: none;
  }

  .chat-panel {
    height: auto;
    min-height: 0;
  }

  .chat-header {
    display: none;
  }

  .composer {
    grid-template-columns: 1fr;
    gap: 7px;
    padding: 9px;
  }

  .composer-main {
    gap: 6px;
  }

  .messages {
    gap: 12px;
    padding: 13px;
  }

  .message {
    max-width: 94%;
  }

  .bubble {
    padding: 11px 12px;
    font-size: 14px;
    line-height: 1.58;
  }

  .access-row {
    grid-template-columns: 1fr;
  }

  .access-panel {
    gap: 8px;
    padding: 12px;
  }

  .access-button {
    min-height: 38px;
  }

  .attachment-bar {
    align-items: center;
    flex-direction: row;
  }

  .attachment-status {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .attachment-item {
    grid-template-columns: 1fr;
  }

  .composer-actions {
    display: grid;
    grid-template-columns: 42px 1fr;
    align-items: center;
    height: 44px;
    max-height: 44px;
  }

  .send-button {
    height: 44px;
    min-height: 0;
    min-width: 0;
    align-self: center;
  }

  textarea {
    height: 64px;
    min-height: 0;
    max-height: 120px;
    resize: none;
    font-size: 16px;
    padding: 10px 11px;
  }

  .icon-button,
  .send-button {
    min-height: 0;
    max-height: 44px;
  }

  .icon-button {
    height: 44px;
    width: 42px;
    align-self: center;
  }
}

@media (max-width: 380px) {
  .task-chip {
    min-width: 138px;
  }
}
