:root {
  --bg: #f4f1eb;
  --bg-deep: #ece6dd;
  --panel-strong: rgba(255, 255, 255, 0.98);
  --line: rgba(93, 74, 54, 0.1);
  --text: #261d16;
  --muted: #6f5f52;
  --accent: #c8683c;
  --accent-deep: #9a4b27;
  --teal: #2d5d60;
  --teal-soft: rgba(45, 93, 96, 0.1);
  --shadow: 0 14px 34px rgba(58, 42, 28, 0.08);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background:
    radial-gradient(circle at top left, rgba(200, 104, 60, 0.1), transparent 28%),
    radial-gradient(circle at bottom right, rgba(45, 93, 96, 0.08), transparent 26%),
    linear-gradient(180deg, var(--bg), var(--bg-deep));
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: transparent;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0)),
    radial-gradient(circle at top, rgba(255, 255, 255, 0.35), transparent 42%);
}

button {
  font: inherit;
}

.mobile-shell {
  width: min(100%, 560px);
  margin: 0 auto;
  padding: 16px 14px 32px;
}

.feedback {
  display: none;
  margin-bottom: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  line-height: 1.5;
  border: 1px solid rgba(93, 74, 54, 0.08);
}

.feedback.success {
  display: block;
  color: var(--teal);
  background: var(--teal-soft);
}

.feedback.error {
  display: block;
  color: #9c3932;
  background: rgba(156, 57, 50, 0.1);
}

.page-root {
  display: grid;
  gap: 14px;
}

.counter-page {
  gap: 18px;
}

.top-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 6px;
  border-radius: 18px;
  border: 1px solid rgba(93, 74, 54, 0.08);
  background: rgba(255, 255, 255, 0.84);
  box-shadow: var(--shadow);
}

.top-tab {
  min-height: 48px;
  border: none;
  border-radius: 12px;
  color: var(--muted);
  background: transparent;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
}

.top-tab.active {
  color: white;
  background: var(--teal);
}

.counter-tabs-shell,
.counter-sheet,
.print-sheet {
  border-radius: 24px;
  border: 1px solid rgba(93, 74, 54, 0.08);
  background:
    linear-gradient(180deg, rgba(252, 250, 246, 0.98), rgba(255, 255, 255, 0.95));
  box-shadow: var(--shadow);
}

.counter-tabs-shell {
  overflow: hidden;
  position: sticky;
  top: 12px;
  z-index: 5;
}

.counter-tabs {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(72px, 1fr);
  overflow-x: auto;
  scrollbar-width: none;
  background: rgba(255, 255, 255, 0.7);
}

.counter-tabs::-webkit-scrollbar {
  display: none;
}

.counter-tab {
  min-height: 58px;
  border: none;
  border-right: 1px solid var(--line);
  border-radius: 0;
  color: var(--accent-deep);
  font-size: 1.08rem;
  font-weight: 700;
  background: transparent;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: none;
  transition: background 120ms ease, color 120ms ease;
}

.counter-tab:last-child {
  border-right: none;
}

.counter-tab.active {
  color: white;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
}

.counter-sheet {
  min-height: 62vh;
  padding: 16px 16px 22px;
}

.print-sheet {
  display: grid;
  gap: 14px;
  padding: 18px 18px 22px;
}

.field-label {
  display: block;
  color: var(--muted);
  font-weight: 800;
  font-size: 0.92rem;
}

.print-textarea,
.print-field select {
  width: 100%;
  border: 1px solid rgba(93, 74, 54, 0.12);
  border-radius: 14px;
  background: white;
  color: var(--text);
  font: inherit;
  outline: none;
}

.print-textarea {
  min-height: 220px;
  padding: 14px;
  resize: vertical;
  line-height: 1.55;
}

.print-settings {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.print-field {
  display: grid;
  gap: 8px;
}

.print-field select {
  min-height: 46px;
  padding: 0 12px;
}

.print-submit {
  min-height: 48px;
  border: none;
  border-radius: 14px;
  color: white;
  background: var(--teal);
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
}

.counter-list {
  display: grid;
  gap: 12px;
}

.counter-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 14px 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(93, 74, 54, 0.08);
  background: linear-gradient(180deg, rgba(248, 246, 241, 0.96), rgba(255, 255, 255, 0.94));
}

.counter-line-code {
  font-size: 1.58rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: 0.02em;
}

.counter-line-ops {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(93, 74, 54, 0.08);
}

.counter-op-button {
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: none;
  border-radius: 50%;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: none;
}

.counter-op-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.counter-op-button-minus {
  color: #7f5f4a;
  background: rgba(127, 95, 74, 0.12);
}

.counter-op-button-plus {
  color: white;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
}

.counter-line-value {
  min-width: 52px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  text-align: center;
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--accent-deep);
  border-radius: 14px;
  background: rgba(246, 241, 235, 0.9);
}

.empty-state {
  padding: 22px 16px;
  text-align: center;
  color: var(--muted);
  border-radius: 22px;
  border: 1px dashed rgba(111, 81, 42, 0.22);
  background: rgba(255, 249, 243, 0.74);
  line-height: 1.6;
}

@media (min-width: 700px) {
  .mobile-shell {
    width: min(100% - 32px, 860px);
    padding-left: 0;
    padding-right: 0;
  }

  .counter-tab {
    min-height: 62px;
  }
}

@media (max-width: 520px) {
  .mobile-shell {
    padding-top: 14px;
  }

  .counter-tabs-shell {
    top: 8px;
  }

  .counter-tab {
    min-height: 54px;
    font-size: 1rem;
  }

  .counter-sheet {
    min-height: 58vh;
    padding: 14px 12px 20px;
  }

  .print-settings {
    grid-template-columns: 1fr;
  }

  .counter-line-code {
    font-size: 1.36rem;
  }

  .counter-op-button {
    min-width: 40px;
    min-height: 40px;
  }

  .counter-line-value {
    min-width: 40px;
    min-height: 40px;
    font-size: 1.5rem;
  }
}
