/* =================================================
   최종 파일명 : utils/text-tools/tool.css
   ================================================= */
:root {
  /* 색은 /site.css 토큰이 원본이다. 이 파일의 옛 이름은 토큰을 가리키기만 한다 */
  --bg: var(--paper);
  --surface: var(--white);
  --text: var(--ink);
  --muted: var(--text-sub);
  --primary: var(--accent);
  --primary-soft: var(--paper);
  --border: var(--line);
  --stat-label: var(--text-sub);
}

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

[hidden] {
  display: none !important;
}

body {
  font-family: var(--font-sans);
  background: var(--white);
  color: var(--text);
  line-height: 1.6;
  font-size: 15px;
}

.wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 20px 16px 32px;
}

.tool-header {
  margin-bottom: 16px;
}

.tool-header h1 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 4px;
}

.tool-header p {
  font-size: 14px;
  color: var(--muted);
}

.input-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px;
  margin-bottom: 16px;
}

.input-panel label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
}

#text-input {
  width: 100%;
  min-height: 160px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  color: var(--text);
  background: var(--white);
  resize: vertical;
}

#text-input:focus {
  outline: 2px solid var(--primary-soft);
  border-color: var(--primary);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.stats-bytes {
  grid-template-columns: repeat(2, 1fr);
  margin-bottom: 8px;
}

.bytes-hint {
  font-size: 12px;
  color: var(--stat-label);
  margin: 0 0 16px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 12px;
  text-align: center;
}

.stat-card .icon {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 4px;
}

.stat-card .value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  word-break: break-all;
}

.stat-card .label {
  font-size: 12px;
  color: var(--stat-label);
  margin-top: 4px;
}

.cpm-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 16px;
}

.cpm-panel h2 {
  font-size: 15px;
  margin-bottom: 4px;
}

.cpm-hint {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 12px;
}

.cpm-scale {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--stat-label);
  margin-bottom: 6px;
  gap: 8px;
}

.cpm-scale span:nth-child(2) {
  text-align: center;
  flex: 1;
}

#cpm-slider {
  width: 100%;
  accent-color: var(--primary);
}

.cpm-current {
  margin-top: 10px;
  font-size: 14px;
  color: var(--muted);
}

.cpm-current strong {
  color: var(--text);
}

.duration-box {
  background: var(--primary-soft);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 8px;
}

#duration-estimate {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
}

.duration-basis {
  font-size: 13px;
  color: var(--ink);
  margin-top: 2px;
}

.guide {
  margin-top: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 8px 20px 20px;
}

.guide h2 {
  font-size: 18px;
  margin: 20px 0 8px;
}

.guide h3 {
  font-size: 16px;
  margin: 16px 0 6px;
}

.guide .note {
  background: var(--primary-soft);
  border-radius: 8px;
  padding: 12px 16px;
  margin: 12px 0;
}

.guide .note p {
  color: var(--text);
  margin: 0;
}

.guide p,
.guide li {
  font-size: 15px;
  color: var(--muted);
}

.guide p {
  margin-bottom: 10px;
}

.guide ul,
.guide ol {
  margin: 6px 0 10px 22px;
}

.guide li {
  margin-bottom: 4px;
}

.guide a {
  color: var(--primary);
}

.guide .memo {
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  margin: 10px 0;
}

.tool-header .lead,
.tool-header p {
  font-size: 14px;
  color: var(--muted);
}

.duration-note {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 16px;
}

.ad-slot {
  min-height: 90px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: var(--surface);
  margin-top: 8px;
}

/* 심화 분석 3종 */
.ad-slot-gap {
  margin-top: 32px;
  margin-bottom: 32px;
}

.deep-panel h2 {
  font-size: 15px;
  margin-bottom: 8px;
}

.deep-buttons {
  list-style: none;
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.deep-buttons li {
  display: flex;
  align-items: center;
  gap: 12px;
}

.deep-buttons .deep-btn {
  flex: 0 0 auto;
  min-width: 150px;
}

.deep-desc {
  font-size: 14px;
  color: var(--muted);
}

@media (max-width: 640px) {
  .deep-buttons li {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
}

.deep-btn,
.copy-btn {
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
  background: var(--surface);
  border: 1px solid var(--primary);
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
}

.deep-btn[aria-expanded="true"] {
  color: var(--white);
  background: var(--primary);
}

.copy-btn:disabled {
  color: var(--stat-label);
  border-color: var(--border);
  cursor: not-allowed;
}

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

.deep-card h3 {
  font-size: 15px;
  margin-bottom: 4px;
}

.deep-note {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 10px;
}

.timeline,
.repeated,
.compare {
  margin: 0 0 10px 0;
  padding: 0;
  list-style: none;
  font-size: 14px;
}

.timeline li,
.repeated li,
.compare li {
  padding: 4px 0;
  border-bottom: 1px solid var(--bg);
  word-break: break-word;
}

.timeline .ts {
  display: inline-block;
  min-width: 52px;
  font-weight: 700;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
}

.compare li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.repeated .empty {
  color: var(--muted);
}

.copy-status {
  margin-left: 8px;
  font-size: 13px;
  color: var(--muted);
}

.guide-link {
  margin-top: 16px;
  font-size: 14px;
}

@media (max-width: 720px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .stats-grid:not(.stats-bytes) .stat-card:last-child {
    grid-column: 1 / -1;
  }

  .cpm-scale {
    flex-direction: column;
    align-items: stretch;
    text-align: left;
  }

  .cpm-scale span:nth-child(2) {
    text-align: left;
  }
}

@media (max-width: 400px) {
  .stat-card .value {
    font-size: 18px;
  }
}
