@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Noto+Sans+KR:wght@300;400;500;700&display=swap');

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

:root {
  --bg: #fdf8f4;
  --surface: #ffffff;
  --surface2: #faf5f0;
  --border: #f0e4da;
  --pink: #d4849a;
  --pink-glow: #d4849a20;
  --accent: #b07aaf;
  --text: #3d3535;
  --text-dim: #9a8a85;
  --radius: 16px;
}

body {
  font-family: 'Inter', 'Noto Sans KR', sans-serif;
  background: linear-gradient(180deg, #fdf8f4 0%, #fef0f0 40%, #fdf5f0 100%);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* ── Cherry Blossom Canvas ── */
#sakura-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 0;
}

/* ── Main Layout ── */
.app {
  position: relative;
  z-index: 1;
  max-width: 960px;
  margin: 0 auto;
  padding: 40px 24px 60px;
}

/* ── Header ── */
.header {
  text-align: center;
  margin-bottom: 48px;
}
.header h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #f2a0b7, #c084fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.header p {
  color: var(--text-dim);
  font-size: 0.9rem;
  margin-top: 8px;
  font-weight: 300;
}

/* ── Mode Toggle ── */
.mode-toggle {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-bottom: 32px;
  background: var(--surface);
  border-radius: 12px;
  padding: 4px;
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
  border: 1px solid var(--border);
}
.mode-btn {
  padding: 10px 24px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text-dim);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: inherit;
}
.mode-btn.active {
  background: linear-gradient(135deg, #f8dde4, #f0d4ef);
  color: var(--pink);
  box-shadow: 0 4px 12px var(--pink-glow);
}
.mode-btn:hover:not(.active) {
  color: var(--text);
}

/* ── Converter Panel ── */
.converter {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 16px;
  align-items: stretch;
  margin-bottom: 32px;
}
@media (max-width: 700px) {
  .converter {
    grid-template-columns: 1fr;
  }
  .arrow-col { transform: rotate(90deg); }
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  transition: border-color 0.3s;
}
.panel {
  box-shadow: 0 2px 12px rgba(0,0,0,0.04);
}
.panel:focus-within {
  border-color: var(--pink);
  box-shadow: 0 4px 20px var(--pink-glow);
}
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.panel-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-dim);
}
.copy-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface2);
  color: var(--text-dim);
  font-size: 0.7rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.25s;
}
.copy-btn:hover {
  border-color: var(--pink);
  color: var(--pink);
  background: #fef5f7;
}
.copy-btn.copied {
  border-color: #86c68a;
  color: #5a9e5e;
  background: #f0faf0;
}
.copy-btn svg {
  width: 13px; height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.panel textarea {
  flex: 1;
  min-height: 140px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  color: var(--text);
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.9rem;
  resize: vertical;
  outline: none;
  transition: border-color 0.3s;
  line-height: 1.6;
}
.panel textarea:focus {
  border-color: var(--pink);
}
.panel textarea::placeholder {
  color: var(--text-dim);
  opacity: 0.5;
}

/* ── Arrow ── */
.arrow-col {
  display: flex;
  align-items: center;
  justify-content: center;
}
.arrow-btn {
  width: 48px; height: 48px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--pink);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
}
.arrow-btn:hover {
  background: linear-gradient(135deg, #f8dde4, #f0d4ef);
  box-shadow: 0 4px 16px var(--pink-glow);
  transform: scale(1.1);
}
.arrow-btn svg {
  width: 20px; height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── Preview ── */
.preview-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  min-height: 80px;
  text-align: center;
}
.preview-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-dim);
  margin-bottom: 16px;
}
.preview-content {
  font-size: 1.4rem;
  color: var(--text);
  overflow-x: auto;
  padding: 8px 0;
}
.preview-content .katex { font-size: 1.6em; }
.preview-error {
  color: #f87171;
  font-size: 0.85rem;
  font-style: italic;
}

/* ── Examples ── */
.examples {
  margin-top: 32px;
}
.examples-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-dim);
  margin-bottom: 12px;
  text-align: center;
}
.example-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}
.example-chip {
  padding: 8px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-dim);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.3s;
  font-family: 'JetBrains Mono', monospace;
}
.example-chip:hover {
  border-color: var(--pink);
  color: var(--pink);
  background: #fef5f7;
  box-shadow: 0 2px 10px var(--pink-glow);
}

/* ── Footer ── */
.footer {
  margin-top: 48px;
  color: var(--text-dim);
  font-size: 0.75rem;
}
.license-box {
  background: rgba(255,255,255,0.72);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
  text-align: left;
  line-height: 1.65;
  box-shadow: 0 2px 12px rgba(0,0,0,0.03);
}
.license-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text);
  margin-bottom: 8px;
}
.license-box p + p {
  margin-top: 8px;
}
.footer a {
  color: var(--pink);
  text-decoration: none;
}
