:root {
  --bg: #e4d4ff;
  --surface: #ffffff;
  --text: #1a1a2e;
  --text-muted: #5c4d7a;
  --hot-pink: #ff1493;
  --electric-cyan: #00d4ff;
  --lime: #ccff00;
  --purple: #9933ff;
  --orange: #ff6b35;
  --positive: #39ff14;
  --mixed: #ff6b35;
  --neutral: #b8a9c9;
  --negative: #ff3366;
  --accent: var(--hot-pink);
  --accent-soft: #ffe0f5;
  --border: #1a1a2e;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 4px 4px 0 var(--border);
  --font: "Pretendard", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
}

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  background-image:
    radial-gradient(circle at 20% 20%, rgba(255, 20, 147, 0.15) 0%, transparent 40%),
    radial-gradient(circle at 80% 10%, rgba(0, 212, 255, 0.15) 0%, transparent 35%),
    radial-gradient(circle at 60% 80%, rgba(204, 255, 0, 0.12) 0%, transparent 40%),
    linear-gradient(135deg, #fce4ff 0%, #d4f1ff 45%, #e8ffc8 100%);
  min-height: 100vh;
}

.app {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px 40px;
}

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 32px;
}

.header__brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.header__logo {
  font-size: 22px;
  background: linear-gradient(135deg, var(--hot-pink), var(--electric-cyan), var(--lime));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(1px 1px 0 var(--border));
}

.header__title {
  margin: 0;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(90deg, var(--hot-pink), var(--purple));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.header__subtitle {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.header__nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* Buttons */
.btn {
  font-family: var(--font);
  font-size: 14px;
  font-weight: 700;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
  box-shadow: 3px 3px 0 var(--border);
}

.btn:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--border);
}

.btn--primary {
  background: linear-gradient(135deg, var(--hot-pink) 0%, var(--purple) 100%);
  color: #fff;
}

.btn--primary:hover {
  background: linear-gradient(135deg, #ff3da8 0%, #aa44ff 100%);
}

.btn--ghost {
  background: var(--surface);
  color: var(--text);
}

.btn--ghost:hover {
  background: var(--accent-soft);
}

.btn:disabled,
.btn--ghost:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: 2px 2px 0 var(--border);
}

.btn--danger {
  background: #fff;
  color: var(--negative);
  border-color: var(--border);
}

.btn--danger:hover {
  background: #ffe0ea;
}

/* Panels */
.panel {
  margin-bottom: 24px;
}

.panel--upload {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 768px) {
  .panel--upload,
  .panel--charts,
  .panel--detail,
  .panel--bottom {
    grid-template-columns: 1fr;
  }
}

.panel--charts {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 20px;
}

.panel--bottom {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.sample-picker {
  grid-column: 1 / -1;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow);
}

.sample-picker__label {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 800;
  color: var(--purple);
}

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

.btn--sample {
  font-size: 12px !important;
  padding: 8px 12px !important;
}

.btn--disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.field__hint--block {
  display: block;
  margin-bottom: 10px;
}

.modal__subtitle {
  margin: -12px 0 20px;
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
}

.roadmap-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 480px;
  overflow-y: auto;
}

.roadmap-item {
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  background: var(--surface);
}

.roadmap-item--done {
  border-left: 4px solid var(--positive);
}

.roadmap-item--planned {
  border-left: 4px solid var(--mixed);
  opacity: 0.92;
}

.roadmap-item__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.roadmap-item__category {
  font-size: 11px;
  font-weight: 800;
  color: var(--purple);
  text-transform: uppercase;
}

.roadmap-item__status {
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
}

.roadmap-item--done .roadmap-item__status {
  background: #d4ffcc;
}

.roadmap-item--planned .roadmap-item__status {
  background: #ffe4d4;
}

.roadmap-item__title {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 800;
}

.roadmap-item__desc {
  margin: 0 0 10px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
  font-weight: 500;
}

.roadmap-item__meta {
  margin: 0;
  font-size: 12px;
}

.roadmap-item__meta div {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 8px;
  margin-bottom: 4px;
}

.roadmap-item__meta dt {
  font-weight: 800;
  color: var(--text);
}

.roadmap-item__meta dd {
  margin: 0;
  color: var(--text-muted);
  font-weight: 500;
}

.ca-report__overview {
  margin: 0 0 16px;
  font-size: 14px;
  line-height: 1.55;
  font-weight: 600;
  padding: 12px;
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
}

.ca-report__section {
  margin-bottom: 14px;
}

.ca-report__section-title {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 800;
  color: var(--hot-pink);
}

.ca-report__list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.ca-report__list li {
  position: relative;
  padding: 8px 0 8px 16px;
  font-size: 13px;
  line-height: 1.5;
  border-bottom: 1px dashed rgba(26, 26, 46, 0.12);
}

.ca-report__list li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--purple);
  font-weight: 700;
}

.panel--detail {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.mask-status {
  grid-column: 1 / -1;
  margin: 0;
  text-align: center;
  font-size: 12px;
  font-weight: 800;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  background: #d4ffcc;
  color: #1a5c10;
}

.mask-status--off {
  background: #ffe4d4;
  color: #8c3a12;
}

/* Upload zone */
.upload-zone {
  background: var(--surface);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 36px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
  box-shadow: var(--shadow);
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--hot-pink);
  background: var(--accent-soft);
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--border);
}

.upload-zone__icon {
  font-size: 36px;
  margin-bottom: 12px;
}

.upload-zone__title {
  margin: 0 0 6px;
  font-weight: 800;
  font-size: 16px;
}

.upload-zone__hint {
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
}

/* Summary card */
.summary-card {
  background: linear-gradient(135deg, #ff9aee 0%, #80d4ff 50%, #c8ff80 100%);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-shadow: var(--shadow);
}

.summary-card__label {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--border);
  margin-bottom: 10px;
}

.summary-card__text {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.5;
  color: var(--border);
}

/* Cards */
.card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.card__title {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 800;
  color: var(--purple);
}

.card__desc {
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
}

.chart-wrap {
  position: relative;
  height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chart-wrap--line {
  height: 180px;
  margin-top: 8px;
}

/* Sentiment legend */
.sentiment-legend {
  list-style: none;
  padding: 0;
  margin: 16px 0 0;
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
  font-size: 14px;
  font-weight: 700;
}

.sentiment-legend .dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
  border: 1.5px solid var(--border);
}

.dot--positive { background: var(--positive); }
.dot--mixed { background: var(--mixed); }
.dot--neutral { background: var(--neutral); }
.dot--negative { background: var(--negative); }

.sentiment-basis {
  margin: 12px 0 0;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
}

/* Word cloud */
.wordcloud-wrap {
  width: 100%;
  height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wordcloud-wrap canvas {
  max-width: 100%;
}

.wordcloud-wrap .placeholder {
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
}

/* LSpartnership */
.lspar-score {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin-bottom: 4px;
}

.lspar-score__value {
  font-size: 42px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--hot-pink), var(--electric-cyan));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1;
}

.lspar-score__unit {
  font-size: 16px;
  color: var(--text-muted);
  font-weight: 700;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.tag {
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--lime);
  color: var(--border);
  font-weight: 800;
  border: 1.5px solid var(--border);
}

.tag:nth-child(3n+2) {
  background: var(--electric-cyan);
}

.tag:nth-child(3n) {
  background: var(--hot-pink);
  color: #fff;
}

/* Suggestions */
.suggestions-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.suggestions-list li {
  position: relative;
  padding: 12px 0 12px 20px;
  border-bottom: 2px dashed rgba(26, 26, 46, 0.15);
  font-size: 14px;
  line-height: 1.55;
  font-weight: 500;
}

.suggestions-list li:last-child {
  border-bottom: none;
}

.suggestions-list li::before {
  content: "★";
  position: absolute;
  left: 0;
  color: var(--hot-pink);
  font-weight: 700;
}

.suggestions-list__empty {
  color: var(--text-muted);
  padding-left: 0 !important;
  font-weight: 600;
}

.suggestions-list__empty::before {
  display: none;
}

/* Loading */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(228, 212, 255, 0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 100;
  backdrop-filter: blur(6px);
}

.loading-overlay.hidden {
  display: none;
}

.loading-overlay p {
  font-weight: 800;
  color: var(--purple);
  font-size: 16px;
}

.spinner {
  width: 44px;
  height: 44px;
  border: 3px solid var(--accent-soft);
  border-top-color: var(--hot-pink);
  border-right-color: var(--electric-cyan);
  border-bottom-color: var(--lime);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Footer */
.footer {
  margin-top: 32px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}

/* Modal */
.modal {
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
  max-width: 440px;
  width: calc(100% - 32px);
  box-shadow: 8px 8px 0 var(--border);
}

.modal--wide {
  max-width: 560px;
}

.modal::backdrop {
  background: rgba(26, 26, 46, 0.5);
}

.modal__content {
  padding: 28px 24px;
  background: var(--surface);
}

.modal__title {
  margin: 0 0 20px;
  font-size: 20px;
  font-weight: 800;
  color: var(--purple);
}

.modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 24px;
}

.field {
  border: none;
  padding: 0;
  margin: 0 0 16px;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 6px;
}

.field input[type="password"],
.field select {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 14px;
  background: var(--surface);
}

.field input[type="password"]:focus,
.field select:focus {
  outline: none;
  border-color: var(--hot-pink);
  box-shadow: 0 0 0 3px rgba(255, 20, 147, 0.2);
}

.field__hint {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}

.checkbox-label {
  display: flex !important;
  align-items: center;
  gap: 8px;
  font-weight: 600 !important;
  cursor: pointer;
}

/* History */
.history-list {
  max-height: 360px;
  overflow-y: auto;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 2px dashed rgba(26, 26, 46, 0.12);
  cursor: pointer;
  transition: background 0.15s;
}

.history-item:hover {
  background: var(--accent-soft);
  margin: 0 -8px;
  padding-left: 8px;
  padding-right: 8px;
  border-radius: var(--radius-sm);
}

.history-item__info {
  flex: 1;
  min-width: 0;
}

.history-item__date {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 700;
}

.history-item__summary {
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
}

.history-item__score {
  font-size: 14px;
  font-weight: 800;
  color: var(--hot-pink);
  white-space: nowrap;
}

.history-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 32px 0;
  font-size: 14px;
  font-weight: 600;
}

/* Detail panels */
.detail-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.detail-list--scroll {
  max-height: 420px;
  overflow-y: auto;
}

.detail-empty {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
  text-align: center;
  padding: 16px 0;
}

.sentiment-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sentiment-badge--positive { background: #d4ffcc; color: #1a5c10; }
.sentiment-badge--mixed { background: #ffe4d4; color: #8c3a12; }
.sentiment-badge--neutral { background: #ece8f0; color: #5c4d7a; }
.sentiment-badge--negative { background: #ffd4de; color: #8c1230; }

.utterance-item {
  padding: 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fefaff;
}

.utterance-item__head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.utterance-item__speaker {
  font-size: 12px;
  font-weight: 800;
  color: var(--purple);
}

.utterance-item__conf {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 700;
  margin-left: auto;
}

.utterance-item__text {
  margin: 0 0 6px;
  font-size: 13px;
  line-height: 1.5;
  font-weight: 500;
}

.utterance-item__evidence {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.45;
  font-style: italic;
}

.aspect-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.aspect-tag {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--electric-cyan);
  color: var(--border);
  font-weight: 700;
  border: 1px solid var(--border);
}

.unclassified-item {
  padding: 12px;
  border: 2px dashed var(--mixed);
  border-radius: var(--radius-sm);
  background: #fff8f4;
}

.unclassified-item__head {
  margin-bottom: 4px;
}

.unclassified-item__id {
  font-size: 11px;
  font-weight: 800;
  color: var(--mixed);
  letter-spacing: 0.06em;
}

.unclassified-item__text {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
}

.unclassified-item__reason {
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.45;
}

.topic-item {
  padding: 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.topic-item__head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.topic-item__name {
  font-size: 14px;
  color: var(--text);
}

.topic-item__summary {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
  font-weight: 500;
}

/* Category tree */
.category-l1 {
  margin-bottom: 14px;
  padding: 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fefaff;
}

.category-l1__title {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 800;
  color: var(--purple);
}

.category-l2 {
  margin-left: 8px;
  margin-bottom: 8px;
}

.category-l2__title {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.category-l3-list {
  margin: 0 0 0 16px;
  padding: 0;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.category-l3-list li {
  margin-bottom: 2px;
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  background: var(--surface);
  font-size: 14px;
  font-weight: 700;
  box-shadow: 4px 4px 0 var(--border);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.3s, transform 0.3s;
  max-width: 360px;
}

.toast--visible {
  opacity: 1;
  transform: translateY(0);
}

.toast--success {
  background: #d4ffcc;
  color: #1a5c10;
}

.toast--error {
  background: #ffd4de;
  color: #8c1230;
}

.toast--info {
  background: var(--accent-soft);
  color: var(--text);
}

.footer__version {
  margin-top: 6px;
  font-size: 11px;
  opacity: 0.7;
}

/* Print */
@media print {
  .header__nav,
  .upload-zone,
  .sample-picker,
  .mask-status,
  .loading-overlay,
  .footer,
  dialog {
    display: none !important;
  }

  body {
    background: #fff;
  }

  .card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ccc;
    margin-bottom: 16px;
  }

  .panel--bottom,
  .panel--detail,
  .panel--charts {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1024px) {
  .panel--bottom {
    grid-template-columns: 1fr;
  }
}
