@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap");

:root {
  --bg: #ffffff;
  --fg: #0a0a0a;
  --muted: #888888;
  --line: #e8e8e8;
  --texture: rgba(0, 0, 0, 0.04);
  --card-bg: #ffffff;
  --card-hover-line: #0a0a0a;
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: "Inter", sans-serif;
}

body {
  background-image:
    linear-gradient(var(--texture) 1px, transparent 1px),
    linear-gradient(90deg, var(--texture) 1px, transparent 1px);
  background-size: 32px 32px;
}

a {
  color: inherit;
}

.page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 460px;
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.brand-logo {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  object-fit: contain;
  padding: 4px;
  background: #fff;
}

.brand-logo-large {
  width: 48px;
  height: 48px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  color: var(--muted);
}

.brand-title {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
}

.brand-sub {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-family: "JetBrains Mono", monospace;
}

form {
  display: grid;
  gap: 12px;
}

label {
  font-size: 13px;
  color: var(--muted);
  font-family: "JetBrains Mono", monospace;
}

[hidden] {
  display: none !important;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 14px;
  font-family: "Inter", sans-serif;
  background: #fff;
}

input:focus {
  border-color: var(--fg);
  outline: none;
}

select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 14px;
  font-family: "Inter", sans-serif;
  background: #fff;
  cursor: pointer;
}

select:focus {
  border-color: var(--fg);
  outline: none;
}

input[type="checkbox"] {
  width: 16px;
  height: 16px;
  padding: 0;
  border-radius: 4px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.checkbox-row label {
  margin: 0;
}

button,
.btn {
  border: 1px solid var(--fg);
  background: var(--fg);
  color: #fff;
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

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

button.secondary:hover,
.btn.secondary:hover {
  border-color: var(--fg);
}

.stack-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 4px;
}

.msg {
  margin-top: 10px;
  font-size: 14px;
}

.msg.error {
  color: #202020;
}

.msg.ok {
  color: #202020;
}

.admin-grid {
  width: min(1120px, 100%);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.admin-card {
  max-width: none;
  align-self: start;
}

.tool-admin-list {
  display: grid;
  gap: 10px;
}

.tool-admin-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  display: grid;
  grid-template-columns: 56px 1fr auto;
  align-items: center;
  gap: 10px;
  background: #fff;
}

.tool-admin-thumb {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  border: 1px solid var(--line);
  object-fit: cover;
  background: #fff;
}

.tool-admin-meta {
  min-width: 0;
}

.tool-admin-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.tool-admin-sub {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--muted);
  font-family: "JetBrains Mono", monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tool-admin-delete {
  padding: 8px 10px;
  font-size: 12px;
  font-family: "JetBrains Mono", monospace;
}

.tool-admin-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tool-admin-edit {
  padding: 8px 10px;
  font-size: 12px;
  font-family: "JetBrains Mono", monospace;
}

.tool-admin-empty {
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 14px;
  font-size: 13px;
  color: var(--muted);
}

.user-admin-list {
  display: grid;
  gap: 10px;
}

.user-admin-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  background: #fff;
}

.user-admin-meta {
  min-width: 0;
}

.user-admin-role {
  margin: 6px 0 0;
  font-size: 11px;
  font-family: "JetBrains Mono", monospace;
  color: var(--muted);
  text-transform: uppercase;
}

.user-admin-delete {
  padding: 8px 10px;
  font-size: 12px;
  font-family: "JetBrains Mono", monospace;
}

.login-page {
  background: #fff;
  background-image: radial-gradient(circle at center, #ffffff 0%, #fafafa 100%);
  color: #1a1a1a;
  font-family: "Inter", sans-serif;
  font-weight: 300;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

.login-page .page {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-page .auth-card {
  max-width: 360px;
  width: 100%;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: #fff;
}

.login-page .login-logo {
  width: auto;
  max-width: min(220px, 68vw);
  height: auto;
  border: 0;
  border-radius: 0;
  padding: 0;
  display: block;
  margin: min(10vh, 96px) auto min(10vh, 96px);
  object-fit: contain;
  opacity: 0.9;
}

.login-page form {
  gap: 24px;
}

.login-page label {
  display: block;
  margin-bottom: 8px;
  font-family: "Inter", sans-serif;
  font-weight: 300;
  font-size: 11px;
  line-height: 1;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #000;
}

.login-page input {
  border: 0;
  border-bottom: 1px solid #000;
  border-radius: 0;
  padding: 10px 0;
  font-family: "Inter", sans-serif;
  font-weight: 300;
  font-size: 13px;
  line-height: 1.5;
  letter-spacing: 0.02em;
  color: #000;
  background: transparent;
}

.login-page input::placeholder {
  color: #000;
}

.login-page button {
  margin-top: 6px;
  border: 1px solid #000;
  border-radius: 0;
  background: #fff;
  color: #000;
  font-family: "Inter", sans-serif;
  font-size: 11px;
  line-height: 1;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  font-weight: 300;
  padding: 14px;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.login-page button:hover {
  background: #fff;
  color: #000;
}

.login-page .login-links {
  margin-top: 42px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.login-page .login-links a {
  font-family: "Inter", sans-serif;
  font-weight: 300;
  font-size: 11px;
  line-height: 1;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #000;
  text-decoration: none;
}

.login-page .login-links a:hover {
  color: #000;
}

.login-page .msg {
  font-family: "Inter", sans-serif;
  font-weight: 300;
  font-size: 12px;
  margin-top: 14px;
  color: #000;
}

@media (max-width: 640px) {
  .admin-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .login-page .login-logo {
    max-width: min(180px, 72vw);
    margin: min(8vh, 52px) auto min(8vh, 52px);
  }

  .login-page .auth-card {
    max-width: 100%;
  }

  .login-page .login-links {
    margin-top: 30px;
  }
}

.toolhub {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  border-bottom: 1px solid var(--line);
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-logo {
  width: auto;
  height: 38px;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
}

.topbar-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.topbar-meta {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-family: "JetBrains Mono", monospace;
}

.tool-grid {
  width: 100%;
  margin: 24px 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0 24px;
}

.logged-out-screen {
  position: fixed;
  inset: 0;
  background: #f6f7f8;
  background-image:
    linear-gradient(rgba(0, 0, 0, 0.065) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.065) 1px, transparent 1px);
  background-size: 32px 32px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 24px;
  z-index: 100;
  gap: 12px;
}

.logged-out-kicker {
  margin: 0;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.logged-out-title {
  margin: 0;
  font-family: "JetBrains Mono", monospace;
  font-size: clamp(24px, 4vw, 48px);
  font-weight: 400;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.2;
}

.logged-out-text {
  margin: 0;
  max-width: 56ch;
  font-size: 14px;
  line-height: 1.45;
}

.logged-out-screen .btn {
  margin-top: 16px;
}

.tool-category {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  min-height: 180px;
  position: relative;
  padding: 16px 0;
}

.toolhub-page .tool-category + .tool-category {
  padding-top: 32px;
}

.toolhub-page .tool-category + .tool-category::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.52) 0%, rgba(0, 0, 0, 0.3) 48%, rgba(0, 0, 0, 0) 100%);
  pointer-events: none;
}

.tool-category-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.tool-category-icon {
  width: 34px;
  height: 34px;
  object-fit: contain;
  opacity: 0.74;
}

.tool-category[data-category="demos"] .tool-category-icon {
  width: 41px;
  height: 41px;
}

.tool-category[data-category="downloads"] .tool-category-title {
  font-size: 19.25px;
}

.tool-category-title {
  font-size: 28px;
  font-weight: 400;
  margin: 0;
  color: #e4e4e4;
  font-family: "JetBrains Mono", monospace;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
  padding: 0;
  border: none;
  flex-shrink: 0;
  width: 40px;
  height: 136px;
  display: grid;
  justify-items: center;
  align-content: start;
  line-height: 1;
}

.tool-section-scroll {
  display: flex;
  gap: 24px;
  overflow-x: auto;
  padding-bottom: 8px;
  padding-left: calc(24px + 360px);
  margin-left: calc(-24px - 360px);
  scroll-behavior: smooth;
  flex: 1;
  /* Hide scrollbar for modern browsers */
  scrollbar-width: none;
}

.tool-section-scroll::-webkit-scrollbar {
  display: none;
}

.tool-section-scroll .tool-card {
  flex: 0 0 minmax(360px, 1fr);
  width: 360px;
}

.tool-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  display: grid;
  gap: 14px;
  text-decoration: none;
  background: #fff;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.tool-card:hover {
  border-color: var(--card-hover-line);
  transform: translateY(-2px);
}

.tool-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tool-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  border: 1px solid var(--line);
  object-fit: cover;
  background: #fff;
}

.tool-status {
  font-size: 12px;
  font-family: "JetBrains Mono", monospace;
  color: var(--muted);
  text-transform: uppercase;
}

.tool-title {
  margin: 0;
  font-size: 16px;
}

.tool-desc {
  margin: 0;
  font-size: 14px;
  color: #333;
  line-height: 1.35;
}

.footer {
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding: 14px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
  color: var(--muted);
}

.footer button {
  background: #fff;
  color: var(--fg);
  border-color: var(--line);
  padding: 8px 12px;
  font-size: 13px;
  font-family: "JetBrains Mono", monospace;
}

.footer button:hover {
  border-color: var(--fg);
}

.toolhub-page {
  background: #fff;
  color: #000;
  font-family: "Inter", sans-serif;
  font-weight: 300;
}

.toolhub-page .toolhub {
  background-color: #f6f7f8;
  background-image:
    linear-gradient(rgba(0, 0, 0, 0.065) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.065) 1px, transparent 1px);
  background-size: 32px 32px;
}

.toolhub-page .topbar {
  border-bottom: 1px solid #000;
  background: #fff;
}

.toolhub-page .topbar-title {
  color: #000;
  font-weight: 300;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.toolhub-page .topbar-meta {
  color: #000;
  font-family: "JetBrains Mono", monospace;
  font-weight: 400;
  font-size: 10px;
  letter-spacing: 0.14em;
}

.toolhub-page .tool-card {
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
  gap: 0;
  overflow: visible;
  position: relative;
  justify-self: center;
  width: min(100%, 250px);
  transition: transform 0.2s ease;
  display: flex;
  flex-direction: column;
}

.toolhub-page .tool-card:hover {
  border-color: #000;
  transform: scale(0.95);
}

.toolhub-page .tool-media {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  background: linear-gradient(180deg, #ffffff 0%, #fcfcfc 100%);
  border: 0.5px solid #000;
  display: grid;
  place-items: center;
  box-shadow:
    0 1px 0 rgba(0, 0, 0, 0.18),
    0 8px 18px rgba(0, 0, 0, 0.08);
  transition: box-shadow 0.2s ease;
  overflow: hidden;
}

.toolhub-page .tool-card:hover .tool-media,
.toolhub-page .tool-card:focus-visible .tool-media {
  box-shadow:
    0 1px 0 rgba(0, 0, 0, 0.2),
    0 14px 28px rgba(0, 0, 0, 0.14);
}

.toolhub-page .tool-preview {
  width: 220px;
  height: auto;
  max-height: 150px;
  object-fit: contain;
  display: block;
  background: #fff;
}

.toolhub-page .tool-card[data-tool-id="interactive-presentations"] .tool-preview {
  transform: scale(0.8);
}

.toolhub-page .tool-card[data-tool-id="tap-of-war"] .tool-preview {
  transform: scale(0.75);
}

.toolhub-page .tool-title {
  position: absolute;
  bottom: 8px;
  left: 8px;
  right: 8px;
  font-size: 13px;
  font-family: "JetBrains Mono", monospace;
  font-weight: 400;
  line-height: 1.3;
  margin: 0;
  color: #000;
  text-align: left;
  z-index: 3;
}

.toolhub-page .tool-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  color: #000;
  padding: 12px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 8px;
  opacity: 0;
  transition: opacity 0.16s ease;
  pointer-events: none;
  background: rgba(255, 255, 255, 0.95);
  z-index: 2;
}

.toolhub-page .tool-card:hover .tool-overlay,
.toolhub-page .tool-card:focus-visible .tool-overlay {
  opacity: 1;
}

.toolhub-page .tool-icon {
  border: 1px solid #000;
  border-radius: 0;
}

.toolhub-page .tool-status {
  color: #000;
  font-family: "JetBrains Mono", monospace;
  font-weight: 400;
  font-size: 10px;
  letter-spacing: 0.12em;
  margin: 0;
}

.toolhub-page .tool-desc {
  font-size: 12px;
  line-height: 1.35;
  margin: 0;
  color: #000;
}

.toolhub-page .footer {
  border-top: 1px solid #000;
  color: #000;
  font-family: "JetBrains Mono", monospace;
  font-weight: 400;
  background: #fff;
}

.toolhub-page .footer button {
  border: 1px solid #000;
  border-radius: 0;
  background: #fff;
  color: #000;
  font-family: "JetBrains Mono", monospace;
  font-weight: 400;
}

.toolhub-page .footer button:hover {
  border-color: #000;
}

.toolhub-page .spec-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.34);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease;
  z-index: 60;
}

.toolhub-page .spec-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.toolhub-page .spec-panel {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(0.84);
  transform-origin: var(--spec-origin-x, 50%) var(--spec-origin-y, 100%);
  width: min(860px, calc(100vw - 28px));
  max-height: min(72vh, 760px);
  background: #fff;
  border: 1px solid #000;
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  transition: transform 0.16s ease;
}

.toolhub-page .spec-overlay.is-open .spec-panel {
  transform: translate(-50%, -50%) scale(1);
}

.toolhub-page .spec-panel-head {
  border-bottom: 1px solid #000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
}

.toolhub-page .spec-title {
  margin: 0;
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 400;
}

.toolhub-page .spec-close {
  border: 1px solid #000;
  border-radius: 0;
  background: #fff;
  color: #000;
  padding: 6px 10px;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.toolhub-page .spec-content {
  padding: 10px 12px 12px;
  overflow: auto;
  display: grid;
  gap: 10px;
}

.toolhub-page .spec-group {
  border: 1px solid #000;
  background: #fff;
}

.toolhub-page .spec-group-title {
  margin: 0;
  padding: 7px 10px;
  border-bottom: 1px solid #000;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.toolhub-page .spec-file-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.toolhub-page .spec-file-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.14);
}

.toolhub-page .spec-file-item:last-child {
  border-bottom: 0;
}

.toolhub-page .spec-file-name {
  min-width: 0;
  font-size: 12px;
  font-family: "JetBrains Mono", monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toolhub-page .spec-file-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.toolhub-page .spec-file-actions a {
  border: 1px solid #000;
  padding: 2px 7px;
  font-size: 11px;
  text-decoration: none;
  font-family: "JetBrains Mono", monospace;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.toolhub-page .spec-empty {
  margin: 0;
  border: 1px solid #000;
  padding: 10px;
  font-size: 12px;
  font-family: "JetBrains Mono", monospace;
}

@media (max-width: 980px) {
  /* Horizontal scroll layout works on all widths */
}

@media (max-width: 640px) {
  .topbar {
    padding: 14px;
  }

  .tool-grid {
    padding: 0 14px;
  }

  .logged-out-screen {
    padding: 24px 14px;
  }

  .tool-category {
    min-height: 180px;
  }

  .tool-category-title {
    font-size: 22px;
    width: 36px;
    height: 128px;
  }

  .tool-category-icon {
    width: 28px;
    height: 28px;
  }

  .tool-category[data-category="demos"] .tool-category-icon {
    width: 34px;
    height: 34px;
  }

  .tool-category[data-category="downloads"] .tool-category-title {
    font-size: 15.4px;
  }

  .tool-section-scroll {
    padding-left: calc(14px + 300px);
    margin-left: calc(-14px - 300px);
  }

  .tool-section-scroll .tool-card {
    width: 300px;
  }

  .footer {
    padding: 12px 14px;
    flex-direction: column;
    align-items: flex-start;
  }

  .toolhub-page .spec-panel {
    width: calc(100vw - 16px);
    max-height: 78vh;
  }

  .toolhub-page .spec-file-item {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .toolhub-page .spec-file-actions {
    justify-content: flex-start;
  }
}
