/* sharemymod - one stylesheet, no framework. */

:root {
  color-scheme: dark;

  --bg: #0d1117;
  --bg-raised: #151b23;
  --bg-sunken: #0a0e14;
  --border: #262d38;
  --border-strong: #38414f;

  --text: #e6edf3;
  --text-dim: #9aa7b6;
  --text-faint: #6e7d8f;

  --accent: #7ee787;
  --accent-ink: #08130b;
  --danger: #ff7b72;

  --radius: 10px;
  --radius-lg: 14px;

  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, monospace;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.25;
}

/* -------------------------------------------------------------------- Wordmark */

.wordmark {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.wordmark span {
  color: var(--accent);
}

/* -------------------------------------------------------------------- Gate */

.gate {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
  background: radial-gradient(ellipse at top, #16202c 0%, var(--bg) 60%);
}

.gate-card {
  width: 100%;
  max-width: 380px;
  padding: 32px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.gate .wordmark {
  font-size: 1.6rem;
}

.tagline {
  margin: 6px 0 26px;
  color: var(--text-dim);
  font-size: 0.9rem;
}

.gate-form {
  display: grid;
  gap: 16px;
}

/* -------------------------------------------------------------------- Captcha */

/*
 * The reCAPTCHA iframe is a fixed 304x78 and cannot be restyled from here, so
 * this only reserves room for it. The height is held even before it renders,
 * so the Unlock button does not jump down the moment Google's script lands.
 */
.captcha {
  min-height: 78px;
}

.captcha > div {
  /* Centre it: 304px inside a card narrower than that would sit flush left. */
  margin: 0 auto;
}

/* -------------------------------------------------------------------- Top bar */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 5;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.stat {
  color: var(--text-faint);
  font-size: 0.8rem;
}

/* -------------------------------------------------------------------- Layout */

.layout {
  display: grid;
  grid-template-columns: minmax(320px, 380px) 1fr;
  gap: 24px;
  align-items: start;
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px;
}

.panel {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
}

.upload-panel {
  position: sticky;
  top: 82px;
}

.panel h2 {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin-bottom: 18px;
}

/* -------------------------------------------------------------------- Fields */

.field {
  display: grid;
  gap: 6px;
}

.field-label {
  font-size: 0.78rem;
  color: var(--text-dim);
}

.field-label em {
  color: var(--text-faint);
  font-style: normal;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 110px;
  gap: 12px;
}

input[type='text'],
input[type='password'],
input[type='search'],
textarea {
  width: 100%;
  padding: 9px 11px;
  background: var(--bg-sunken);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
}

textarea {
  resize: vertical;
  min-height: 62px;
}

input:focus-visible,
textarea:focus-visible,
.dropzone:focus-visible,
.button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

::placeholder {
  color: var(--text-faint);
}

/* -------------------------------------------------------------------- Upload form */

.upload-form {
  display: grid;
  gap: 14px;
}

.dropzone {
  display: grid;
  place-items: center;
  min-height: 108px;
  padding: 18px;
  background: var(--bg-sunken);
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
}

.dropzone:hover,
.dropzone.dragging {
  border-color: var(--accent);
  background: #0e1a12;
}

.dropzone.has-file {
  border-style: solid;
  border-color: var(--accent);
}

.dropzone-hint {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.87rem;
  overflow-wrap: anywhere;
}

.dropzone.has-file .dropzone-hint {
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.8rem;
}

/* -------------------------------------------------------------------- Progress */

.progress {
  position: relative;
  height: 22px;
  background: var(--bg-sunken);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.2s ease-out;
}

.progress-label {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 0.74rem;
  font-family: var(--mono);
  color: var(--text);
  mix-blend-mode: difference;
}

/* -------------------------------------------------------------------- Buttons */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font: inherit;
  font-size: 0.87rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

.button.primary {
  background: var(--accent);
  color: var(--accent-ink);
}

.button.primary:hover {
  filter: brightness(1.08);
}

.button.ghost {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text-dim);
}

.button.ghost:hover {
  border-color: var(--text-faint);
  color: var(--text);
}

.button.danger.ghost:hover {
  border-color: var(--danger);
  color: var(--danger);
}

.button:disabled {
  opacity: 0.5;
  cursor: default;
  filter: none;
}

/* -------------------------------------------------------------------- Messages */

.error,
.success {
  margin: 0;
  padding: 9px 12px;
  border-radius: var(--radius);
  font-size: 0.84rem;
}

.error {
  background: #2a1416;
  border: 1px solid #5c2a2a;
  color: var(--danger);
}

.success {
  background: #10231a;
  border: 1px solid #2c5c3c;
  color: var(--accent);
}

/* -------------------------------------------------------------------- List */

.list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.list-header h2 {
  margin: 0;
}

.search {
  max-width: 320px;
}

.mods {
  display: grid;
  gap: 12px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.mod {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 16px;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.mod-main {
  min-width: 0;
}

.mod-name {
  font-size: 1rem;
  overflow-wrap: anywhere;
}

.mod-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 6px 0 0;
  color: var(--text-dim);
  font-size: 0.8rem;
}

.mod-meta span:empty {
  display: none;
}

.chip {
  padding: 2px 8px;
  background: #1b2b20;
  border: 1px solid #2c5c3c;
  border-radius: 999px;
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 600;
}

.mod-description {
  margin: 10px 0 0;
  color: var(--text-dim);
  font-size: 0.86rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.mod-path {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  margin: 10px 0 0;
}

.mod-path-label {
  color: var(--text-faint);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.mod-path code {
  padding: 2px 7px;
  background: #12181f;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.78rem;
  /* Paths break at separators, not mid-word, and must never widen the card. */
  overflow-wrap: anywhere;
}

.mod-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 10px 0 0;
  color: var(--text-faint);
  font-size: 0.76rem;
}

.mod-hash {
  margin: 4px 0 0;
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 0.7rem;
  overflow-wrap: anywhere;
}

.mod-actions {
  display: grid;
  gap: 8px;
  justify-items: stretch;
}

.empty {
  margin: 8px 0 0;
  color: var(--text-faint);
  font-size: 0.88rem;
}

/* -------------------------------------------------------------------- Narrow */

@media (max-width: 880px) {
  .layout {
    grid-template-columns: 1fr;
    padding: 16px;
    gap: 16px;
  }

  .upload-panel {
    position: static;
  }

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

  .search {
    max-width: none;
  }

  .mod {
    flex-direction: column;
  }

  .mod-actions {
    width: 100%;
    grid-auto-flow: column;
  }
}
