:root {
  --color-paper: #f4f1e8;
  --color-paper-deep: #ece7d9;
  --color-ink: #1c1b18;
  --color-ink-soft: #6b665b;
  --color-line: #d9d3c3;
  --color-accent: #d8442a;
  --color-accent-deep: #b0331d;
  --color-mark: #e0a92e;
  --font-display: Inter, Noto Sans TC, sans-serif;
  --font-body: Inter, Noto Sans TC, sans-serif;
  --font-mono: Inter, Noto Sans TC, sans-serif;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

.tool-intro {
  max-width: 64ch;
  margin-block: 24px 40px;
  color: #6b665b;
}

.mode-tabs {
  display: inline-flex;
  margin-bottom: 24px;
  border: 1.5px solid #1c1b18;
  border-radius: 2px;
  overflow: hidden;
}

.mode-tab {
  font-family: "Inter", "Noto Sans TC", sans-serif;
  font-size: 1rem;
  letter-spacing: 0.04em;
  padding: 8px 24px;
  color: #6b665b;
  background: #f4f1e8;
  border: none;
  border-right: 1.5px solid #1c1b18;
  cursor: pointer;
  transition: color 0.4s cubic-bezier(0.22, 0.61, 0.36, 1), background-color 0.4s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.mode-tab:last-child {
  border-right: none;
}
.mode-tab:hover {
  color: #1c1b18;
}
.mode-tab.is-active {
  color: #f4f1e8;
  background: #1c1b18;
}
.mode-tab:focus-visible {
  outline: 2px solid #d8442a;
  outline-offset: 2px;
}

.opt-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.opt-chip {
  font-family: "Inter", "Noto Sans TC", sans-serif;
  font-size: 1rem;
  letter-spacing: 0.03em;
  padding: 4px 16px;
  color: #6b665b;
  background: #f4f1e8;
  border: 1px solid #d9d3c3;
  border-radius: 2px;
  cursor: pointer;
  transition: color 0.4s cubic-bezier(0.22, 0.61, 0.36, 1), border-color 0.4s cubic-bezier(0.22, 0.61, 0.36, 1), background-color 0.4s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.opt-chip code {
  font-family: "Inter", "Noto Sans TC", sans-serif;
  color: #d8442a;
}
.opt-chip:hover {
  color: #1c1b18;
  border-color: #1c1b18;
}
.opt-chip.is-active {
  color: #f4f1e8;
  background: #d8442a;
  border-color: #d8442a;
}
.opt-chip.is-active code {
  color: #f4f1e8;
}
.opt-chip:focus-visible {
  outline: 2px solid #d8442a;
  outline-offset: 2px;
}

.convert-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}

.convert-pane {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.pane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.text-area {
  width: 100%;
  min-height: 340px;
  padding: 16px;
  font-family: "Inter", "Noto Sans TC", sans-serif;
  font-size: 1rem;
  line-height: 1.7;
  color: #1c1b18;
  background: #f4f1e8;
  border: 1.5px solid #1c1b18;
  border-radius: 2px;
  box-shadow: 6px 6px 0 rgba(28, 27, 24, 0.12);
  resize: vertical;
  transition: border-color 0.4s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.text-area.is-mono {
  font-family: "Inter", "Noto Sans TC", sans-serif;
  font-size: 1rem;
  word-break: break-all;
}
.text-area::placeholder {
  color: #6b665b;
}
.text-area:focus {
  outline: none;
  border-color: #d8442a;
}
.text-area.is-error {
  border-color: #d8442a;
  box-shadow: 6px 6px 0 rgba(216, 68, 42, 0.18);
}

.pane-meta {
  margin: 0;
  font-family: "Inter", "Noto Sans TC", sans-serif;
  font-size: 1rem;
  letter-spacing: 0.03em;
  color: #6b665b;
  font-variant-numeric: tabular-nums;
}

.copy-hint {
  min-height: 1.4em;
  margin: 16px 0 0;
  font-family: "Inter", "Noto Sans TC", sans-serif;
  font-size: 1rem;
  color: #d8442a;
}

.notice {
  margin: 16px 0 0;
  padding: 16px;
  font-family: "Inter", "Noto Sans TC", sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  color: #d8442a;
  background: #f4f1e8;
  border: 1px solid #d8442a;
  border-radius: 2px;
}

.img-result-top {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  margin-bottom: 24px;
}

.img-preview-box {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  border: 1px solid #d9d3c3;
  border-radius: 2px;
  background-color: #f4f1e8;
  background-image: linear-gradient(45deg, #d9d3c3 25%, transparent 25%), linear-gradient(-45deg, #d9d3c3 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #d9d3c3 75%), linear-gradient(-45deg, transparent 75%, #d9d3c3 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}
.img-preview-box img {
  max-width: 100%;
  max-height: 180px;
  display: block;
}

.img-info {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.img-info div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid #d9d3c3;
}
.img-info dt {
  font-family: "Inter", "Noto Sans TC", sans-serif;
  font-size: 1rem;
  letter-spacing: 0.03em;
  color: #6b665b;
}
.img-info dd {
  margin: 0;
  font-family: "Inter", "Noto Sans TC", sans-serif;
  font-size: 1rem;
  color: #1c1b18;
  text-align: right;
  word-break: break-all;
  font-variant-numeric: tabular-nums;
}

.out-block {
  margin-bottom: 24px;
}

.out-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.code-block {
  margin: 0;
  padding: 16px;
  max-height: 200px;
  overflow: auto;
  font-family: "Inter", "Noto Sans TC", sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  color: #1c1b18;
  background: #ece7d9;
  border: 1px solid #d9d3c3;
  border-radius: 2px;
  white-space: pre-wrap;
  word-break: break-all;
}

@media (max-width: 860px) {
  .convert-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }
  .text-area {
    min-height: 220px;
  }
  .img-result-top {
    grid-template-columns: minmax(0, 1fr);
  }
  .img-preview-box img {
    max-height: 220px;
  }
}
