:root {
  --bg: #f3f6f4;
  --card: #ffffff;
  --ink: #1c2a21;
  --subtle: #5f6f64;
  --brand: #1f7a45;
  --danger: #b42318;
  --line: #dbe6dd;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 10% 10%, #e6f3e8 0, var(--bg) 45%);
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px;
}

.studio-container {
  padding-bottom: 250px;
}

.narrow {
  max-width: 680px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 14px;
}

.stat {
  margin: 6px 0;
}

.token-box,
.inline-input {
  display: flex;
  gap: 8px;
}

input,
textarea,
button {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  font-size: 14px;
}

button {
  cursor: pointer;
  background: var(--brand);
  color: #fff;
  border: none;
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.layout {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 14px;
}

.studio-layout {
  grid-template-columns: 1fr;
}

.admin-layout {
  grid-template-columns: 1fr 1fr;
}

.admin-nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tab-btn {
  width: auto;
  padding: 8px 14px;
  background: #6b7b71;
}

.tab-btn.active {
  background: var(--brand);
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}

.modal-content {
  width: min(680px, 100%);
  background: #fff;
  border-radius: 12px;
  padding: 14px;
}

.modal-content pre {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  background: #f6faf7;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  max-height: 55vh;
  overflow: auto;
}

.corpus-panel {
  max-height: none;
  overflow: visible;
}

.corpus-group {
  margin-bottom: 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 8px;
}

.corpus-group summary {
  cursor: pointer;
  font-weight: 600;
}

.item {
  display: block;
  width: 100%;
  text-align: left;
  margin-top: 6px;
  background: #edf7f0;
  color: var(--ink);
}

.item.done {
  background: #d9efe1;
}

.studio-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.studio-top-row #userInfo {
  margin: 0;
}

.studio-top-row #viewNoticeBtn {
  margin-left: auto;
  width: auto;
  flex: 0 0 auto;
}

.msg {
  min-height: 20px;
  color: var(--subtle);
}

#playerCard {
  margin-top: 12px;
}

#audioPlayer {
  display: none;
}

.fixed-bottom {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  width: min(1100px, calc(100% - 24px));
  margin: 0 auto;
  border-radius: 14px 14px 0 0;
  z-index: 20;
  box-shadow: 0 -8px 20px rgba(0, 0, 0, 0.08);
}

.work-main {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: stretch;
}

.work-text {
  flex: 1;
  min-width: 0;
}

.work-text h2 {
  margin: 0 0 2px 0;
  font-size: 16px;
}

.work-text p {
  margin: 4px 0;
  font-size: 14px;
  line-height: 1.25;
}

.round-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-items: stretch;
  justify-content: stretch;
  margin-top: 2px;
}

.round-btn {
  width: 100%;
  height: 46px;
  border-radius: 10px;
  padding: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 13px;
  text-align: center;
  line-height: 1.2;
}

.round-btn#playPauseBtn {
  background: #0f766e;
}

.quality-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}

.quality-grid label {
  font-size: 12px;
  color: var(--subtle);
}

.msg.error {
  color: var(--danger);
}

.footer {
  text-align: center;
  color: var(--subtle);
}

.admin-entry {
  margin-top: 12px;
  text-align: right;
}

.admin-entry a {
  color: #9aa89f;
  text-decoration: none;
  font-size: 12px;
}

.user-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  margin-top: 8px;
}

.user-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.user-actions button.copy {
  background: #0f766e;
}

.user-actions button.edit {
  background: #365ebf;
}

.user-actions button.delete {
  background: #b42318;
}

.corpus-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

#bulkDeleteCorpusBtn.delete {
  width: auto;
  min-width: 140px;
  background: #b42318;
}

#bulkDeleteCorpusBtn.delete:disabled {
  background: #d6948f;
  opacity: 1;
}

.corpus-row {
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.corpus-row:hover {
  background: #f8faf8;
}

.corpus-row.selected {
  background: #fdecea;
  border-color: #e07a73;
}

@media (max-width: 900px) {
  .layout,
  .admin-layout {
    grid-template-columns: 1fr;
  }

  .studio-container {
    padding-bottom: 360px;
  }

  .work-main {
    align-items: stretch;
    flex-direction: column;
    gap: 6px;
  }

  .round-actions {
    width: 100%;
    grid-template-columns: 1fr 1fr;
  }

  .round-btn {
    width: 100%;
    height: 44px;
  }

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