:root {
  --bg: #020604;
  --bg-2: #050d08;
  --surface: #07120b;
  --surface-2: #0a1a10;
  --surface-3: #0d2315;
  --text: #d7f7de;
  --muted: #7fa88a;
  --line: #174020;
  --line-strong: #226230;
  --accent: #28e66f;
  --accent-soft: #123f22;
  --danger: #ff6666;
  --warning: #e2c35a;
  --radius: 3px;
  --mono: Consolas, "Courier New", monospace;
}

html[data-theme="light"] {
  --bg: #f4f7f1;
  --bg-2: #edf3e9;
  --surface: #ffffff;
  --surface-2: #edf5eb;
  --surface-3: #dcebd8;
  --text: #17251b;
  --muted: #5c7662;
  --line: #c7d9c8;
  --line-strong: #92b99a;
  --accent: #126c35;
  --accent-soft: #dcefe1;
  --danger: #b32626;
  --warning: #846200;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  background:
    linear-gradient(rgba(40, 230, 111, 0.025) 1px, transparent 1px),
    var(--bg);
  background-size: 100% 4px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.45;
}

html[data-theme="light"] body {
  background:
    linear-gradient(rgba(18, 108, 53, 0.055) 1px, transparent 1px),
    var(--bg);
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  background: rgba(40, 230, 111, 0.12);
  outline: 1px solid rgba(40, 230, 111, 0.18);
  text-decoration: none;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  color: #e6ffe9;
  font-size: clamp(25px, 3vw, 34px);
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 14px;
}

h2 {
  border-bottom: 1px solid var(--line);
  color: #e6ffe9;
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 14px;
  padding-bottom: 8px;
}

h3 {
  color: #e6ffe9;
  font-size: 16px;
  margin-bottom: 7px;
}

.topbar {
  align-items: center;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
  display: flex;
  min-height: 52px;
  justify-content: space-between;
  padding: 0 26px;
  position: sticky;
  top: 0;
  z-index: 5;
}

.brand {
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0;
}

.brand::before {
  content: "$ ";
  color: var(--muted);
}

.nav {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: flex-end;
}

.nav form {
  margin: 0;
}

.page {
  margin: 0 auto;
  max-width: 1320px;
  padding: 28px 26px 58px;
}

.messages {
  margin: 14px auto 0;
  max-width: 1320px;
  padding: 0 26px;
}

.message {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--text);
  margin-bottom: 8px;
  padding: 10px 12px;
}

.message.error {
  border-color: #6f2828;
  color: #ffd5d5;
}

.eyebrow {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 9px;
  text-transform: uppercase;
}

.eyebrow::before {
  content: "# ";
}

.muted,
small {
  color: var(--muted);
}

.compact {
  margin-bottom: 0;
}

.auth-layout,
.hero,
.dashboard-head,
.layout-two {
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 380px);
}

.hero {
  align-items: start;
  min-height: auto;
}

.hero-text {
  color: var(--muted);
  max-width: 68ch;
}

.narrow {
  max-width: 820px;
}

.actions,
.button-row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.button,
button {
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--accent);
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-weight: 700;
  justify-content: center;
  line-height: 1;
  padding: 10px 12px;
}

.button:hover,
button:hover {
  background: var(--accent-soft);
  outline: 1px solid rgba(40, 230, 111, 0.18);
  text-decoration: none;
}

.button.secondary {
  background: transparent;
  border-color: var(--line);
  color: var(--text);
}

.button.danger {
  border-color: #743030;
  color: var(--danger);
}

.button.small,
button.small {
  padding: 7px 9px;
}

.link-button {
  background: transparent;
  border: 0;
  color: var(--accent);
  padding: 0;
}

.theme-toggle,
.home-mode-toggle {
  border: 1px solid rgba(40, 230, 111, 0.38);
  border-radius: var(--radius);
  padding: 6px 8px;
}

html[data-theme="light"] .theme-toggle,
html[data-theme="light"] .home-mode-toggle {
  border-color: var(--line-strong);
}

.home-view-root .normal-home {
  display: none;
}

.home-view-root.is-normal .terminal-home {
  display: none;
}

.home-view-root.is-normal .normal-home {
  display: grid;
}

.terminal-home {
  align-items: center;
  display: grid;
  min-height: calc(100vh - 118px);
}

.crt-frame {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.42);
  margin: 0 auto;
  max-width: 1120px;
  padding: clamp(14px, 2.5vw, 28px);
  width: 100%;
}

.crt-screen {
  background: #010503;
  border: 1px solid #12351d;
  border-radius: 8px;
  color: var(--accent);
  min-height: clamp(500px, 55vw, 630px);
  overflow: hidden;
  padding: clamp(20px, 3vw, 34px);
  position: relative;
  text-shadow: 0 0 3px rgba(40, 230, 111, 0.34);
}

.crt-screen::before {
  background: repeating-linear-gradient(
    to bottom,
    rgba(40, 230, 111, 0.045) 0,
    rgba(40, 230, 111, 0.045) 1px,
    rgba(0, 0, 0, 0.18) 2px,
    rgba(0, 0, 0, 0.18) 4px
  );
  content: "";
  inset: 0;
  opacity: 0.38;
  pointer-events: none;
  position: absolute;
  z-index: 1;
}

.crt-screen::after {
  background: radial-gradient(ellipse at center, transparent 58%, rgba(0, 0, 0, 0.5) 100%);
  content: "";
  inset: 0;
  pointer-events: none;
  position: absolute;
  z-index: 2;
}

.terminal-toolbar,
.terminal-text,
.terminal-input-line {
  position: relative;
  z-index: 3;
}

.terminal-toolbar {
  color: var(--muted);
  display: flex;
  font-size: 13px;
  justify-content: space-between;
  margin-bottom: 18px;
}

.terminal-text {
  font-size: clamp(14px, 1.5vw, 19px);
  line-height: 1.34;
  margin: 0;
  max-width: 72ch;
  overflow: hidden;
  white-space: pre-wrap;
}

.terminal-input-line {
  align-items: baseline;
  display: flex;
  gap: 8px;
  margin: 0;
}

.terminal-input {
  background: transparent;
  border: 0;
  color: #d9ffe2;
  flex: 1;
  font: inherit;
  min-height: 0;
  padding: 0;
  text-shadow: inherit;
}

.terminal-input:focus {
  border: 0;
  outline: 0;
}

.prompt {
  color: #8dffab;
  font-weight: 700;
}

.terminal-command {
  color: #d9ffe2;
}

.terminal-command::before {
  content: "./";
  color: var(--muted);
}

.cursor {
  animation: blink 1.1s steps(1, end) infinite;
}

@keyframes blink {
  0%,
  49% {
    opacity: 1;
  }
  50%,
  100% {
    opacity: 0;
  }
}

.form-card,
.hero-panel,
.side-panel,
.review-card,
.task-card,
.summary-item,
.feed-item,
.details,
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.form-card {
  display: grid;
  gap: 13px;
  padding: 16px;
}

.form-card.wide {
  margin-top: 18px;
}

label {
  display: grid;
  gap: 6px;
}

label.hidden {
  display: none;
}

label span {
  color: #e6ffe9;
  font-weight: 700;
}

input,
select,
textarea {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  font: inherit;
  min-height: 38px;
  padding: 8px 10px;
  width: 100%;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  outline: 1px solid rgba(40, 230, 111, 0.22);
}

textarea {
  resize: vertical;
}

ul.errorlist {
  color: var(--danger);
  list-style: none;
  margin: 0;
  padding: 0;
}

.dashboard-head {
  align-items: end;
  margin-bottom: 24px;
}

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

.summary-item,
.metric {
  padding: 13px;
}

.summary-item span,
.metric span {
  color: #e6ffe9;
  display: block;
  font-size: 28px;
  font-weight: 700;
}

.summary-item p,
.metric p {
  color: var(--muted);
  margin-bottom: 0;
}

.side-panel {
  padding: 14px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  border-collapse: collapse;
  min-width: 760px;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px 11px;
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--surface-2);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover {
  background: rgba(40, 230, 111, 0.035);
}

.badge {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  display: inline-flex;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 7px;
  white-space: nowrap;
}

.badge.free {
  background: rgba(226, 195, 90, 0.13);
  border-color: #d7a82f;
  color: #ffd36d;
}

.badge.tag-intranet,
.badge.rank-pro {
  background: rgba(40, 230, 111, 0.11);
  border-color: var(--line-strong);
  color: var(--accent);
}

.badge.tag-extranet {
  background: rgba(106, 160, 216, 0.13);
  border-color: #5086bf;
  color: #9dccff;
}

.badge.rank-noob {
  color: var(--muted);
}

.badge.rank-hacker {
  background: rgba(226, 195, 90, 0.13);
  border-color: #d7a82f;
  color: #ffd36d;
}

.rating-place {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--accent);
  display: inline-flex;
  font-weight: 700;
  justify-content: center;
  min-width: 34px;
  padding: 3px 6px;
}

.task-grid,
.stack {
  display: grid;
  gap: 12px;
}

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

.task-card {
  display: grid;
  gap: 9px;
  padding: 14px;
}

.task-card-head {
  align-items: center;
  color: var(--muted);
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.feed-item,
.review-card {
  margin-bottom: 10px;
  padding: 12px;
}

.feed-title {
  color: #e6ffe9;
  font-weight: 700;
  margin-bottom: 5px;
}

.forgejo-access {
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 14px;
}

.credential-row {
  display: grid;
  gap: 5px;
}

.modal-backdrop {
  align-items: center;
  background: rgba(0, 0, 0, 0.74);
  display: grid;
  inset: 0;
  padding: 18px;
  position: fixed;
  z-index: 20;
}

.modal-panel {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.46);
  margin: 0 auto;
  max-width: 620px;
  padding: 18px;
  width: min(100%, 620px);
}

.credential-list {
  display: grid;
  gap: 10px;
  margin: 14px 0;
}

.temporary-password {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--accent);
  display: block;
  font-size: 19px;
  overflow-wrap: anywhere;
  padding: 10px 12px;
}

.inline-review {
  display: grid;
  gap: 9px;
}

.registration-card {
  display: block;
}

.registration-summary {
  align-items: baseline;
  color: var(--accent);
  cursor: pointer;
  display: flex;
  flex-wrap: wrap;
  font-weight: 700;
  gap: 10px;
  list-style-position: inside;
  padding: 0;
}

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

.registration-summary::before {
  border-bottom: 5px solid transparent;
  border-left: 7px solid var(--accent);
  border-top: 5px solid transparent;
  content: "";
  flex: 0 0 auto;
  margin-top: 5px;
  transition: transform 0.16s ease;
}

.registration-card[open] .registration-summary::before {
  transform: rotate(90deg);
}

.registration-card[open] .registration-summary {
  border-bottom: 1px solid var(--line);
  margin-bottom: 12px;
  padding-bottom: 10px;
}

.registration-title {
  color: #e6ffe9;
}

.registration-body {
  display: grid;
  gap: 12px;
}

.details-grid {
  display: grid;
  gap: 0;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin: 0;
  padding: 10px;
}

.details-grid div {
  border-bottom: 1px solid var(--line);
  padding: 8px 0;
}

.details-grid div:nth-last-child(-n + 2) {
  border-bottom: 0;
}

.details-grid dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 3px;
  text-transform: uppercase;
}

.details-grid dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.registration-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 2px;
}

.registration-actions form {
  margin: 0;
}

.details {
  padding: 14px;
}

.rules-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 22px;
}

.rules-list li::marker {
  color: var(--accent);
  font-weight: 700;
}

.formula {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--accent);
  font-weight: 700;
  margin: 12px 0;
  overflow-wrap: anywhere;
  padding: 12px;
}

.rules-note {
  margin-top: 10px;
}

.details p:last-child,
.feed-item p:last-child,
.task-card p:last-child {
  margin-bottom: 0;
}

.empty {
  color: var(--muted);
  padding: 14px;
}

section + section {
  margin-top: 28px;
}

html[data-theme="light"] h1,
html[data-theme="light"] h2,
html[data-theme="light"] h3,
html[data-theme="light"] label span,
html[data-theme="light"] .summary-item span,
html[data-theme="light"] .metric span,
html[data-theme="light"] .feed-title {
  color: #17251b;
}

html[data-theme="light"] a:hover,
html[data-theme="light"] .button:hover,
html[data-theme="light"] button:hover {
  background: rgba(18, 108, 53, 0.11);
  outline-color: rgba(18, 108, 53, 0.18);
}

html[data-theme="light"] .message {
  background: #f8fbf4;
}

html[data-theme="light"] .crt-screen {
  background: #f8fbf4;
  border-color: #9cc9a5;
  box-shadow: inset 0 0 0 1px rgba(18, 108, 53, 0.09);
  color: var(--accent);
  text-shadow: none;
}

html[data-theme="light"] .crt-screen::before {
  background: repeating-linear-gradient(
    to bottom,
    rgba(18, 108, 53, 0.04) 0,
    rgba(18, 108, 53, 0.04) 1px,
    rgba(255, 255, 255, 0.16) 2px,
    rgba(255, 255, 255, 0.16) 4px
  );
}

html[data-theme="light"] .crt-screen::after {
  background: radial-gradient(ellipse at center, transparent 64%, rgba(18, 108, 53, 0.11) 100%);
}

html[data-theme="light"] .prompt {
  color: #0b7a35;
}

html[data-theme="light"] .terminal-command,
html[data-theme="light"] .terminal-input {
  color: #093f20;
}

html[data-theme="light"] tbody tr:hover {
  background: rgba(18, 108, 53, 0.055);
}

html[data-theme="light"] .badge.free {
  background: #fff1b8;
  border-color: #986700;
  color: #5c3f00;
}

html[data-theme="light"] .badge.tag-intranet,
html[data-theme="light"] .badge.rank-pro {
  background: #dcefe1;
  border-color: #92b99a;
  color: #126c35;
}

html[data-theme="light"] .badge.tag-extranet {
  background: #e6f1ff;
  border-color: #82a9d6;
  color: #245a91;
}

html[data-theme="light"] .badge.rank-hacker {
  background: #fff1b8;
  border-color: #986700;
  color: #5c3f00;
}

html[data-theme="light"] .rating-place {
  color: #126c35;
}

@media (max-width: 860px) {
  body {
    font-size: 14px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    padding: 14px 16px;
  }

  .nav {
    justify-content: flex-start;
  }

  .page,
  .messages {
    padding-left: 14px;
    padding-right: 14px;
  }

  .hero,
  .auth-layout,
  .dashboard-head,
  .layout-two {
    grid-template-columns: 1fr;
  }

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

  .terminal-home {
    min-height: 0;
  }

  .crt-frame {
    border-radius: 10px;
    padding: 10px;
  }

  .crt-screen {
    border-radius: 6px;
    min-height: 500px;
    padding: 16px;
  }
}
