:root {
  --bg: #1a1a1a;
  --panel: #212121;
  --panel-2: #1c1c1c;
  --border: #383838;
  --text: #d4d4d4;
  --muted: #8a8a8a;
  --accent: #b388ff;
  --accent-2: #80cbc4;
  --button-bg: #2c2040;
  --button-border: #4a2e7a;
  --like: #f0a8c8;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "MS PGothic", "MS UI Gothic", sans-serif;
  min-height: 100%;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(1100px 620px at 82% 14%, rgba(179, 136, 255, 0.13), transparent 58%),
    radial-gradient(760px 500px at 18% 86%, rgba(128, 203, 196, 0.09), transparent 60%);
  z-index: 0;
}

#formulaBg {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  opacity: 0.46;
}

#topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #202020;
  border-bottom: 1px solid #3a3a3a;
  padding: 5px 12px;
  font-size: 12px;
  line-height: 1.6;
  color: #666;
  display: flex;
  align-items: center;
  gap: 4px;
}

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

#topbar a:hover { text-decoration: underline; }
#topbar .sep { color: #444; }
#topbar .current { color: #aaa; }

main {
  position: relative;
  z-index: 1;
  width: min(1160px, 100% - 24px);
  margin: 20px auto 42px;
}

a.site-title {
  display: block;
  text-decoration: none;
  font-size: 18px;
  color: #b388ff;
  font-weight: bold;
  letter-spacing: 1px;
  margin-top: -8px;
  margin-bottom: 18px;
  padding: 8px 0 6px;
  border-bottom: 1px solid #333;
}

a.site-title:hover { text-decoration: none; }
.site-title .seg { display: inline-block; position: relative; transform-origin: center bottom; }

.hero,
.panel {
  background: linear-gradient(180deg, rgba(35, 35, 35, 0.92), rgba(28, 28, 28, 0.92));
  border: 1px solid #3f3f3f;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.2);
}

.crumb {
  color: var(--accent);
  font-size: 11px;
  margin-bottom: 2px;
}

h1 {
  margin: 0;
  font-size: clamp(1.5rem, 4vw, 2rem);
  color: var(--accent);
  letter-spacing: 0.02em;
  font-weight: normal;
}

.subtitle {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.actions {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  border: 1px solid var(--button-border);
  background: var(--button-bg);
  color: var(--accent);
  padding: 8px 12px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.btn:hover { filter: brightness(1.1); }

.btn.secondary {
  background: #1b2432;
  border-color: #365077;
  color: #9ac5ff;
}

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

.panel-title {
  font-size: 11px;
  text-transform: lowercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 10px;
}

label {
  display: block;
  font-size: 11px;
  color: var(--accent);
  margin-bottom: 4px;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  padding: 7px 8px;
  font: inherit;
  font-size: 12px;
}

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

.field { margin-bottom: 10px; }

.hint {
  font-size: 10px;
  color: var(--muted);
  line-height: 1.45;
}

.notice {
  margin-top: 8px;
  font-size: 11px;
  color: #96a0b5;
  border-top: 1px solid #313131;
  padding-top: 8px;
}

.gallery-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  gap: 8px;
}

.count {
  font-size: 11px;
  color: var(--muted);
}

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

.card {
  border: 1px solid #3a3a3a;
  background: linear-gradient(180deg, #212121, #1b1b1b);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.card:hover {
  transform: translateY(-1px);
  border-color: #4d4d4d;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.22);
}

.thumb {
  height: 154px;
  border-bottom: 1px solid #2d2d2d;
  position: relative;
  overflow: hidden;
  background: #0a0b10;
}

.thumb-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.meta {
  padding: 10px;
}

.title {
  font-size: 12px;
  color: #ddd;
  margin-bottom: 4px;
}

.author {
  font-size: 10px;
  color: #9a9a9a;
  margin-bottom: 6px;
}

.desc {
  font-size: 11px;
  color: #bcbcbc;
  line-height: 1.4;
  min-height: 0;
}

.tags {
  margin-top: 6px;
  font-size: 10px;
  color: #a6aecd;
}

.card-actions {
  margin-top: 8px;
  display: flex;
  gap: 7px;
}

.card-stats {
  margin-top: 6px;
  font-size: 10px;
  color: #9298a8;
}

.open {
  background: #1e2a39;
  border-color: #3b5776;
  color: #9fc6ff;
}

.like {
  border: 1px solid #6f3f58;
  background: #341f2b;
  color: var(--like);
}

.like.active {
  border-color: #ad5f84;
  color: #ffd2e4;
}

footer {
  text-align: center;
  color: #555;
  font-size: 11px;
  padding: 18px 10px 26px;
}

@media (max-width: 940px) {
  .grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 700px) {
  main {
    width: calc(100% - 16px);
    margin: 12px auto 24px;
  }

  .site-title {
    font-size: 15px;
    margin-bottom: 14px;
  }

  .hero,
  .panel {
    padding: 12px;
    margin-bottom: 10px;
  }

  .actions {
    gap: 6px;
  }

  .actions .btn {
    flex: 1 1 100%;
    min-height: 38px;
  }

  .card-actions {
    flex-wrap: wrap;
  }

  .card-actions .btn {
    flex: 1 1 calc(50% - 4px);
    min-height: 34px;
  }
}
