:root {
  --ink: #202124;
  --muted: #667085;
  --line: #d8dee8;
  --paper: #fbfaf7;
  --surface: #ffffff;
  --sage: #3f6f5f;
  --rose: #b65c70;
  --gold: #b88434;
  --blue: #426b93;
  --shadow: 0 16px 40px rgba(32, 33, 36, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px clamp(18px, 4vw, 56px);
  background: rgba(251, 250, 247, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.account-pill {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 11px;
  border-radius: 999px;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.account-pill.is-live {
  color: #fff;
  background: var(--blue);
  border-color: var(--blue);
}

.topbar h1,
.topbar p,
h2,
p {
  margin: 0;
}

.topbar h1 {
  font-size: clamp(1.35rem, 3vw, 2rem);
}

.eyebrow {
  color: var(--rose);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

.tab,
.form-actions button,
.card-actions button,
.name-chips button {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  font-weight: 750;
}

.tab.is-active,
.form-actions button:first-child,
.card-actions button:first-child {
  color: #fff;
  background: var(--sage);
  border-color: var(--sage);
}

.tab:disabled,
.form-actions button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

main {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 56px;
}

.hero-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
  gap: 28px;
  align-items: stretch;
  min-height: 300px;
  padding: clamp(28px, 5vw, 56px) 0;
  border-bottom: 1px solid var(--line);
}

.hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
}

.hero-copy h2 {
  max-width: 760px;
  font-size: clamp(2.25rem, 7vw, 5.8rem);
  line-height: 0.95;
}

.hero-copy p:last-child {
  max-width: 660px;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.18rem);
  line-height: 1.6;
}

.hero-panel {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-content: center;
}

.hero-panel div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.hero-panel strong {
  font-size: 2.3rem;
}

.hero-panel span {
  color: var(--muted);
  font-weight: 700;
}

.view {
  display: none;
  padding-top: 34px;
}

.view.is-visible {
  display: block;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
  margin-bottom: 20px;
}

.section-head h2 {
  margin-top: 5px;
  font-size: clamp(1.6rem, 3vw, 2.45rem);
}

.section-note {
  max-width: 420px;
  color: var(--muted);
  line-height: 1.5;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

textarea {
  resize: vertical;
}

.toolbar input {
  width: min(360px, 100%);
}

.style-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 18px;
}

.style-card {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 28px rgba(32, 33, 36, 0.07);
}

.card-media {
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: 210px;
  background: #e9edf2;
}

.image-slot {
  position: relative;
  min-width: 0;
  overflow: hidden;
}

.image-slot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.image-slot span {
  position: absolute;
  left: 10px;
  bottom: 10px;
  padding: 5px 8px;
  border-radius: 6px;
  color: #fff;
  background: rgba(32, 33, 36, 0.72);
  font-size: 0.75rem;
  font-weight: 800;
}

.placeholder {
  display: grid;
  place-items: center;
  height: 100%;
  padding: 18px;
  color: var(--muted);
  background:
    linear-gradient(135deg, rgba(63, 111, 95, 0.16), rgba(182, 92, 112, 0.13)),
    #f2f4f1;
  text-align: center;
  font-weight: 800;
}

.card-body {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.card-title-row {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
}

.card-title-row h3 {
  margin: 0;
  font-size: 1.08rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  color: #fff;
  background: var(--blue);
  font-size: 0.76rem;
  font-weight: 800;
  white-space: nowrap;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 0.88rem;
}

.notes {
  color: #3d4450;
  line-height: 1.45;
}

.social-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.social-list a {
  color: var(--sage);
  font-weight: 800;
  text-decoration: none;
}

.video-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}

.video-thumb {
  position: relative;
  display: grid;
  min-height: 178px;
  overflow: hidden;
  border-radius: 8px;
  color: #fff;
  background: #202124;
  text-decoration: none;
}

.video-thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.72;
}

.video-thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(32, 33, 36, 0.08), rgba(32, 33, 36, 0.84));
}

.video-thumb strong,
.video-thumb small,
.play-badge {
  position: relative;
  z-index: 1;
}

.video-thumb strong {
  align-self: end;
  margin: auto 10px 2px;
  font-size: 0.92rem;
}

.video-thumb small {
  margin: 0 10px 10px;
  color: rgba(255, 255, 255, 0.82);
  font-weight: 750;
}

.play-badge {
  place-self: start end;
  margin: 9px;
  padding: 6px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 900;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.button-link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 8px;
  color: #fff;
  background: var(--sage);
  border: 1px solid var(--sage);
  font-weight: 750;
  text-decoration: none;
}

.button-link.secondary {
  color: var(--ink);
  background: #fff;
  border-color: var(--line);
}

.shop-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  gap: 18px;
  align-items: start;
}

.product-grid,
.mini-product-grid,
.terms-grid,
.picker-grid {
  display: grid;
  gap: 12px;
}

.product-grid {
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}

.mini-product-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.product-card,
.term-card,
.picker-item {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.product-card {
  overflow: hidden;
  box-shadow: 0 8px 28px rgba(32, 33, 36, 0.07);
}

.product-card.is-compact {
  box-shadow: none;
}

.product-image {
  height: 160px;
  background: #eef1f5;
}

.product-card.is-compact .product-image {
  height: 120px;
}

.product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.product-body {
  display: grid;
  gap: 10px;
  padding: 13px;
}

.recommended-products {
  display: grid;
  gap: 9px;
}

.recommended-products h4 {
  margin: 0;
  font-size: 0.94rem;
}

.terms-grid {
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

.term-card {
  padding: 16px;
}

.term-card h3 {
  margin: 0 0 8px;
}

.term-card p {
  color: var(--muted);
  line-height: 1.5;
}

.product-picker {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.product-picker legend {
  padding: 0 6px;
  font-weight: 800;
}

.picker-grid {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.picker-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
  padding: 12px;
}

.picker-item input {
  width: 18px;
  min-height: 18px;
  margin-top: 3px;
}

.picker-item strong,
.picker-item small {
  display: block;
}

.picker-item small {
  color: var(--muted);
  margin-top: 3px;
}

.dictionary-layout {
  display: grid;
  gap: 24px;
}

.monitor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  gap: 18px;
}

.admin-dashboard {
  display: grid;
  gap: 18px;
}

.admin-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
}

.admin-stat {
  display: grid;
  gap: 5px;
  padding: 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 28px rgba(32, 33, 36, 0.06);
}

.admin-stat strong {
  font-size: clamp(1.5rem, 3vw, 2.25rem);
}

.admin-stat span {
  color: var(--muted);
  font-weight: 800;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

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

.monitor-panel {
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.monitor-panel h3 {
  margin: 0 0 14px;
}

.activity-feed,
.leaderboard,
.comment-list {
  display: grid;
  gap: 10px;
}

.activity-item,
.leaderboard-item,
.comment-item {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.activity-item strong,
.comment-item strong {
  display: block;
}

.activity-item span,
.leaderboard-item span,
.comment-item span {
  color: var(--muted);
  font-size: 0.86rem;
}

.leaderboard-item {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.dictionary-group {
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.dictionary-group h3 {
  margin: 0 0 14px;
  font-size: 1.25rem;
}

.work-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.work-form.compact {
  max-width: 760px;
}

.auth-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.auth-form {
  align-content: start;
}

.auth-form h3 {
  margin: 0;
}

.status-message {
  min-height: 24px;
  margin-top: 14px;
  color: var(--rose);
  font-weight: 800;
}

label {
  display: grid;
  gap: 7px;
  color: #3f4652;
  font-weight: 750;
}

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

.check {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.check input {
  width: 20px;
  min-height: 20px;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.form-actions .secondary,
.card-actions .secondary {
  color: var(--ink);
  background: #fff;
  border-color: var(--line);
}

.name-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.empty-state {
  padding: 34px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--muted);
  text-align: center;
}

dialog {
  width: min(900px, calc(100% - 28px));
  max-height: 90vh;
  overflow: auto;
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 30px 80px rgba(32, 33, 36, 0.28);
}

dialog::backdrop {
  background: rgba(32, 33, 36, 0.45);
}

.close-button {
  position: sticky;
  top: 10px;
  left: calc(100% - 48px);
  z-index: 2;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  color: #fff;
  background: var(--ink);
}

.share-page {
  padding: clamp(22px, 5vw, 48px);
  background: var(--paper);
}

.share-page h2 {
  margin: 8px 0 12px;
  font-size: clamp(2rem, 5vw, 4rem);
}

.share-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.share-actions a,
.share-actions button {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 8px;
  color: #fff;
  background: var(--sage);
  text-decoration: none;
  font-weight: 800;
}

.viewer-box,
.comment-box {
  display: grid;
  gap: 12px;
  margin-top: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.viewer-box h3,
.comment-box h3 {
  margin: 0;
}

.viewer-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

@media (max-width: 760px) {
  .topbar,
  .section-head,
  .hero-band {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: stretch;
  }

  .tabs,
  .toolbar {
    justify-content: start;
  }

  .hero-band {
    display: grid;
    min-height: auto;
  }

  .work-form {
    grid-template-columns: 1fr;
    padding: 16px;
  }

  .monitor-grid,
  .viewer-fields,
  .auth-grid,
  .shop-layout,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .admin-grid .wide {
    grid-column: auto;
  }

  .card-media {
    height: 180px;
  }
}
