* { box-sizing: border-box; }

/* ══════════════════
   LAYOUT
══════════════════ */
#main-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
  align-items: start;
}

.pc-input-section,
.pc-result-section {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 2px 12px rgba(99,102,241,0.07);
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* ══════════════════
   SECTION TITLE
══════════════════ */
label.pc-section-title,
.pc-section-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 14px 0;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: default;
}

label.pc-section-title svg,
.pc-section-title svg { stroke: #6366f1; flex-shrink: 0; }

/* ══════════════════
   INPUT
══════════════════ */
.pc-input-wrap {
  position: relative;
  margin-bottom: 14px;
}

.pc-textarea {
  width: 100%;
  min-height: 160px;
  resize: none;
  padding: 12px 14px;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  font-size: 0.95rem;
  outline: none;
  font-family: inherit;
  color: #1e293b;
  background: #ffffff;
  line-height: 1.7;
  transition: border-color 0.18s;
}

.pc-textarea:focus {
  border-color: #818cf8;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.08);
}

.pc-clear-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
  padding: 4px 12px;
  font-size: 0.80rem;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  transition: background 0.18s;
}

.pc-clear-btn:hover { background: #e2e8f0; color: #ef4444; }

/* ══════════════════
   OPTIONS
══════════════════ */
.pc-options {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-bottom: 18px;
}

.pc-checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.87rem;
  font-weight: 500;
  color: #475569;
  cursor: pointer;
  user-select: none;
}

.pc-checkbox-label input[type="checkbox"] { display: none; }

.pc-checkmark {
  width: 18px;
  height: 18px;
  border: 2px solid #c7d2fe;
  border-radius: 5px;
  background: #f8f9ff;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.pc-checkbox-label input:checked + .pc-checkmark {
  background: #6366f1;
  border-color: #6366f1;
}

.pc-checkbox-label input:checked + .pc-checkmark::after {
  content: '';
  width: 5px;
  height: 9px;
  border: 2px solid #fff;
  border-top: none;
  border-left: none;
  transform: rotate(45deg) translateY(-1px);
  display: block;
}

/* ══════════════════
   CHECK BUTTON
══════════════════ */
.pc-check-btn {
  width: 100%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  border: none;
  border-radius: 11px;
  padding: 13px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: opacity 0.18s, transform 0.15s;
}

.pc-check-btn:hover { opacity: 0.88; transform: scale(1.02); }
.pc-check-btn:active { transform: scale(0.98); }

/* ══════════════════
   RESULT BOX
══════════════════ */
.pc-result-box {
  background: #f8faff;
  border: 2px solid #e2e8f0;
  border-radius: 14px;
  padding: 28px 20px;
  text-align: center;
  margin-bottom: 16px;
  transition: all 0.3s ease;
}

.pc-result-box.is-palindrome {
  background: linear-gradient(135deg, #f0fdf4, #dcfce7);
  border-color: #86efac;
}

.pc-result-box.not-palindrome {
  background: linear-gradient(135deg, #fff1f2, #ffe4e6);
  border-color: #fca5a5;
}

.pc-result-icon {
  font-size: 3rem;
  margin-bottom: 10px;
  line-height: 1;
  transition: all 0.3s;
}

.pc-result-text {
  font-size: 1.3rem;
  font-weight: 800;
  color: #1e293b;
  margin-bottom: 6px;
  transition: color 0.3s;
}

.pc-result-box.is-palindrome  .pc-result-text { color: #15803d; }
.pc-result-box.not-palindrome .pc-result-text { color: #dc2626; }

.pc-result-sub {
  font-size: 0.88rem;
  color: #64748b;
  line-height: 1.5;
}

/* ══════════════════
   DETAILS BOX
══════════════════ */
.pc-details-box {
  background: #f8faff;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pc-detail-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.pc-detail-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  min-width: 80px;
  padding-top: 2px;
  flex-shrink: 0;
}

.pc-detail-val {
  font-size: 0.88rem;
  font-weight: 600;
  color: #1e293b;
  font-family: 'Courier New', monospace;
  word-break: break-all;
  flex: 1;
}

/* ══════════════════
   MIRROR VIEW
══════════════════ */
.pc-mirror-box {
  background: #f8faff;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px 16px;
}

.pc-mirror-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

.pc-mirror-display {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0;
  flex-wrap: wrap;
}

.pc-mirror-char {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 28px;
  padding: 0 2px;
}

.pc-mirror-top {
  font-size: 1.1rem;
  font-weight: 700;
  color: #6366f1;
  font-family: 'Courier New', monospace;
  line-height: 1;
}

.pc-mirror-bottom {
  font-size: 1.1rem;
  font-weight: 700;
  color: #8b5cf6;
  font-family: 'Courier New', monospace;
  line-height: 1;
}

.pc-mirror-char.match .pc-mirror-top,
.pc-mirror-char.match .pc-mirror-bottom { color: #16a34a; }

.pc-mirror-char.no-match .pc-mirror-top,
.pc-mirror-char.no-match .pc-mirror-bottom { color: #dc2626; }

.pc-mirror-divider {
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  border-radius: 1px;
  margin: 4px 0;
}

/* ══════════════════
   EXAMPLES
══════════════════ */
.pc-examples-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pc-example-btn {
  background: #f8f9ff;
  border: 1.5px solid #e2e8f0;
  border-radius: 20px;
  padding: 6px 16px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #4338ca;
  cursor: pointer;
  transition: all 0.15s;
  font-family: 'Courier New', monospace;
}

.pc-example-btn:hover {
  background: #ede9fe;
  border-color: #a5b4fc;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(99,102,241,0.12);
}

/* ══════════════════
   DARK MODE
══════════════════ */
body.dark-mode .pc-input-section,
body.dark-mode .pc-result-section {
  background: #0f172a;
  border-color: #1e293b;
}

body.dark-mode label.pc-section-title,
body.dark-mode .pc-section-title { color: #e2e8f0; }

body.dark-mode label.pc-section-title svg,
body.dark-mode .pc-section-title svg { stroke: #a5b4fc; }

body.dark-mode .pc-textarea {
  background: #1e293b;
  border-color: #334155;
  color: #e2e8f0;
}

body.dark-mode .pc-textarea:focus { border-color: #818cf8; }

body.dark-mode .pc-clear-btn {
  background: #1e293b;
  border-color: #334155;
  color: #94a3b8;
}

body.dark-mode .pc-clear-btn:hover { background: #334155; color: #ef4444; }

body.dark-mode .pc-checkbox-label { color: #94a3b8; }
body.dark-mode .pc-checkmark { background: #1e1b4b; border-color: #312e81; }

body.dark-mode .pc-result-box {
  background: #1e293b;
  border-color: #334155;
}

body.dark-mode .pc-result-box.is-palindrome {
  background: #052e16;
  border-color: #166534;
}

body.dark-mode .pc-result-box.not-palindrome {
  background: #2d0a0a;
  border-color: #7f1d1d;
}

body.dark-mode .pc-result-text { color: #e2e8f0; }
body.dark-mode .pc-result-box.is-palindrome  .pc-result-text { color: #4ade80; }
body.dark-mode .pc-result-box.not-palindrome .pc-result-text { color: #f87171; }
body.dark-mode .pc-result-sub { color: #94a3b8; }

body.dark-mode .pc-details-box,
body.dark-mode .pc-mirror-box { background: #1e293b; border-color: #334155; }

body.dark-mode .pc-detail-label,
body.dark-mode .pc-mirror-label { color: #475569; }

body.dark-mode .pc-detail-val { color: #e2e8f0; }

body.dark-mode .pc-example-btn {
  background: #1e1b4b;
  border-color: #312e81;
  color: #a5b4fc;
}

body.dark-mode .pc-example-btn:hover { background: #2e1b6b; border-color: #6366f1; }

/* ══════════════════
   RESPONSIVE
══════════════════ */
@media (max-width: 700px) {
  #main-section { grid-template-columns: 1fr; }
  .pc-mirror-top, .pc-mirror-bottom { font-size: 0.85rem; }
  .pc-mirror-char { min-width: 20px; }
}