*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --bg: #0f0d0b;
  --panel: #221d17;
  --panel-soft: #2a241d;
  --ink: #ffffff;
  --muted: #ffffff;
  --border: #b79862;
  --accent: #7f1f22;
  --accent-2: #a43a2e;
}

body {
  margin: 0;
  font-family: "Noto Sans SC", sans-serif;
  color: var(--ink);
  padding: 45px 12px 12px;
  min-height: 100vh;
  background-color: var(--bg);
  background-image: url("bg.jpg");
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
}

.binder-rings {
  position: relative;
  max-width: 900px;
  margin: 0 auto;
  height: 40px;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  padding: 0 20px;
  pointer-events: none;
}

.ring {
  position: relative;
  top: 10px;
  width: 22px;
  height: 46px;
  border: 4px solid #666;
  border-radius: 50%;
  background: transparent;
  box-shadow: inset 2px 2px 4px rgba(0, 0, 0, 0.3), 2px 2px 4px rgba(0, 0, 0, 0.4);
  flex-shrink: 0;
}

.ring::before {
  content: "";
  position: absolute;
  top: 50%;
  left: -4px;
  right: -4px;
  bottom: -4px;
  border: 4px solid #666;
  border-top: none;
  border-radius: 0 0 50% 50%;
  background: linear-gradient(to bottom, #888 0%, #666 100%);
  z-index: -1;
}

.ring::after {
  content: "";
  position: absolute;
  top: -4px;
  left: -4px;
  right: -4px;
  height: 50%;
  border: 4px solid #888;
  border-bottom: none;
  border-radius: 50% 50% 0 0;
  background: linear-gradient(to bottom, #aaa 0%, #888 100%);
}

.container {
  position: relative;
  max-width: 900px;
  margin: -20px auto 0;
  background: linear-gradient(180deg, rgba(34, 29, 23, 0.94), rgba(28, 24, 19, 0.94));
  border-radius: 12px;
  padding: 24px 12px 12px;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
  border: 2px solid var(--border);
}

h1 {
  margin: 8px 0 12px;
  text-align: center;
  color: var(--ink);
  font-size: clamp(18px, 3.2vw, 30px);
}

h2,
h3,
h4 {
  color: var(--ink);
  margin: 0;
}

p,
li {
  color: var(--ink);
  line-height: 1.7;
  text-shadow: 0 0 0 transparent;
}

.main-layout {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

@media (min-width: 968px) {
  .main-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 16px;
    align-items: start;
  }
}

.preview-section {
  order: -1;
}

@media (min-width: 968px) {
  .preview-section {
    order: 0;
  }
}

.card,
.panel {
  background: linear-gradient(180deg, var(--panel), var(--panel-soft));
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 12px;
}

.panel {
  background: linear-gradient(180deg, #282219, #201b14);
}

.label {
  display: inline-block;
  border: 2px solid var(--border);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 700;
  background: #272117;
  color: #ffffff;
}

.progress-wrap {
  margin-top: 10px;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--ink);
  font-weight: 700;
}

.progress {
  margin-top: 6px;
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: #3a342a;
  overflow: hidden;
}

.progress > span {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.question-title {
  margin-top: 12px;
  font-size: clamp(18px, 2.5vw, 30px);
  line-height: 1.35;
  color: var(--ink);
}

.likert {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.likert button {
  width: 100%;
  border: 2px solid var(--border);
  border-radius: 6px;
  background: #322a1f;
  color: var(--ink);
  padding: 9px 10px;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s;
}

.likert button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.22);
}

.likert button.active {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  color: #ffffff;
  border-color: #c17f66;
}

.hint,
.small {
  font-size: 12px;
  color: #ffffff;
}

.row-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.btn {
  width: 100%;
  border: 2px solid #c17f66;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  color: #ffffff;
  padding: 8px;
  min-height: 36px;
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.06);
}

.btn.ghost {
  background: #31281d;
  color: #ffffff;
  border-color: var(--border);
}

.btn:disabled {
  opacity: 0.5;
  transform: none;
  cursor: not-allowed;
}

.match-value {
  font-size: clamp(42px, 7vw, 64px);
  line-height: 1;
  font-weight: 800;
  color: var(--ink);
}

.pill {
  display: inline-flex;
  padding: 3px 10px;
  border: 2px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: #272117;
  color: #ffffff;
}

.confidence-high { background: #1f3a2b; }
.confidence-medium { background: #3e321b; }
.confidence-low { background: #412223; }

.canvas-wrap {
  margin-top: 10px;
  padding: 8px;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: #1b1712;
}

canvas {
  width: 100%;
  max-width: 500px;
  height: auto;
  display: block;
  margin: 0 auto;
}

.dimension-grid {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.dimension-item {
  border: 2px solid var(--border);
  border-radius: 8px;
  background: #31281d;
  padding: 8px;
}

.result-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.result-grid > .card:only-child {
  grid-column: 1 / -1;
}

@media (min-width: 968px) {
  .result-grid {
    grid-template-columns: 1fr 1fr;
  }
}

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

@media (min-width: 968px) {
  .report-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.report-block {
  border: 2px solid var(--border);
  border-radius: 8px;
  background: #31281d;
  padding: 10px;
}

.mono {
  font-family: "Consolas", "Courier New", monospace;
}

.muted {
  color: #ffffff;
}

.hidden {
  display: none;
}

.show-on-print {
  display: none;
}

.footer-note {
  text-align: center;
  padding: 15px;
  color: #fff;
  font-size: 12px;
  line-height: 1.8;
  margin-top: 10px;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.music-box {
  max-width: 900px;
  margin: 12px auto 0;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: linear-gradient(180deg, #201b15, #18140f);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
  padding: 10px;
}

.music-title {
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 8px;
}

.music-player-wrap {
  width: 100%;
  min-height: 64px;
  border: 1px solid rgba(183, 152, 98, 0.45);
  border-radius: 8px;
  overflow: hidden;
  background: #100d0a;
}

.music-player-wrap iframe {
  width: 100%;
  height: 64px;
  border: 0;
  display: block;
}

.author-note {
  margin-top: 10px;
}

.author-note a {
  color: #ffffff;
  font-weight: 700;
}

@media (max-width: 600px) {
  body {
    padding: 45px 8px 8px;
    background-attachment: scroll;
  }
  .container {
    margin-top: -14px;
    padding: 20px 10px 10px;
  }
  .binder-rings {
    padding: 0 10px;
  }
  .ring {
    width: 18px;
    height: 40px;
    border-width: 3px;
  }
  .ring::before,
  .ring::after {
    border-width: 3px;
  }
}

/* // 新增 - 角色Tag展示 */
.ch9-tag-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  pointer-events: none;
  margin-top: 8px;
  margin-bottom: 10px;
  align-items: center;
}
.ch9-tag {
  font-size: 14px;
  line-height: 1.25;
  padding: 6px 10px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.4);
  color: #f5efe3;
  white-space: normal;
  word-break: break-word;
  font-weight: 700;
  display: inline-block;
  border-radius: 6px;
}
.ch9-tag.tag-short {
  min-width: 70px;
  text-align: center;
  white-space: nowrap;
}
.ch9-tag.tag-mid {
  min-width: 104px;
  text-align: center;
}
.ch9-tag.tag-long {
  min-width: 160px;
  max-width: min(100%, 360px);
  text-align: left;
  line-height: 1.35;
  white-space: normal;
}
.ch9-tag.normal {
  color: #f5efe3;
  border-color: rgba(183, 152, 98, 0.75);
}
.ch9-tag.underline {
  color: #8fd3ff;
  border-color: rgba(143, 211, 255, 0.7);
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 2px;
}
.ch9-tag.strikethrough {
  color: #a8a9ad;
  border-color: rgba(168, 169, 173, 0.65);
  text-decoration: line-through;
  text-decoration-thickness: 1.5px;
  opacity: 0.82;
}

#custom-role-text {
  font-size: 16px;
  font-weight: 800;
  line-height: 1.6;
  color: #fff;
  margin: 8px 0 10px;
}

@media (max-width: 768px) {
  .ch9-tag-container {
    gap: 6px;
    margin-top: 6px;
    margin-bottom: 8px;
  }
  .ch9-tag {
    font-size: 13px;
    padding: 5px 8px;
    line-height: 1.2;
  }
  .ch9-tag.tag-short {
    min-width: 62px;
  }
  .ch9-tag.tag-mid {
    min-width: 92px;
  }
  .ch9-tag.tag-long {
    min-width: 130px;
    max-width: 100%;
    line-height: 1.3;
  }
  #custom-role-text {
    font-size: 15px;
    font-weight: 800;
  }
}
