* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #2F5496;
  --primary-light: #D6E4F0;
  --accent: #C00;
  --bg: #f5f7fa;
  --white: #fff;
  --text: #333;
  --text-light: #666;
  --border: #e0e7f1;
  --radius: 8px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/* ========== 顶部栏 ========== */
.header {
  background: var(--primary);
  color: var(--white);
  padding: 14px 20px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.header h1 {
  font-size: 20px;
}

.btn-add-player {
  padding: 6px 14px;
  border: 1px solid rgba(255,255,255,0.5);
  border-radius: var(--radius);
  background: rgba(255,255,255,0.15);
  color: var(--white);
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
  transition: background 0.2s;
}

.btn-add-player:active {
  background: rgba(255,255,255,0.3);
}

.player-bar select {
  width: 100%;
  padding: 8px 12px;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  background: var(--white);
  color: var(--text);
}

/* ========== 按钮 ========== */
.btn {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--primary);
  color: var(--white);
  border-color: var(--primary);
}

.btn-primary:active { background: #244278; }

.btn-sm {
  padding: 6px 12px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  color: var(--primary);
}

.btn-sm:active { background: var(--primary-light); }

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 15px;
  padding: 4px;
  border-radius: 4px;
}

.btn-icon:active { background: var(--primary-light); }

/* ========== 主内容 ========== */
.main {
  padding: 16px;
  max-width: 1100px;
  margin: 0 auto;
}

/* ========== 操作栏 ========== */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
}

.filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  flex: 1;
}

.tag {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--white);
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
  white-space: nowrap;
}

.tag.active {
  background: var(--primary);
  color: var(--white);
  border-color: var(--primary);
}

.tag:active { transform: scale(0.95); }

.toolbar-right {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

.view-switcher {
  display: flex;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.btn-view {
  width: 34px;
  height: 34px;
  border: none;
  border-right: 1px solid var(--border);
  background: var(--white);
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.btn-view:last-child { border-right: none; }

.btn-view.active {
  background: var(--primary);
}

.btn-view:active { background: var(--primary-light); }

/* ========== 日期分组 ========== */
.day-group {
  margin-bottom: 24px;
}

.day-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.day-date {
  font-size: 17px;
  font-weight: 700;
  color: var(--primary);
}

.day-count {
  font-size: 13px;
  color: var(--text-light);
  background: var(--primary-light);
  padding: 2px 10px;
  border-radius: 10px;
}

/* ========== 表格视图（电脑端） ========== */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.diary-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: 14px;
  line-height: 1.8;
}

.diary-table thead th {
  background: var(--primary);
  color: var(--white);
  padding: 12px;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
}

.diary-table tbody td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.diary-table tbody tr:last-child td {
  border-bottom: none;
}

.diary-table tbody tr:hover td {
  background: #f0f4fa;
}

.diary-table tbody tr:hover .cell-skill {
  background: #c5d7ed;
}

.col-skill { width: 70px; }
.col-content { width: 18%; }
.col-problems { width: 25%; }
.col-improvements { width: 25%; }
.col-motto { width: 110px; }
.col-actions { width: 70px; }

.cell-skill {
  background: var(--primary-light);
  font-weight: 700;
  color: var(--primary);
  text-align: center;
  vertical-align: middle !important;
  font-size: 15px;
}

.cell-motto {
  text-align: center;
  vertical-align: middle !important;
  font-weight: 600;
  color: var(--primary);
  font-size: 13px;
  line-height: 1.6;
}

.cell-actions {
  text-align: center;
  vertical-align: middle !important;
  white-space: nowrap;
}

/* 问题和改进条目 */
.problem-item, .improvement-item {
  padding: 2px 0;
  font-size: 14px;
}

.problem-item.resolved span {
  text-decoration: line-through;
  color: var(--text-light);
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  margin-top: 4px;
  accent-color: var(--primary);
}

.improvement-item::before {
  content: "• ";
  color: var(--primary);
  font-weight: bold;
}

/* 卡片视图 */
.card-view { }

/* ========== 移动端卡片样式 ========== */
.diary-card {
  background: var(--white);
  border-radius: var(--radius);
  margin-bottom: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  background: var(--primary-light);
  gap: 8px;
}

.card-skill {
  background: var(--primary);
  color: var(--white);
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}

.card-content-brief {
  font-size: 13px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.card-actions {
  margin-left: auto;
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}

.card-body { padding: 0; }

.card-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  line-height: 1.7;
}

.card-table th {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
  padding: 6px 10px;
  text-align: center;
  width: 50px;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}

.card-table td {
  padding: 6px 10px;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}

.card-table tr:last-child th,
.card-table tr:last-child td {
  border-bottom: none;
}

.cell-motto-mobile {
  font-weight: 600;
  color: var(--primary);
}

/* ========== 风格2: 详细卡片 ========== */
.detail-body {
  padding: 14px !important;
}

.detail-section {
  margin-bottom: 12px;
}

.detail-section h4 {
  font-size: 13px;
  color: var(--primary);
  margin-bottom: 4px;
  font-weight: 600;
}

.detail-section p {
  font-size: 14px;
}

.detail-motto {
  background: #fff8e1;
  border-left: 3px solid #f5a623;
  padding: 8px 12px;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 13px;
}

.detail-motto strong {
  color: var(--accent);
}

/* ========== 风格3: 极简卡片 ========== */
.minimal-card {
  display: flex;
  align-items: center;
  background: var(--white);
  border-radius: var(--radius);
  margin-bottom: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  padding: 10px 12px;
  gap: 12px;
}

.minimal-left {
  flex-shrink: 0;
}

.minimal-center {
  flex: 1;
  min-width: 0;
}

.minimal-motto {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
  line-height: 1.4;
}

.minimal-meta {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

.minimal-tag {
  font-size: 11px;
  padding: 1px 8px;
  border-radius: 10px;
}

.minimal-tag.problems {
  background: #fff0f0;
  color: var(--accent);
}

.minimal-tag.resolved {
  background: #f0fff0;
  color: #2a8;
}

.minimal-right {
  flex-shrink: 0;
  display: flex;
  gap: 2px;
}

/* ========== 表单 ========== */
.diary-form {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  max-width: 600px;
}

.diary-form h3 {
  margin-bottom: 16px;
  color: var(--primary);
}

.form-group { margin-bottom: 16px; }

.form-group label {
  display: block;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 6px;
  color: var(--text);
}

.form-group input[type="text"],
.form-group input[type="date"],
.form-group textarea,
.form-group input:not([type]) {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 15px;
  font-family: inherit;
}

.form-group textarea { resize: vertical; }

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-light);
}

.skill-select {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.input-sm {
  padding: 6px 10px !important;
  width: 120px !important;
  font-size: 13px !important;
}

.input-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  align-items: center;
}

.input-row input { flex: 1; }

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

/* ========== 弹窗 ========== */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}

.modal {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 360px;
}

.modal h3 { margin-bottom: 16px; color: var(--primary); }

.modal input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 15px;
  margin-bottom: 16px;
}

.modal input:focus {
  outline: none;
  border-color: var(--primary);
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ========== 空状态 ========== */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-light);
  font-size: 16px;
}

/* ========== 移动端适配 ========== */
@media (max-width: 768px) {
  .main { padding: 12px; }

  .header h1 { font-size: 18px; }

  .toolbar { flex-direction: column; }

  .toolbar-right {
    width: 100%;
    justify-content: flex-end;
  }

  .toolbar-right .btn-primary {
    flex: 1;
    text-align: center;
  }

  .diary-form { max-width: 100%; }

  .form-actions { flex-direction: column; }
  .form-actions .btn { width: 100%; text-align: center; }
}
