:root {
  --bg-page: #fbf7f2;
  --bg-card: #ffffff;
  --bg-subtle: #f3ece3;
  --border: #eae0d5;
  --border-strong: #d9ccbc;
  --text-primary: #2e2925;
  --text-secondary: #6a615a;
  --text-tertiary: #787067;
  --accent: #b85440;
  --accent-strong: #a44a36;
  --accent-soft: #f7e4dc;
  --success: #3f7a5e;
  --success-soft: #e4f0e9;
  --grid: #e8dfd4;
  --danger: #a44a36;
  --shadow-card: 0 2px 8px rgba(46, 41, 37, 0.06);
  --shadow-float: 0 8px 24px rgba(46, 41, 37, 0.12);
  --radius-card: 16px;
  --radius-control: 12px;
  --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans SC", "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg-page);
  color: var(--text-primary);
  min-height: 100%;
  font-family: var(--font-sans);
  font-variant-numeric: tabular-nums;
}

body {
  -webkit-font-smoothing: antialiased;
}

.app {
  width: min(100%, 430px);
  margin: 0 auto;
  padding: 16px 20px 40px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.brand {
  margin: 0;
  font-size: 22px;
  line-height: 30px;
  font-weight: 600;
}

.sub {
  margin: 4px 0 0;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 20px;
}

.version {
  font-size: 13px;
  line-height: 20px;
  color: var(--text-tertiary);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.character-card,
.radar-card,
.form-panel,
.list-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 16px;
}

.character-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: #fdf3ea;
}

.rabbit-wrap {
  width: 160px;
  height: 160px;
  flex-shrink: 0;
  border-radius: 999px;
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.rabbit-wrap img,
.rabbit-wrap .rabbit-inline {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.rabbit-wrap .rabbit-inline svg {
  width: 100%;
  height: 100%;
  display: block;
}

.stage-name {
  margin: 0;
  font-size: 17px;
  line-height: 26px;
  font-weight: 600;
  color: var(--text-primary);
}

.growth {
  margin: 8px 0 0;
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 24px;
  font-weight: 600;
}

.radar-card {
  padding-bottom: 12px;
}

#radar {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  max-height: 320px;
}

.attr-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.attr-chip {
  font-size: 13px;
  line-height: 20px;
  padding: 4px 10px;
  border-radius: 999px;
  color: var(--text-primary);
  background: #f3ece3;
  border: 1px solid #eae0d5;
  background: color-mix(in srgb, var(--chip, var(--accent)) 16%, white);
  border: 1px solid color-mix(in srgb, var(--chip, var(--accent)) 28%, white);
}

.actions {
  display: flex;
}

.btn-primary,
.btn-secondary,
.btn-text {
  font: inherit;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  border-radius: var(--radius-control);
  border: none;
  min-height: 44px;
}

.btn-primary {
  width: 100%;
  height: 48px;
  background: var(--accent);
  color: #fff;
  padding: 12px 16px;
  font-size: 16px;
  line-height: 24px;
  font-weight: 600;
}

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

.btn-secondary {
  background: var(--accent-soft);
  color: var(--text-primary);
  padding: 10px 14px;
  border: 1px solid var(--border);
  font-size: 15px;
  font-weight: 600;
}

.btn-text {
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 10px;
  min-width: 44px;
}

.btn-text.danger {
  color: var(--danger);
  font-weight: 600;
}

.form-panel h2,
.list-card h2 {
  margin: 0 0 12px;
  font-size: 17px;
  line-height: 26px;
  font-weight: 600;
}

.form-panel label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 13px;
  line-height: 20px;
  color: var(--text-secondary);
}

.form-panel input,
.form-panel select,
.form-panel textarea {
  font: inherit;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  padding: 10px 12px;
  background: var(--bg-subtle);
  min-height: 44px;
  font-size: 15px;
}

.form-panel textarea {
  min-height: 72px;
  resize: vertical;
}

.form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.level-fields {
  margin: 0 0 12px;
  padding: 0;
  border: none;
}

.level-fields legend {
  font-size: 13px;
  line-height: 20px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  padding: 0;
}

.level-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.level-option {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: var(--bg-subtle);
  cursor: pointer;
  font-size: 15px;
  line-height: 24px;
  color: var(--text-primary);
}

.level-option:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.level-option input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  flex-shrink: 0;
}

.muted {
  color: var(--text-tertiary);
  font-size: 13px;
  line-height: 20px;
}

.today-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.record-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  padding: 12px;
  background: var(--bg-card);
}

.record-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
}

.record-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 13px;
  line-height: 20px;
  color: var(--text-secondary);
}

.record-gains {
  margin-top: 8px;
  font-size: 13px;
  line-height: 20px;
  color: var(--accent-strong);
  font-weight: 600;
}

.record-note {
  margin-top: 8px;
  font-size: 15px;
  line-height: 24px;
  color: var(--text-primary);
  word-break: break-word;
  white-space: pre-wrap;
}

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

.ach-badge {
  font-size: 13px;
  line-height: 20px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--success-soft);
  color: var(--success);
  border: 1px solid #c5dccf;
  border: 1px solid color-mix(in srgb, var(--success) 20%, white);
  font-weight: 600;
}

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

.praise-box {
  background: var(--accent-soft);
  border: 1px solid #e8cfc5;
  border: 1px solid color-mix(in srgb, var(--accent) 25%, white);
  color: var(--accent-strong);
  border-radius: var(--radius-control);
  padding: 12px 16px;
  font-size: 15px;
  line-height: 24px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  max-width: min(90vw, 360px);
  background: rgba(46, 41, 37, 0.92);
  color: #fff;
  padding: 12px 14px;
  border-radius: var(--radius-control);
  font-size: 13px;
  line-height: 20px;
  z-index: 20;
  box-shadow: var(--shadow-float);
}

@media (min-width: 431px) {
  .app {
    padding-top: 24px;
  }
}
