/* /css/textcal.css */
/* 기존 기능 유지 + 도장생성기 / QR생성기와 유사한 상단 스타일 */

*, *::before, *::after {
  box-sizing: border-box;
}

:root {
  --textcal-primary: #2563eb;
  --textcal-primary-dark: #1d4ed8;
  --textcal-primary-soft: #eff6ff;
  --textcal-accent: #0ea5e9;
  --textcal-accent2: #14b8a6;
  --textcal-red: #dc2626;
  --textcal-bg: #f5f7fa;
  --textcal-card-bg: #ffffff;
  --textcal-text: #0f172a;
  --textcal-muted: #64748b;
  --textcal-line: #e5e7eb;
  --textcal-border: #d7dde7;
  --textcal-radius: 18px;
  --textcal-radius-sm: 12px;
  --textcal-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
  --textcal-shadow-soft: 0 4px 14px rgba(15, 23, 42, 0.04);
}

.textcal-wrap {
  max-width: 1140px;
  margin: 0.8rem auto 2rem;
  padding: 0;
  color: var(--textcal-text);
  font-family: "Noto Sans KR", "Malgun Gothic", sans-serif;
}

/* ===== 상단 대표 영역 ===== */
.textcal-hero {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 26px;
  background: #f8fafc;
  border: 1px solid #dbe3ef;
  border-radius: 24px;
  padding: 24px 26px;
  box-shadow: var(--textcal-shadow-soft);
  margin-bottom: 18px;
}

.textcal-hero-copy {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.textcal-hero-badge {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  padding: 8px 14px;
  border-radius: 999px;
  background: #e9effa;
  color: #2563eb;
  font-size: 0.86rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  margin-bottom: 14px;
}

.textcal-hero h1 {
  margin: 0 0 10px;
  font-size: clamp(2rem, 3vw, 2.45rem);
  line-height: 1.18;
  font-weight: 900;
  letter-spacing: -0.04em;
  color: #0f172a;
}

.textcal-hero p {
  margin: 0;
  max-width: 760px;
  color: #667085;
  font-size: 1.05rem;
  line-height: 1.75;
}

.textcal-hero-visual {
  width: 220px;
  flex: 0 0 220px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.textcal-hero-visual-box {
  width: 100%;
  min-height: 170px;
  border-radius: 24px;
  padding: 22px 20px;
  background: linear-gradient(135deg, #3b82f6 0%, #22c1c3 100%);
  color: #fff;
  position: relative;
  overflow: hidden;
  box-shadow: 0 16px 30px rgba(59, 130, 246, 0.22);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.textcal-hero-visual-box::before {
  content: "";
  position: absolute;
  width: 90px;
  height: 90px;
  right: -20px;
  top: -16px;
  border-radius: 50%;
  background: rgba(255,255,255,0.18);
}

.textcal-hero-icon {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.45rem;
  font-weight: 900;
  margin-bottom: 14px;
  position: relative;
  z-index: 1;
}

.textcal-hero-visual-text {
  position: relative;
  z-index: 1;
}

.textcal-hero-visual-text strong {
  display: block;
  font-size: 1.1rem;
  font-weight: 900;
  margin-bottom: 6px;
}

.textcal-hero-visual-text span {
  display: block;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.45;
  opacity: 0.96;
}

/* ===== 안내 ===== */
.textcal-notice {
  background: #f1f8e9;
  border: 1px solid #c5e1a5;
  padding: 1rem 1.1rem;
  border-radius: 14px;
  margin-bottom: 1rem;
  font-size: 0.94rem;
  color: #334155;
  line-height: 1.7;
}

.textcal-notice strong {
  color: #3f6212;
  font-weight: 800;
}

/* ===== 공통 카드 ===== */
.textcal-main-card,
.textcal-analysis-card,
.textcal-diagnosis-card,
.textcal-summary-card {
  background: var(--textcal-card-bg);
  border: 1px solid var(--textcal-line);
  border-radius: 18px;
  box-shadow: var(--textcal-shadow-soft);
}

/* ===== 입력 카드 ===== */
.textcal-main-card {
  padding: 1.2rem;
  margin-bottom: 1rem;
}

.textcal-input-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: 0.85rem;
}

.textcal-input-head h2 {
  margin: 0 0 0.25rem;
  font-size: 1.28rem;
  color: #111827;
  font-weight: 800;
}

.textcal-input-head p {
  margin: 0;
  color: var(--textcal-muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

.textcal-live-status {
  flex: 0 0 auto;
  padding: 0.5rem 0.78rem;
  border-radius: 999px;
  background: #e9f3ff;
  color: var(--textcal-primary);
  font-size: 0.82rem;
  font-weight: 800;
}

.textcal-wrap textarea#textInput {
  width: 100%;
  min-height: 260px;
  resize: vertical;
  border: 1px solid var(--textcal-border);
  border-radius: 14px;
  padding: 1rem;
  font-size: 0.98rem;
  line-height: 1.75;
  outline: none;
  color: #1f2937;
  background: #fbfdff;
  font-family: inherit;
}

.textcal-wrap textarea#textInput:focus {
  border-color: var(--textcal-primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.10);
  background: #fff;
}

.textcal-option-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-top: 0.95rem;
}

.textcal-option-field {
  display: flex;
  flex-direction: column;
  gap: 0.38rem;
}

.textcal-option-field label {
  font-size: 0.82rem;
  font-weight: 800;
  color: #334155;
}

.textcal-option-field input,
.textcal-option-field select {
  width: 100%;
  height: 42px;
  border: 1px solid var(--textcal-border);
  border-radius: 10px;
  padding: 0 0.7rem;
  font-size: 0.9rem;
  outline: none;
  background: #fff;
  color: var(--textcal-text);
  font-family: inherit;
}

.textcal-option-field input:focus,
.textcal-option-field select:focus {
  border-color: var(--textcal-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.10);
}

.textcal-btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1rem;
}

.textcal-btn {
  border: none;
  border-radius: 12px;
  padding: 0.8rem 1.05rem;
  font-size: 0.94rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.15s, background 0.2s, box-shadow 0.2s;
  font-family: inherit;
}

.textcal-btn:hover {
  transform: translateY(-1px);
}

.textcal-btn.primary {
  background: var(--textcal-primary);
  color: #fff;
}

.textcal-btn.primary:hover {
  background: var(--textcal-primary-dark);
}

.textcal-btn.gray {
  background: #e5e7eb;
  color: #334155;
}

.textcal-btn.gray:hover {
  background: #d1d5db;
}

.textcal-btn.dark {
  background: #1f2937;
  color: #fff;
}

.textcal-btn.dark:hover {
  background: #111827;
}

/* ===== 음성 읽기 ===== */
.textcal-voice-box {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-top: 1rem;
  padding: 0.95rem;
  border-radius: 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

.textcal-voice-title {
  flex: 0 0 auto;
  font-size: 0.9rem;
  font-weight: 800;
  color: #334155;
}

.textcal-voice-actions {
  display: flex;
  gap: 0.45rem;
  padding-left: 0.8rem;
  border-left: 1px solid #cbd5e1;
}

.textcal-voice-btn {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.15s, opacity 0.15s;
  font-family: inherit;
}

.textcal-voice-btn:hover {
  transform: translateY(-1px);
  opacity: 0.94;
}

.textcal-voice-btn.play {
  background: #3b82f6;
  color: #fff;
}

.textcal-voice-btn.pause {
  background: #f59e0b;
  color: #fff;
}

.textcal-voice-btn.stop {
  background: #ef4444;
  color: #fff;
}

.textcal-voice-help {
  margin: 0;
  color: var(--textcal-muted);
  font-size: 0.82rem;
  line-height: 1.55;
}

/* ===== 요약 카드 ===== */
.textcal-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.8rem;
  margin-bottom: 1rem;
}

.textcal-summary-card {
  padding: 1rem;
}

.textcal-summary-card .label {
  display: block;
  color: #64748b;
  font-size: 0.84rem;
  font-weight: 800;
  margin-bottom: 0.42rem;
}

.textcal-summary-card .value {
  display: block;
  color: var(--textcal-primary);
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: -0.03em;
}

.textcal-summary-card .sub {
  display: block;
  margin-top: 0.38rem;
  color: #94a3b8;
  font-size: 0.8rem;
  line-height: 1.4;
}

/* ===== 분석 카드 ===== */
.textcal-analysis-card {
  padding: 1.15rem;
  margin-bottom: 1rem;
}

.textcal-analysis-card h3,
.textcal-diagnosis-card h3 {
  margin: 0 0 0.85rem;
  font-size: 1.15rem;
  color: #1f2937;
  font-weight: 800;
}

.textcal-result-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.7rem;
}

.textcal-result-item {
  background: #f8fafc;
  border: 1px solid #edf2f7;
  border-radius: 12px;
  padding: 0.9rem;
}

.textcal-result-item span {
  display: block;
  color: #64748b;
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.textcal-result-item strong {
  display: block;
  color: #1f2937;
  font-size: 1rem;
  line-height: 1.45;
}

.textcal-standard-text {
  margin-top: 0.9rem;
  padding: 0.88rem;
  border-radius: 12px;
  background: #e9f3ff;
  color: #1e40af;
  font-size: 0.85rem;
  line-height: 1.7;
}

/* ===== 진단 ===== */
.textcal-diagnosis-card {
  padding: 1.15rem;
  background: #f8fafc;
}

.textcal-badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.75rem;
}

.textcal-status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.42rem 0.7rem;
  border-radius: 999px;
  background: #fff;
  color: var(--textcal-primary);
  border: 1px solid #bfdbfe;
  font-size: 0.8rem;
  font-weight: 800;
}

.textcal-diagnosis-text {
  margin: 0;
  color: #334155;
  line-height: 1.68;
  font-size: 0.92rem;
}

/* ===== 토스트 ===== */
.textcal-toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%) translateY(20px);
  opacity: 0;
  pointer-events: none;
  background: #1f2937;
  color: #fff;
  padding: 0.75rem 1rem;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 800;
  transition: 0.25s;
  z-index: 9999;
}

.textcal-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* QHD */
@media (min-width: 2500px) {
  .textcal-wrap {
    max-width: 1200px;
  }
}

/* UHD */
@media (min-width: 3800px) {
  .textcal-wrap {
    max-width: 1600px;
  }
}

@media (max-width: 980px) {
  .textcal-hero {
    flex-direction: column;
  }

  .textcal-hero-visual {
    width: 100%;
    flex: 0 0 auto;
    justify-content: flex-start;
  }

  .textcal-hero-visual-box {
    width: 240px;
  }

  .textcal-summary-grid,
  .textcal-option-grid,
  .textcal-result-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* 모바일 */
@media (max-width: 768px) {
  body,
  html {
    margin: 0 !important;
    padding: 0 !important;
    overflow-x: hidden;
  }

  #center,
  .center,
  .center-area,
  main,
  .content,
  .page-center {
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  .textcal-wrap {
    width: 100%;
    max-width: 900px;
    margin: 0 auto 24px !important;
    padding: 0 10px !important;
  }

  .textcal-hero {
    padding: 18px;
    border-radius: 20px;
    gap: 16px;
  }

  .textcal-hero h1 {
    font-size: 1.7rem;
  }

  .textcal-hero p {
    font-size: 0.95rem;
    line-height: 1.65;
  }

  .textcal-hero-visual {
    width: 100%;
  }

  .textcal-hero-visual-box {
    width: 100%;
    min-height: 140px;
    border-radius: 20px;
  }

  .textcal-main-card,
  .textcal-analysis-card,
  .textcal-diagnosis-card,
  .textcal-summary-card {
    border-radius: 16px;
  }

  .textcal-main-card,
  .textcal-analysis-card,
  .textcal-diagnosis-card {
    padding: 1rem;
  }

  .textcal-input-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .textcal-live-status {
    width: 100%;
    text-align: center;
  }

  .textcal-summary-grid,
  .textcal-option-grid,
  .textcal-result-grid {
    grid-template-columns: 1fr;
  }

  .textcal-summary-card .value {
    font-size: 1.35rem;
  }

  .textcal-wrap textarea#textInput {
    min-height: 220px;
    font-size: 0.95rem;
    padding: 0.9rem;
  }

  .textcal-btn {
    width: 100%;
  }

  .textcal-voice-box {
    align-items: flex-start;
    flex-direction: column;
  }

  .textcal-voice-actions {
    width: 100%;
    justify-content: center;
    padding-left: 0;
    padding-top: 0.75rem;
    border-left: 0;
    border-top: 1px solid #cbd5e1;
  }

  .center-ad {
    margin-top: 6px !important;
    margin-bottom: 6px !important;
    padding: 0 !important;
  }
}

@media (max-width: 440px) {
  .textcal-wrap {
    padding-left: 8px !important;
    padding-right: 8px !important;
  }

  .textcal-hero {
    padding: 16px;
  }

  .textcal-hero h1 {
    font-size: 1.48rem;
  }
}