@import url('https://fonts.googleapis.com/css2?family=Zen+Kaku+Gothic+New:wght@400;500;700&family=Kaisei+Tokumin:wght@600&display=swap');

:root {
  --bg: #f6f3ee;
  --bg-accent: #efe7db;
  --card: #ffffff;
  --ink: #1f1b17;
  --muted: #6b625a;
  --accent: #b3472f;
  --accent-2: #1f6d73;
  --line: #e4ddd2;
  --shadow: 0 10px 30px rgba(31, 27, 23, 0.08);
  --bg-base: var(--bg);
  --bg-radial-1: #fbeedc;
  --bg-radial-2: #e6f2f1;
  --bg-grid: rgba(31, 27, 23, 0.04);
}

* {
  box-sizing: border-box;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

body {
  margin: 0;
  font-family: 'Zen Kaku Gothic New', sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 400px at 10% -20%, var(--bg-radial-1) 0%, transparent 60%),
    radial-gradient(900px 300px at 90% -10%, var(--bg-radial-2) 0%, transparent 55%),
    repeating-linear-gradient(135deg, var(--bg-grid) 0 1px, transparent 1px 12px),
    var(--bg-base);
  min-height: 100vh;
}

body.share-on.share-A {
  --bg-base: #eaf7f6;
  --bg-radial-1: #d2f2ef;
  --bg-radial-2: #def4ff;
}

body.share-on.share-B {
  --bg-base: #f9f1e3;
  --bg-radial-1: #fde6c9;
  --bg-radial-2: #f3efe3;
}

body.share-on.share-C {
  --bg-base: #eef2fb;
  --bg-radial-1: #dfe8fb;
  --bg-radial-2: #e5f7f0;
}

html,
body {
  overscroll-behavior-y: none;
}

body.numpad-open {
  padding-bottom: 170px;
}

#total {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 18px 20px;
  background: linear-gradient(120deg, #fff2de, #f6fbfa);
  border-bottom: 1px solid var(--line);
  font-family: 'Kaisei Tokumin', serif;
  font-size: 20px;
  letter-spacing: 0.02em;
  box-shadow: 0 2px 12px rgba(31, 27, 23, 0.08);
}

#total span {
  color: var(--accent);
  font-size: 24px;
}

.scroll-top {
  position: fixed;
  top: 56px;
  left: 14px;
  transform: none;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--accent-2);
  font-size: 18px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 18px rgba(31, 27, 23, 0.18);
  cursor: pointer;
  z-index: 12;
}

.scroll-top:active {
  transform: translateX(-50%) scale(0.97);
}

.meta-form {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 20px 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  align-items: flex-end;
}

.meta-field {
  flex: 1 1 260px;
  min-width: 220px;
  max-width: 360px;
}

.meta-field label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.meta-field input,
.meta-field select {
  width: 100%;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  font-size: 15px;
}

.share-key-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.share-key-chip {
  border: 1px solid rgba(31, 109, 115, 0.35);
  background: #f0fbfb;
  color: var(--accent-2);
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
}

.share-key-chip.is-active {
  background: #1f6d73;
  color: #fff;
  border-color: transparent;
}

.meta-field input:focus,
.meta-field select:focus {
  outline: 2px solid rgba(31, 109, 115, 0.25);
  border-color: var(--accent-2);
}

.meta-actions {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.save-button {
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  padding: 10px 16px;
  border-radius: 12px;
  cursor: pointer;
}

.save-button:disabled {
  opacity: 0.6;
  cursor: default;
}

.history-link {
  display: inline-flex;
  align-items: center;
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  font-size: 14px;
}

.clear-button {
  border: 1px solid rgba(179, 71, 47, 0.35);
  background: #fff6f3;
  color: var(--accent);
  font-size: 14px;
  padding: 10px 16px;
  border-radius: 12px;
  cursor: pointer;
}

.clear-button:active {
  transform: translateY(1px);
}

.share-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(31, 109, 115, 0.35);
  background: #fff;
  color: var(--ink);
  font-size: 14px;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.share-toggle-label {
  font-weight: 600;
  letter-spacing: 0.02em;
}

.share-toggle-track {
  position: relative;
  width: 44px;
  height: 24px;
  background: #d7e6e6;
  border-radius: 999px;
  transition: background 0.2s ease;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.12);
}

.share-toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
  transition: transform 0.2s ease;
}

.share-toggle.is-active {
  border-color: rgba(31, 109, 115, 0.7);
  background: #f0fbfb;
  color: var(--accent-2);
}

.share-toggle.is-active .share-toggle-track {
  background: #1f6d73;
}

.share-toggle.is-active .share-toggle-thumb {
  transform: translateX(20px);
}

.save-status {
  display: block;
  flex: 1 0 100%;
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
  min-height: 18px;
  margin-top: 2px;
}

.save-status[data-state="error"] {
  color: var(--accent);
}

.save-status[data-state="success"] {
  color: var(--accent-2);
}

.upload-form {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px 10px;
}

.upload-form-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: flex-end;
}

.upload-field {
  min-width: 220px;
  flex: 1 1 320px;
}

.upload-field label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.upload-field input[type="file"] {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  font-size: 14px;
}

.upload-button {
  border: none;
  background: var(--accent-2);
  color: #fff;
  font-size: 14px;
  padding: 10px 16px;
  border-radius: 12px;
  cursor: pointer;
}

.upload-status {
  font-size: 12px;
  color: var(--muted);
  min-height: 16px;
}

.upload-status[data-state="error"] {
  color: var(--accent);
}

.upload-status[data-state="success"] {
  color: var(--accent-2);
}

.toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding: 18px 20px 8px;
  max-width: 900px;
  margin: 0 auto;
  position: static;
}

.search {
  flex: 0 0 130px;
  max-width: 130px;
}

.search label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.search input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  font-size: 16px;
  box-shadow: inset 0 1px 0 rgba(0, 0, 0, 0.02);
}

.search input:focus {
  outline: 2px solid rgba(31, 109, 115, 0.25);
  border-color: var(--accent-2);
}

.filters {
  min-width: 160px;
}

.filters label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.filters select {
  width: 100%;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  font-size: 15px;
}

.filters select:focus {
  outline: 2px solid rgba(31, 109, 115, 0.25);
  border-color: var(--accent-2);
}

.count {
  font-size: 14px;
  color: var(--muted);
  white-space: nowrap;
  position: fixed;
  top: 78px;
  right: 18px;
  z-index: 11;
  background: rgba(255, 255, 255, 0.9);
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(228, 221, 210, 0.8);
  box-shadow: 0 6px 16px rgba(31, 27, 23, 0.1);
  pointer-events: none;
}

#list {
  max-width: 1200px;
  margin: 0 auto 40px;
  padding: 10px 20px 40px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px 18px;
  margin: 0;
  box-shadow: var(--shadow);
  transition: padding 1200ms ease, transform 1200ms ease, opacity 1200ms ease, background-color 1200ms ease;
  flex: 1 1 calc(50% - 8px);
}

.row-top {
  display: flex;
  align-items: center;
  gap: 12px;
}

.row-bottom {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
  justify-content: flex-start;
}

.row:nth-child(odd) {
  background: #fcfaf7;
}

.name {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  min-width: 0;
}

.name .label {
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.name .unit {
  font-size: 12px;
  color: var(--accent-2);
  border: 1px solid rgba(31, 109, 115, 0.3);
  padding: 2px 8px;
  border-radius: 999px;
  background: #eef7f6;
}

.name .qty-display {
  font-size: 12px;
  color: var(--accent);
  border: 1px solid rgba(179, 71, 47, 0.25);
  padding: 2px 8px;
  border-radius: 999px;
  background: #fff1ee;
}

.name .editor-display {
  font-size: 12px;
  color: var(--accent-2);
  border: 1px solid rgba(31, 109, 115, 0.25);
  padding: 2px 8px;
  border-radius: 999px;
  background: #e9f6f6;
}

.meta {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
}

.meta-text {
  font-size: 12px;
  color: var(--muted);
  border: 1px solid #d9c6ab;
  padding: 4px 8px;
  border-radius: 8px;
  background: #fbf3e6;
  white-space: nowrap;
}

.meta-text.category-text {
  color: #8a5a1f;
  border-color: #d9b98a;
  background: #f8ecd7;
}

.meta-text.location-text {
  color: #5b4f3b;
  border-color: #d6c7ae;
  background: #f4eee3;
  cursor: pointer;
}

.location-dialog {
  border: none;
  border-radius: 16px;
  padding: 0;
  width: min(92vw, 360px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.location-dialog::backdrop {
  background: rgba(0, 0, 0, 0.35);
}

.location-dialog-inner {
  display: grid;
  gap: 14px;
  padding: 20px;
}

.location-dialog-inner h2 {
  font-size: 16px;
  margin: 0;
}

.location-select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 14px;
}

.location-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.location-cancel,
.location-ok {
  border: none;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 14px;
}

.location-cancel {
  background: #eee;
  color: #333;
}

.location-ok {
  background: #1f6d73;
  color: #fff;
}

.meta-text.supplier-text {
  color: #1f6d73;
  border-color: #9cced1;
  background: #e6f5f6;
}

.price {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.price-label,
.price-unit {
  font-size: 12px;
  color: var(--muted);
}

.price-input {
  width: 112px;
  padding: 6px 8px;
  border-radius: 10px;
  border: 1px solid var(--line);
  font-size: 14px;
  text-align: left;
  background: #fff;
}

.price-input:focus {
  outline: 2px solid rgba(179, 71, 47, 0.2);
  border-color: var(--accent);
}

.qty {
  width: 144px;
  padding: 8px 10px;
  font-size: 18px;
  border-radius: 12px;
  border: 1px solid var(--line);
  text-align: right;
  background: #fff;
  margin-left: auto;
}

.qty:focus {
  outline: 2px solid rgba(179, 71, 47, 0.25);
  border-color: var(--accent);
}

.qty.is-active,
.price-input.is-active {
  outline: 2px solid rgba(31, 109, 115, 0.35);
  border-color: var(--accent-2);
  background: #fff;
}

.row.row-active {
  box-shadow: 0 12px 28px rgba(31, 27, 23, 0.18);
  border-color: rgba(31, 109, 115, 0.4);
}

.row.completed {
  opacity: 0.85;
  padding: 12px 16px;
  transform: scale(0.99);
  background: #f7f3ee;
}

.row.completed .price {
  display: none;
}

.row.completed .row-bottom {
  display: none;
}

.row.completed .name {
  font-size: 17px;
}

.row.completed .qty {
  background: #fff7ef;
  border-color: rgba(179, 71, 47, 0.25);
}

@media (max-width: 720px) {
  #total {
    font-size: 18px;
  }

  #total span {
    font-size: 22px;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .row {
    gap: 6px;
  }

  .row-bottom {
    flex-wrap: wrap;
  }

  .price {
    text-align: right;
  }

  .qty {
    width: 120px;
  }

  .price-input {
    width: 107px;
  }

  .meta-form {
    padding-top: 30px;
  }
}

@media (min-width: 768px) and (max-width: 1024px) {
  #list {
    padding: 10px 24px 40px;
    gap: 16px;
  }

  .row {
    padding: 12px 16px;
    margin: 10px 0;
  }

  .name {
    font-size: 18px;
  }

  .price {
    font-size: 13px;
  }

  .qty {
    font-size: 20px;
    height: 48px;
  }

  .price-input {
    width: 112px;
  }
}

@media (min-width: 1025px) {
  #list {
    gap: 16px;
  }
}

@media (max-width: 480px) {
  body {
    padding-bottom: 60px;
  }

  #total {
    position: sticky;
    top: 0;
    bottom: auto;
    left: 0;
    right: 0;
    border-top: none;
    border-bottom: 1px solid var(--line);
    padding: 16px 18px;
    font-size: 18px;
  }

  #total span {
    font-size: 22px;
  }

  .scroll-top {
    top: 56px;
    left: 10px;
    transform: none;
    width: 34px;
    height: 34px;
    font-size: 16px;
  }

  .scroll-top {
    display: inline-flex;
  }

  .toolbar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 10px;
    padding: 10px 16px 4px;
  }

  .search {
    grid-column: 1 / -1;
  }

  .count {
    grid-column: 1 / -1;
    top: 10px;
    right: 10px;
    font-size: 12px;
    padding: 5px 8px;
  }

  .search label,
  .filters label {
    margin-bottom: 4px;
  }

  .search input {
    font-size: 18px;
    padding: 14px 14px;
  }

  #list {
    padding: 10px 16px 60px;
  }

  .row {
    padding: 12px 14px;
  }

  .row-top {
    flex-wrap: wrap;
    gap: 10px;
  }

  .name {
    font-size: 18px;
    flex: 1 1 auto;
    min-width: 0;
    flex-wrap: nowrap;
  }

  .price {
    font-size: 13px;
    width: 100%;
    justify-content: flex-start;
  }

  .qty {
    font-size: 20px;
    padding: 10px 12px;
    height: 48px;
    width: 100%;
    margin-left: 0;
    text-align: left;
  }

  .filters {
    width: 100%;
    min-width: 0;
  }

  .row-bottom {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .meta {
    display: none;
  }

  .name .label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .upload-form {
    padding: 0 16px 6px;
  }

  .upload-form-inner {
    gap: 8px;
  }
}

.history-header {
  max-width: 1200px;
  margin: 20px auto 0;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.history-title {
  font-family: 'Kaisei Tokumin', serif;
  font-size: 20px;
}

.history-back {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  font-size: 14px;
}

.history-status {
  max-width: 1200px;
  margin: 10px auto 0;
  padding: 8px 16px;
  border-radius: 12px;
  font-size: 13px;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
}

.history-status[data-state="success"] {
  color: var(--accent-2);
}

.history-status[data-state="error"] {
  color: var(--accent);
}

.history {
  max-width: 1200px;
  margin: 16px auto 80px;
  padding: 0 20px;
}

.history-empty {
  color: var(--muted);
  font-size: 14px;
}

.history-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}

.history-card summary {
  cursor: pointer;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  list-style: none;
}

.history-card summary::-webkit-details-marker {
  display: none;
}

.history-meta {
  font-size: 13px;
  color: var(--muted);
}

.history-total {
  font-size: 14px;
  color: var(--accent);
  font-weight: 600;
}

.history-edit {
  margin-left: auto;
  text-decoration: none;
  color: #fff;
  background: var(--accent-2);
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 12px;
}

.history-delete {
  display: flex;
  justify-content: flex-end;
  margin: 6px 0 0;
}

.history-delete button {
  border: 1px solid var(--line);
  background: #fff3f0;
  color: var(--accent);
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
  font-size: 13px;
}

.history-table th,
.history-table td {
  padding: 8px 6px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.history-table th {
  color: var(--muted);
  font-weight: 500;
}

.history-table .num {
  text-align: right;
  white-space: nowrap;
}

.completed {
  max-width: 900px;
  margin: 0 auto 24px;
  padding: 0 20px 16px;
}

.completed-toggle {
  width: 100%;
  border: 1px dashed var(--line);
  background: #1f6d73;
  color: #fff;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  box-shadow: 0 8px 20px rgba(31, 109, 115, 0.25);
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.completed-toggle:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(31, 109, 115, 0.28);
}

.completed-toggle:active {
  transform: translateY(0);
}

.completed-list {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: max-height 350ms ease, opacity 350ms ease;
  overflow: hidden;
  max-height: 2000px;
}

.completed-list.is-collapsed {
  max-height: 0;
  opacity: 0;
}

.completed-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}

#completedCount {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  font-size: 13px;
}

.completed-hint {
  font-size: 12px;
  opacity: 0.9;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
}

.completed-caret {
  margin-left: auto;
  font-size: 18px;
}

.completed-empty {
  padding: 16px;
  border-radius: 12px;
  border: 1px dashed var(--line);
  background: #f3f0ea;
  color: var(--muted);
  font-size: 13px;
}


.toast {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translateX(-50%) translateY(-50%) scale(0.98);
  background: rgba(31, 109, 115, 0.98);
  color: #fff;
  padding: 14px 22px;
  border-radius: 14px;
  font-size: 18px;
  font-weight: 600;
  text-align: center;
  width: min(92vw, 640px);
  box-shadow: 0 16px 30px rgba(31, 27, 23, 0.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
  z-index: 30;
}

.toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(-50%) scale(1);
}

.numpad {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: #f4efe7;
  border-top: 1px solid var(--line);
  padding: 8px 12px calc(10px + env(safe-area-inset-bottom));
  box-shadow: 0 -14px 28px rgba(31, 27, 23, 0.18);
  transition: transform 200ms ease, opacity 200ms ease;
  z-index: 40;
}

.numpad.is-hidden {
  transform: translateY(105%);
  opacity: 0;
  pointer-events: none;
}

.numpad-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.numpad-title {
  font-weight: 600;
  color: var(--ink);
}

.numpad-close {
  border: none;
  background: #fff;
  color: var(--accent-2);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
}

.numpad-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.numpad-grid button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 14px;
  padding: 9px 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  touch-action: manipulation;
}

.numpad-grid .numpad-action {
  font-size: 14px;
  font-weight: 600;
  background: #fef6ea;
  color: var(--accent);
}

.numpad-grid .numpad-wide {
  grid-column: 1 / -1;
}

@media (max-width: 480px) {
  body.numpad-open {
    padding-bottom: 160px;
  }

  .numpad-grid button {
    padding: 8px 0;
    font-size: 17px;
  }
}

@media (max-width: 480px) {
  .completed {
    margin-bottom: 12px;
    padding: 0 16px 20px;
  }

  .toast {
    top: 50%;
    font-size: 16px;
    padding: 12px 16px;
  }
}

:root {
  --topbar-height: 56px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  background: rgba(255, 251, 244, 0.92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 10px 16px;
  min-height: var(--topbar-height);
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  font-family: 'Kaisei Tokumin', serif;
  font-size: 22px;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.nav-links {
  margin-left: auto;
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.nav-link {
  text-decoration: none;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 13px;
  color: var(--ink);
  white-space: nowrap;
}

.nav-link.is-active {
  border-color: transparent;
  background: var(--accent-2);
  color: #fff;
}

#total {
  top: var(--topbar-height);
  z-index: 40;
}

.scroll-top {
  top: calc(var(--topbar-height) + 6px);
}

@media (max-width: 720px) {
  .topbar-inner {
    padding: 10px 12px;
  }

  .brand {
    font-size: 18px;
  }
}

@media (max-width: 480px) {
  #total {
    top: var(--topbar-height);
  }

  .scroll-top {
    top: calc(var(--topbar-height) + 6px);
  }
}
