:root {
  --color-bg: #fff8ed;
  --color-surface: #fffdf8;
  --color-ink: #2b1b12;
  --color-accent: #e8551a;
  --color-accent-strong: #c43f0f;
  --color-accent-soft: #ffe4d1;
  --color-muted: #8a7a6d;
  --color-error: #c0392b;
  --radius-lg: 20px;
  --radius-md: 12px;
  --shadow-offset: 8px;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  font-weight: 500;
  color: var(--color-ink);
  background-color: var(--color-bg);
  background-image: radial-gradient(circle, rgba(43, 27, 18, 0.06) 1.5px, transparent 1.5px);
  background-size: 22px 22px;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}

.page {
  width: 100%;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.card {
  width: 100%;
  background-color: var(--color-surface);
  border: 3px solid var(--color-ink);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-offset) var(--shadow-offset) 0 var(--color-ink);
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  animation: card-rise 0.5s ease-out both;
}

.eyebrow {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--color-accent-strong);
  text-align: center;
}

.title {
  font-size: 26px;
  font-weight: 900;
  text-align: center;
  line-height: 1.3;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.title-icon {
  font-size: 28px;
  display: inline-block;
  transform: rotate(-8deg);
}

.title-highlight {
  position: relative;
  z-index: 0;
}

.title-highlight::after {
  content: "";
  position: absolute;
  left: -4px;
  right: -4px;
  bottom: 2px;
  height: 10px;
  background-color: var(--color-accent-soft);
  z-index: -1;
  transform: rotate(-1.5deg);
  border-radius: 4px;
}

.step-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-muted);
  text-align: center;
}

.batch-step,
.search-step {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.search-step-hidden {
  display: none;
}

.batch-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  max-height: 45vh;
  overflow-y: auto;
}

.batch-item {
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  color: var(--color-accent-strong);
  background-color: var(--color-surface);
  border: 2px solid var(--color-accent);
  border-radius: 999px;
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color 0.1s ease, color 0.1s ease, transform 0.1s ease;
}

.batch-item:hover {
  background-color: var(--color-accent);
  color: var(--color-surface);
}

.batch-item:active {
  transform: scale(0.95);
}

.batch-tag {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 14px;
  background-color: var(--color-accent-soft);
  border-radius: var(--radius-md);
}

.batch-tag-name {
  font-size: 14px;
  font-weight: 700;
}

.batch-tag-change {
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--color-accent-strong);
  background: none;
  border: none;
  text-decoration: underline;
  cursor: pointer;
  padding: 4px;
  touch-action: manipulation;
}

.search-box {
  position: relative;
  display: flex;
}

.input {
  width: 100%;
  padding: 14px 16px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 500;
  color: var(--color-ink);
  background-color: var(--color-surface);
  border: 2px solid var(--color-ink);
  border-radius: var(--radius-md);
  appearance: none;
  -webkit-appearance: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.input::placeholder {
  color: var(--color-muted);
}

.input:disabled {
  background-color: rgba(43, 27, 18, 0.05);
  color: var(--color-muted);
  cursor: not-allowed;
}

.input:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 4px 4px 0 var(--color-accent-soft);
  transform: translate(-2px, -2px);
}

.suggestions {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  list-style: none;
  background-color: var(--color-surface);
  border: 2px solid var(--color-ink);
  border-radius: var(--radius-md);
  max-height: 45vh;
  overflow-y: auto;
  box-shadow: 5px 5px 0 var(--color-ink);
  z-index: 10;
  -webkit-overflow-scrolling: touch;
}

.suggestions:empty {
  display: none;
  border: none;
  box-shadow: none;
}

.suggestion-item {
  padding: 14px 16px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  touch-action: manipulation;
  animation: item-in 0.2s ease-out both;
  border-bottom: 1px solid rgba(43, 27, 18, 0.1);
}

.suggestion-item:last-child {
  border-bottom: none;
}

.suggestion-item:hover,
.suggestion-item:active {
  background-color: var(--color-accent-soft);
}

.result {
  min-height: 28px;
  display: flex;
  justify-content: center;
}

.goto-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 26px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  color: var(--color-surface);
  text-decoration: none;
  background-color: var(--color-accent);
  border: 3px solid var(--color-ink);
  border-radius: var(--radius-md);
  box-shadow: 5px 5px 0 var(--color-ink);
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  animation: pop-in 0.25s ease-out both;
}

.goto-btn:hover {
  background-color: var(--color-accent-strong);
}

.goto-btn:active {
  transform: translate(5px, 5px);
  box-shadow: 0 0 0 var(--color-ink);
}

.result-empty,
.result-error {
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  padding: 6px 4px;
}

.result-empty {
  color: var(--color-muted);
}

.result-error {
  color: var(--color-error);
}

.result-loading {
  color: var(--color-muted);
  animation: pulse 1.1s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.5;
  }
  50% {
    opacity: 1;
  }
}

@keyframes card-rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes pop-in {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .card,
  .suggestion-item,
  .goto-btn,
  .result-loading {
    animation: none;
  }
  .input:focus,
  .goto-btn:active {
    transform: none;
  }
}

@media (max-width: 480px) {
  body {
    padding: 16px 14px calc(16px + env(safe-area-inset-bottom));
    background-size: 18px 18px;
  }

  .card {
    padding: 26px 20px;
    border-radius: 16px;
    box-shadow: 6px 6px 0 var(--color-ink);
  }

  .title {
    font-size: 22px;
  }

  .input {
    padding: 13px 14px;
  }

  .goto-btn {
    width: 100%;
  }
}
