:root {
  --bg: #ffffff;
  --fg: #1a1a1a;
  --muted: #9a9aa2;
  --faint: #e6e6ea;
  --btn: #efeff1;
  --btn-hover: #e4e4e8;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

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

html,
body {
  height: 100%;
}

body {
  font-family: var(--mono);
  color: var(--fg);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---------- top bar ---------- */
.topbar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  border-bottom: 1px solid var(--faint);
}

.brand {
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* ---------- stage: two cells split the page ---------- */
.stage {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.cell {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

/* the single divider between the two cells */
.output-cell {
  border-left: 1px solid var(--faint);
}

.cell-body {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  overflow-y: auto;
}

/* ---------- input ---------- */
.editable {
  width: 100%;
  max-height: 100%;
  overflow-y: auto;
  font-family: var(--mono);
  font-size: clamp(20px, 2.5vw, 36px);
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: -0.01em;
  text-align: center;
  outline: none;
  white-space: pre-wrap;
  word-break: break-word;
}

.editable:empty::before {
  content: attr(data-placeholder);
  color: var(--muted);
  font-weight: 400;
}

/* ---------- convert button: anchored to bottom-center of the first cell ---------- */
.convert-btn {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: "Inter", sans-serif;
  font-size: 2rem;
  font-weight: 600;
  color: #b2b2b2;
  background: var(--btn);
  border: none;
  border-radius: 8px;
  padding: 12px 16px;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background 0.18s ease,
    color 0.18s ease;
}

.convert-btn:hover:not(:disabled) {
  background: var(--btn-hover);
  color: var(--fg);
}

.convert-btn:disabled {
  color: var(--muted);
  cursor: not-allowed;
}

/* ---------- output ---------- */
.emoji-output {
  font-size: clamp(40px, 6vw, 78px);
  line-height: 1.3;
  text-align: center;
  word-break: break-word;
  animation: fade 0.4s ease;
}

.emoji-output:empty::before {
  content: attr(data-placeholder);
  font-size: clamp(20px, 2.5vw, 36px);
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: -0.01em;
  color: var(--muted);
  animation: none;
}

.emoji-output.is-error {
  font-size: 14px;
  font-weight: 400;
  color: #b3261e;
  line-height: 1.7;
  letter-spacing: 0;
  text-transform: none;
  animation: none;
}

@keyframes fade {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---------- loading ---------- */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
}

.dots {
  display: inline-flex;
  gap: 7px;
}

.dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  animation: blink 1.1s ease-in-out infinite;
}

.dots span:nth-child(2) {
  animation-delay: 0.18s;
}

.dots span:nth-child(3) {
  animation-delay: 0.36s;
}

@keyframes blink {
  0%,
  100% {
    opacity: 0.25;
  }
  50% {
    opacity: 1;
  }
}

[hidden] {
  display: none !important;
}

/* ---------- responsive: stack on narrow screens ---------- */
@media (max-width: 640px) {
  .stage {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1fr;
  }
  .output-cell {
    border-left: none;
    border-top: 1px solid var(--faint);
  }
  .cell-body {
    padding: 28px;
  }
}
