:root {
  --bg: #f5f7f3;
  --surface: #ffffff;
  --surface-soft: #eef4f6;
  --ink: #1d2328;
  --muted: #667178;
  --line: #d9e0dc;
  --primary: #116a6c;
  --primary-strong: #0c4f51;
  --accent: #b34824;
  --yellow: #f2c14e;
  --green: #2f7d58;
  --shadow: 0 16px 40px rgba(31, 45, 51, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(17, 106, 108, 0.08), transparent 360px),
    var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 20px 28px;
  border-bottom: 1px solid rgba(217, 224, 220, 0.9);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 220px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: var(--ink);
  color: white;
  font-weight: 800;
}

.brand h1,
.brand p,
.feed-header h2,
.feed-header p,
.modal h2,
.modal p {
  margin: 0;
}

.brand h1 {
  font-size: 21px;
  line-height: 1.1;
}

.brand p,
.feed-header p,
.muted,
.status-line {
  color: var(--muted);
  font-size: 13px;
}

.top-actions {
  display: grid;
  grid-template-columns: minmax(220px, 420px) auto auto;
  gap: 10px;
  align-items: center;
  width: min(100%, 760px);
}

.search,
.select,
input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

.search,
.select,
input {
  min-height: 40px;
  padding: 0 12px;
}

textarea {
  padding: 10px 12px;
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(17, 106, 108, 0.65);
  box-shadow: 0 0 0 3px rgba(17, 106, 108, 0.12);
}

.button {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 14px;
  font-weight: 700;
  white-space: nowrap;
}

.button.primary {
  color: #fff;
  background: var(--primary);
}

.button.primary:hover {
  background: var(--primary-strong);
}

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

.button.secondary:hover {
  border-color: rgba(17, 106, 108, 0.5);
}

.text-button,
.icon-button {
  border: 0;
  background: transparent;
  color: var(--primary);
  font-weight: 700;
}

.icon-button {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  color: var(--ink);
  border: 1px solid var(--line);
}

.workspace {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 340px;
  gap: 18px;
  padding: 18px;
  align-items: start;
}

.sidebar,
.discussion {
  display: grid;
  gap: 14px;
  position: sticky;
  top: 96px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 8px 24px rgba(31, 45, 51, 0.06);
}

.panel.compact {
  padding: 14px;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 14px;
  font-weight: 800;
}

.account-state {
  padding: 10px;
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 12px;
}

.auth-form,
.comment-form,
.modal-card {
  display: grid;
  gap: 10px;
}

.form-row,
.modal-actions {
  display: flex;
  gap: 10px;
}

.form-row .button,
.modal-actions .button {
  flex: 1;
}

.tabs {
  display: grid;
  gap: 8px;
}

.tab {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  padding: 0 12px;
  font-weight: 700;
}

.tab.active {
  background: #dcebea;
  border-color: rgba(17, 106, 108, 0.45);
  color: var(--primary-strong);
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 14px;
}

.stat {
  min-height: 62px;
  border-radius: 8px;
  padding: 10px;
  background: var(--surface-soft);
}

.stat strong {
  display: block;
  font-size: 21px;
}

.stat span {
  color: var(--muted);
  font-size: 12px;
}

.feed {
  min-width: 0;
}

.feed-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.feed-header h2 {
  font-size: 28px;
  line-height: 1.2;
}

.skill-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.skill-card {
  display: grid;
  grid-template-rows: 132px auto;
  min-height: 354px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 8px 22px rgba(31, 45, 51, 0.07);
  transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.skill-card:hover,
.skill-card.active {
  transform: translateY(-2px);
  border-color: rgba(17, 106, 108, 0.55);
  box-shadow: var(--shadow);
}

.skill-image {
  width: 100%;
  height: 132px;
  object-fit: cover;
  background: #dfe8e8;
  display: block;
}

.skill-body {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 10px;
  padding: 14px;
}

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

.skill-title {
  margin: 0;
  font-size: 17px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.source-badge {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 800;
  background: #edf0e5;
  color: #5b4d16;
}

.source-badge.github {
  background: #e4edf6;
  color: #18466e;
}

.skill-summary {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-content: start;
}

.tag {
  border-radius: 999px;
  background: #f0f2ee;
  color: #485257;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 700;
}

.skill-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.author {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
  object-fit: cover;
  flex: 0 0 auto;
}

.author span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric {
  white-space: nowrap;
}

.discussion-panel {
  min-height: calc(100vh - 116px);
  display: grid;
  grid-template-rows: auto auto 1fr auto;
}

.selected-skill {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.selected-skill h3 {
  margin: 0 0 6px;
  font-size: 18px;
  line-height: 1.3;
}

.selected-skill p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.comments {
  display: grid;
  gap: 10px;
  align-content: start;
  overflow: auto;
  padding: 12px 2px;
  min-height: 180px;
}

.comment {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.comment strong {
  display: block;
  font-size: 13px;
}

.comment p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 220px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.55);
  text-align: center;
  padding: 20px;
}

.modal {
  border: 0;
  border-radius: 8px;
  padding: 0;
  width: min(620px, calc(100vw - 28px));
  box-shadow: var(--shadow);
}

.modal::backdrop {
  background: rgba(18, 27, 31, 0.48);
}

.modal-card {
  padding: 20px;
}

.modal-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.modal label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(380px, calc(100vw - 36px));
  border-radius: 8px;
  padding: 12px 14px;
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow);
  z-index: 50;
}

.hidden {
  display: none !important;
}

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

  .discussion {
    grid-column: 1 / -1;
    position: static;
  }

  .discussion-panel {
    min-height: 420px;
  }
}

@media (max-width: 820px) {
  .topbar,
  .feed-header {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions {
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

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

  .workspace {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .sidebar {
    position: static;
  }

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

  .form-grid,
  .stats {
    grid-template-columns: 1fr;
  }
}
