.sp {
  position: relative;
  z-index: 1;
}

.sp-gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: calc(var(--nav-h) + 50px) 22px 70px;
  text-align: center;
}

.sp-gate__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  max-width: 560px;
  animation: spin-up 0.8s var(--ease-out) both;
}

.sp-gate__tag {
  font-family: var(--font-brush);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  font-size: 0.82rem;
  color: var(--accent);
}

.sp-gate__big {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.6rem, 9vw, 5.5rem);
  line-height: 1;
  letter-spacing: 0.01em;
  background: linear-gradient(150deg, var(--primary-bright) 0%, var(--rose) 55%, var(--primary) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 18px 60px var(--glow-rose)) drop-shadow(0 6px 22px var(--glow));
}

.sp-gate__sub {
  color: var(--text-soft);
  line-height: 1.7;
  max-width: 460px;
}

.sp-gate__rule {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  font-family: var(--font-brush);
  font-size: 1.1rem;
  color: var(--accent);
  letter-spacing: 0.18em;
}

.sp-gate__rule i {
  width: 50px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--ink-line-strong));
}

.sp-gate__rule i:last-child {
  background: linear-gradient(90deg, var(--ink-line-strong), transparent);
}

.sp-gate__actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 6px;
}

.sp-app {
  padding-top: var(--nav-h);
}

.sp-rail {
  padding: 22px 16px 26px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-right: 1px solid var(--ink-line);
}

.sp-rail__brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 6px 12px 16px;
}

.sp-rail__kanji {
  font-family: var(--font-display);
  font-size: 1.7rem;
  color: var(--accent);
  line-height: 1;
}

.sp-rail__title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.16rem;
  letter-spacing: 0.02em;
}

.sp-rail__title span {
  display: block;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-mute);
  margin-top: 2px;
}

.sp-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sp-nav__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.22s, color 0.22s, border-color 0.22s, transform 0.22s;
  position: relative;
}

.sp-nav__item svg {
  width: 19px;
  height: 19px;
  flex-shrink: 0;
  opacity: 0.85;
}

.sp-nav__item:hover {
  background: var(--washi-strong);
  color: var(--text);
}

.sp-nav__item.is-active {
  background: linear-gradient(120deg, color-mix(in srgb, var(--primary) 22%, transparent), color-mix(in srgb, var(--rose) 14%, transparent));
  color: var(--text);
  border-color: var(--ink-line-strong);
}

.sp-nav__item.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 18%;
  bottom: 18%;
  width: 3px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--rose), var(--primary));
}

.sp-nav__count {
  margin-left: auto;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
}

.sp-rail__me {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--washi);
  border: 1px solid var(--ink-line);
}

.sp-rail__me img {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--ink-line-strong);
  object-fit: cover;
}

.sp-rail__me b {
  display: block;
  font-size: 0.92rem;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sp-main {
  padding: 30px clamp(20px, 3.4vw, 48px) 60px;
}

.sp-section {
  display: none;
  animation: spin-up 0.5s var(--ease-out) both;
}

.sp-section.is-active {
  display: block;
}

.sp-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 26px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--ink-line);
}

.sp-head__eyebrow {
  font-family: var(--font-brush);
  letter-spacing: 0.26em;
  text-transform: uppercase;
  font-size: 0.74rem;
  color: var(--accent);
}

.sp-head__title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.7rem, 2.6vw, 2.3rem);
  margin-top: 4px;
}

.sp-head__tools {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.sp-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 26px;
}

.sp-stat {
  position: relative;
  padding: 20px 20px 18px;
  border-radius: var(--radius);
  background: var(--card-grad);
  border: 1px solid var(--ink-line);
  overflow: hidden;
}

.sp-stat::after {
  content: "";
  position: absolute;
  right: -30px;
  top: -30px;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--glow-rose), transparent 70%);
  opacity: 0.5;
  pointer-events: none;
}

.sp-stat__label {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-mute);
}

.sp-stat__value {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 2.2rem;
  line-height: 1.1;
  margin-top: 6px;
}

.sp-stat__value small {
  font-size: 1rem;
  color: var(--text-mute);
  font-weight: 600;
}

.sp-stat--rose .sp-stat__value { color: var(--rose); }
.sp-stat--violet .sp-stat__value { color: var(--primary-bright); }
.sp-stat--gold .sp-stat__value { color: var(--seal); }

.sp-panel {
  border-radius: var(--radius);
  background: var(--card-grad);
  border: 1px solid var(--ink-line);
  padding: 24px;
  margin-bottom: 20px;
}

.sp-panel__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 9px;
}

.sp-panel__title i {
  color: var(--accent);
  font-style: normal;
  font-family: var(--font-display);
}

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

.sp-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.sp-field__label {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-soft);
}

.sp-input,
.sp-select,
.sp-textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--ink-line-strong);
  background: var(--washi);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color 0.22s, background 0.22s, box-shadow 0.22s;
}

.sp-input:focus,
.sp-select:focus,
.sp-textarea:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--washi-strong);
  box-shadow: 0 0 0 3px var(--glow-soft);
}

.sp-textarea {
  resize: vertical;
  min-height: 84px;
}

.sp-select option {
  background: var(--bg-2);
  color: var(--text);
}

.sp-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.sp-seg {
  display: inline-flex;
  padding: 4px;
  gap: 4px;
  border-radius: 999px;
  background: var(--washi);
  border: 1px solid var(--ink-line);
  flex-wrap: wrap;
}

.sp-seg__btn {
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-soft);
  transition: background 0.2s, color 0.2s;
  white-space: nowrap;
}

.sp-seg__btn.is-on {
  background: linear-gradient(120deg, var(--primary), var(--rose));
  color: #fff;
}

.sp-chiprow {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.sp-chip {
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--ink-line-strong);
  background: var(--washi);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-soft);
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.sp-chip:hover { color: var(--text); }

.sp-chip.is-on {
  background: linear-gradient(120deg, color-mix(in srgb, var(--primary) 30%, transparent), color-mix(in srgb, var(--rose) 22%, transparent));
  color: var(--text);
  border-color: var(--primary);
}

.sp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.2s var(--ease-spring), box-shadow 0.25s, background 0.2s, opacity 0.2s;
}

.sp-btn svg { width: 17px; height: 17px; }

.sp-btn--primary {
  background: linear-gradient(120deg, var(--primary), var(--rose));
  color: #fff;
  box-shadow: 0 14px 32px -16px var(--glow);
}

.sp-btn--primary:hover { transform: translateY(-2px); box-shadow: 0 20px 40px -16px var(--glow); }

.sp-btn--danger {
  background: linear-gradient(120deg, #f0506b, var(--rose-deep));
  color: #fff;
}

.sp-btn--danger:hover { transform: translateY(-2px); }

.sp-btn--ghost {
  background: var(--washi);
  border-color: var(--ink-line-strong);
  color: var(--text);
}

.sp-btn--ghost:hover { background: var(--washi-strong); }

.sp-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; }

.sp-btn--sm { padding: 8px 14px; font-size: 0.82rem; }

.sp-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.sp-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  border: 1px solid var(--ink-line-strong);
  background: var(--washi);
  color: var(--text-soft);
  white-space: nowrap;
}

.sp-badge--owner { background: linear-gradient(120deg, #f0c14b, #e08a2b); color: #2a1c05; border-color: transparent; }
.sp-badge--admin { background: linear-gradient(120deg, var(--primary), var(--rose)); color: #fff; border-color: transparent; }
.sp-badge--mod { background: color-mix(in srgb, var(--primary) 24%, transparent); color: var(--primary-bright); border-color: var(--ink-line-strong); }

.sp-badge--warn { background: color-mix(in srgb, var(--seal) 22%, transparent); color: var(--seal); border-color: transparent; }
.sp-badge--ban { background: color-mix(in srgb, #f0506b 26%, transparent); color: #ff9aac; border-color: transparent; }
.sp-badge--kick { background: color-mix(in srgb, #ff8a3d 24%, transparent); color: #ffb27d; border-color: transparent; }
.sp-badge--moderation { background: color-mix(in srgb, var(--rose) 22%, transparent); color: #ff9ad0; border-color: transparent; }
.sp-badge--chat { background: var(--washi-strong); color: var(--text-soft); }
.sp-badge--economie { background: color-mix(in srgb, var(--seal) 18%, transparent); color: var(--seal); }
.sp-badge--gameplay { background: color-mix(in srgb, var(--primary) 18%, transparent); color: var(--primary-bright); }
.sp-badge--joueur { background: color-mix(in srgb, #45c08a 22%, transparent); color: #7fe0b4; }

.sp-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sp-log {
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  background: var(--washi);
  border: 1px solid var(--ink-line);
  transition: background 0.2s, border-color 0.2s;
}

.sp-log:hover { background: var(--washi-strong); border-color: var(--ink-line-strong); }

.sp-log__time {
  font-size: 0.74rem;
  color: var(--text-mute);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.sp-log__body {
  min-width: 0;
}

.sp-log__line {
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sp-log__line b { color: var(--text); }

.sp-log__meta {
  font-size: 0.76rem;
  color: var(--text-mute);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sp-log__meta a { color: var(--primary-bright); }
.sp-log__meta a:hover { text-decoration: underline; }

.sp-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 8px;
}

.sp-table th {
  text-align: left;
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-mute);
  padding: 0 14px 6px;
  font-weight: 600;
}

.sp-table td {
  padding: 14px;
  background: var(--washi);
  border-top: 1px solid var(--ink-line);
  border-bottom: 1px solid var(--ink-line);
  font-size: 0.9rem;
  vertical-align: middle;
}

.sp-table td:first-child { border-left: 1px solid var(--ink-line); border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.sp-table td:last-child { border-right: 1px solid var(--ink-line); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

.sp-mono {
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 0.8rem;
  color: var(--text-soft);
}

.sp-name {
  font-weight: 600;
}

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

.sp-staffcard {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 15px;
  border-radius: var(--radius);
  background: var(--card-grad);
  border: 1px solid var(--ink-line);
  transition: transform 0.22s, border-color 0.22s;
}

.sp-staffcard:hover { transform: translateY(-3px); border-color: var(--ink-line-strong); }

.sp-staffcard img {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 1px solid var(--ink-line-strong);
  object-fit: cover;
  flex-shrink: 0;
}

.sp-staffcard__info { min-width: 0; }

.sp-staffcard__name {
  font-weight: 700;
  font-size: 0.98rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sp-staffcard__id {
  font-family: ui-monospace, monospace;
  font-size: 0.72rem;
  color: var(--text-mute);
  margin-top: 3px;
  cursor: pointer;
}

.sp-staffcard__id:hover { color: var(--primary-bright); }

.sp-staffcard__role { margin-top: 7px; }

.sp-empty {
  text-align: center;
  padding: 50px 20px;
  color: var(--text-mute);
}

.sp-empty__kanji {
  font-family: var(--font-display);
  font-size: 3rem;
  color: var(--ink-line-strong);
  margin-bottom: 8px;
}

.sp-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 60px 20px;
  color: var(--text-mute);
}

.sp-spinner {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid var(--ink-line-strong);
  border-top-color: var(--rose);
  animation: spin 0.8s linear infinite;
}

.sp-hint {
  font-size: 0.82rem;
  color: var(--text-mute);
  line-height: 1.6;
}

.sp-warn {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--seal) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--seal) 34%, transparent);
  color: var(--text-soft);
  font-size: 0.86rem;
  line-height: 1.55;
}

.sp-warn svg { width: 19px; height: 19px; color: var(--seal); flex-shrink: 0; margin-top: 1px; }

.sp-toasts {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(92vw, 380px);
}

.sp-toast {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--bg-2) 96%, transparent);
  border: 1px solid var(--ink-line-strong);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
  animation: spin-up 0.4s var(--ease-out) both;
}

.sp-toast__icon { width: 20px; height: 20px; flex-shrink: 0; margin-top: 1px; }
.sp-toast--ok .sp-toast__icon { color: #51d18b; }
.sp-toast--err .sp-toast__icon { color: #ff7a93; }
.sp-toast b { display: block; font-size: 0.92rem; margin-bottom: 2px; }
.sp-toast span { font-size: 0.82rem; color: var(--text-soft); }

@keyframes spin-up {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

.sp-edit {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 16px;
  align-items: start;
}

.sp-edit__tree {
  border-radius: var(--radius);
  border: 1px solid var(--ink-line);
  background: var(--washi);
  padding: 8px;
  max-height: 70vh;
  overflow-y: auto;
  scrollbar-width: thin;
}

.sp-treerow {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  cursor: default;
}

.sp-treerow:hover { background: var(--washi-strong); }
.sp-treerow.is-sel { background: linear-gradient(120deg, color-mix(in srgb, var(--primary) 22%, transparent), color-mix(in srgb, var(--rose) 14%, transparent)); }

.sp-treerow__t {
  flex: 1;
  min-width: 0;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sp-treerow__t i { font-style: normal; color: var(--accent); }

.sp-treerow__ctrl {
  display: flex;
  gap: 1px;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.2s;
}

.sp-treerow:hover .sp-treerow__ctrl, .sp-treerow.is-sel .sp-treerow__ctrl { opacity: 1; }

.sp-treerow__ctrl button {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  font-size: 0.8rem;
  color: var(--text-mute);
  border: 1px solid transparent;
}

.sp-treerow__ctrl button:hover { background: var(--washi-strong); color: var(--text); border-color: var(--ink-line); }

.sp-edit__main {
  border-radius: var(--radius);
  border: 1px solid var(--ink-line);
  background: var(--card-grad);
  padding: 20px;
}

.sp-edit__split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  align-items: start;
}

.sp-edit__split .sp-textarea { min-height: 360px; font-family: ui-monospace, monospace; font-size: 0.84rem; }

.sp-edit__prev {
  min-height: 360px;
  max-height: 520px;
  overflow-y: auto;
  padding: 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--ink-line);
  background: var(--washi);
  scrollbar-width: thin;
}

.sp-cat .sp-edit__prev { min-height: 80px; }

@media (max-width: 900px) {
  .sp-edit { grid-template-columns: 1fr; }
  .sp-edit__tree { max-height: 320px; }
  .sp-edit__split { grid-template-columns: 1fr; }
  .sp-edit__split .sp-textarea, .sp-edit__prev { min-height: 220px; }
  .sp-treerow__ctrl { opacity: 1; }
}

@media (min-width: 961px) {
  .sp-app {
    height: 100vh;
    display: grid;
    grid-template-columns: 280px 1fr;
    overflow: hidden;
  }
  .sp-rail {
    height: calc(100vh - var(--nav-h));
    overflow-y: auto;
    scrollbar-width: thin;
  }
  .sp-main {
    height: calc(100vh - var(--nav-h));
    overflow-y: auto;
  }
  .sp-main { scrollbar-width: thin; }
}

@media (max-width: 960px) {
  .sp-app { padding-top: calc(var(--nav-h) + 8px); }
  .sp-rail {
    flex-direction: row;
    overflow-x: auto;
    border-right: none;
    border-bottom: 1px solid var(--ink-line);
    padding: 12px 14px;
    gap: 8px;
    position: sticky;
    top: var(--nav-h);
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    backdrop-filter: blur(14px);
    z-index: 5;
  }
  .sp-rail__brand { display: none; }
  .sp-rail__me { display: none; }
  .sp-nav { flex-direction: row; gap: 6px; }
  .sp-nav__item { white-space: nowrap; padding: 10px 14px; }
  .sp-nav__item.is-active::before { display: none; }
  .sp-main { padding: 22px 18px 60px; }
}

@media (max-width: 620px) {
  .sp-row { grid-template-columns: 1fr; }
  .sp-log { grid-template-columns: 1fr; gap: 6px; }
  .sp-log__time { order: 3; }
  .sp-table thead { display: none; }
  .sp-table, .sp-table tbody, .sp-table tr, .sp-table td { display: block; width: 100%; }
  .sp-table tr { margin-bottom: 12px; }
  .sp-table td { border: 1px solid var(--ink-line); border-radius: var(--radius-sm); margin-bottom: -1px; }
  .sp-table td:first-child, .sp-table td:last-child { border-radius: var(--radius-sm); }
}

@media (prefers-reduced-motion: reduce) {
  .sp-section, .sp-gate__inner, .sp-toast { animation: none; }
  .sp-spinner { animation-duration: 1.6s; }
}
