:root {
  color-scheme: dark;
  --bg: #080808;
  --surface: #121212;
  --surface-soft: #181818;
  --line: #2b2a24;
  --line-bright: #a77808;
  --gold: #f5b800;
  --gold-strong: #ffd23f;
  --text: #f5f5f2;
  --muted: #aaa9a2;
  --danger: #c56b5e;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

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

button {
  border: 0;
  font: inherit;
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.site-header {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: rgba(8, 8, 8, 0.96);
  backdrop-filter: blur(10px);
}

.site-header-inner {
  display: flex;
  align-items: center;
  gap: 18px;
  width: min(1480px, calc(100% - 28px));
  height: 76px;
  margin: 0 auto;
}

.home-page .site-header-inner {
  justify-content: center;
}

.site-logo {
  display: block;
  width: 112px;
  height: auto;
}

.site-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 850;
  letter-spacing: -0.025em;
}

.app-shell {
  width: min(1480px, calc(100% - 28px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 104px 0 48px;
}

.home-view {
  min-height: calc(100vh - 152px);
  display: grid;
  align-content: center;
  justify-items: center;
  text-align: center;
}

h1 {
  margin: 0;
  font-size: clamp(2.35rem, 6vw, 5rem);
  line-height: 1;
  letter-spacing: -0.04em;
}

.home-copy {
  max-width: 680px;
  margin: 18px 0 26px;
  color: var(--muted);
  font-size: 1.05rem;
}

.home-counter {
  display: grid;
  justify-items: center;
  gap: 5px;
  margin: 0 0 4px;
}

.home-counter strong {
  color: var(--gold-strong);
  font-size: clamp(2.4rem, 7vw, 4rem);
  line-height: 1;
}

.home-counter span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.personal-list-title {
  font-size: clamp(1.35rem, 3vw, 2rem);
  line-height: 1.15;
  letter-spacing: -0.025em;
}

.primary-action,
.ghost-action,
.copy-button,
.icon-button,
.filter,
.check-button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-weight: 800;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.primary-action {
  min-width: 180px;
  padding: 0 22px;
  border-color: var(--gold);
  background: var(--gold);
  color: #111;
}

.primary-action:hover {
  background: var(--gold-strong);
  transform: translateY(-1px);
}

.status-text {
  min-height: 24px;
  margin: 18px 0 0;
  color: var(--muted);
}

.list-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 0 18px;
}

.share-line {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(680px, 100%);
  margin: 14px 0 0;
  color: var(--muted);
}

#listLinkText {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-button,
.ghost-action,
.copy-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: 0 0 auto;
  padding: 0 12px;
}

.progress-card {
  min-width: 128px;
  padding: 16px 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  text-align: center;
}

.progress-card strong {
  display: block;
  color: var(--gold-strong);
  font-size: 1.65rem;
  line-height: 1;
}

.progress-card > span {
  color: var(--muted);
  font-size: 1rem;
  font-weight: 800;
}

.progress-card strong span {
  color: inherit;
  font-size: inherit;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.filters {
  display: flex;
  gap: 8px;
  overflow-x: auto;
}

.filter {
  flex: 0 0 auto;
  padding: 0 14px;
  color: var(--muted);
}

.filter.active {
  border-color: var(--gold);
  color: var(--gold-strong);
}

.ghost-action {
  color: var(--danger);
}

.codes {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px 14px;
}

.code-section-title {
  grid-column: 1 / -1;
  margin: 18px 0 2px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  color: var(--gold-strong);
  font-size: 1rem;
  line-height: 1.2;
  letter-spacing: 0.02em;
}

.code-section-title:first-child {
  margin-top: 2px;
}

.code-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  min-height: 68px;
  padding: 12px 14px;
  border: 1px solid #202020;
  border-radius: 6px;
  background: #101010;
  transition: border-color 0.16s ease, background 0.16s ease;
}

.code-row:hover {
  border-color: #38352a;
  background: #131313;
}

.code-row.is-used {
  border-color: #242424;
  background: #0d0d0d;
  opacity: 0.58;
}

.code-row.is-used:hover {
  border-color: #353535;
}

.check-button {
  display: grid;
  place-items: center;
  width: 38px;
  min-height: 38px;
  padding: 0;
  color: var(--muted);
  border-radius: 50%;
}

.check-button .fa-circle {
  color: rgba(169, 159, 141, 0.45);
  font-size: 0.72rem;
}

.is-used .check-button {
  border-color: #353535;
  background: #171717;
  color: #888;
}

.is-used .check-button .fa-check {
  font-size: 0.98rem;
}

.is-used .check-button:hover {
  border-color: #444;
  background: #1b1b1b;
}

.code-text {
  min-width: 0;
  color: #d0cec5;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.98rem;
  font-weight: 850;
  overflow-wrap: anywhere;
}

.is-used .code-text {
  color: var(--muted);
  text-decoration: line-through;
}

.copy-button {
  width: 36px;
  min-width: 36px;
  padding: 0;
  border-color: transparent;
  background: transparent;
  color: #bca65d;
}

.copy-button:hover,
.icon-button:hover,
.ghost-action:hover,
.filter:hover,
.check-button:hover {
  border-color: var(--line-bright);
  background: rgba(245, 184, 0, 0.09);
}

.copy-button:hover,
.icon-button:hover,
.filter:hover,
.check-button:hover {
  transform: translateY(-1px);
}

@media (max-width: 1180px) {
  .codes {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.empty-state {
  grid-column: 1 / -1;
  padding: 34px 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(16, 16, 16, 0.46);
  color: var(--muted);
  text-align: center;
}

.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  max-width: min(340px, calc(100% - 32px));
  padding: 12px 14px;
  border: 1px solid rgba(245, 184, 0, 0.68);
  border-radius: 8px;
  background: #111;
  color: var(--text);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.16s ease, transform 0.16s ease;
  pointer-events: none;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 20px, 560px);
    padding-top: 94px;
  }

  .site-header-inner {
    width: calc(100% - 20px);
  }

  .list-header {
    align-items: start;
  }

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

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

  .ghost-action {
    width: 100%;
  }

  .codes {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) and (min-width: 761px) {
  .codes {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .list-header {
    flex-direction: column;
  }

  .progress-card {
    width: 100%;
  }

  .code-row {
    grid-template-columns: 38px minmax(0, 1fr) auto;
  }

  .check-button {
    grid-column: auto;
    width: 38px;
  }
}
