:root {
  --ink: #141414;
  --white: #ffffff;
  --coral: #ff5540;
  --frame: #1c1c1c;
  --night: #0c1222;
  --muted: rgba(255, 255, 255, 0.72);
  --line: rgba(255, 255, 255, 0.22);
  --stand-w: 440px;
  --rail-w: 35px;
  --radius: 18px;
  --tg-top: env(safe-area-inset-top, 0px);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--night);
  color: var(--white);
  min-height: 100vh;
}

.alley {
  padding: calc(16px + var(--tg-top)) 12px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.brand-cap {
  width: 100%;
  max-width: var(--stand-w);
  padding: 4px 4px 0;
}

.brand-cap a {
  font-size: 28px;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: var(--white);
  text-decoration: none;
}

.brand-cap a span {
  color: var(--coral);
}

.stand {
  width: 100%;
  max-width: var(--stand-w);
}

.stand-frame {
  display: flex;
  background: var(--frame);
  border-radius: var(--radius);
  padding: 5px;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.45);
}

.stand-face {
  flex: 1;
  min-width: 0;
  border-radius: calc(var(--radius) - 4px);
  padding: 28px 22px 20px;
  position: relative;
  overflow: hidden;
}

#top .stand-face {
  overflow: visible;
}

.stand-face::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.22;
}

.stand-face--red {
  background: linear-gradient(165deg, #ff3b30 0%, #ff5e2e 55%, #ff7840 100%);
}

.stand-face--red::before {
  background:
    radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.35) 0%, transparent 40%),
    radial-gradient(circle at 10% 90%, rgba(0, 0, 0, 0.15) 0%, transparent 50%);
}

.stand-face--cyan {
  background: linear-gradient(165deg, #2ec4d8 0%, #28b4cf 50%, #1fa3c0 100%);
}

.stand-face--cyan::before {
  background:
    radial-gradient(ellipse at 70% 30%, rgba(255, 255, 255, 0.2) 0%, transparent 45%),
    radial-gradient(ellipse at 20% 80%, rgba(0, 0, 0, 0.1) 0%, transparent 50%);
}

.stand-face--green {
  background: linear-gradient(165deg, #1fa88a 0%, #2db87a 45%, #6ec45a 100%);
}

.stand-face--green::before {
  background:
    radial-gradient(ellipse at 20% 80%, rgba(0, 0, 0, 0.12) 0%, transparent 50%),
    radial-gradient(ellipse at 85% 15%, rgba(255, 255, 255, 0.18) 0%, transparent 40%);
}

.stand-face--orange {
  background: linear-gradient(165deg, #ff4a28 0%, #ff6b1a 50%, #ff8c2a 100%);
}

.stand-face--orange::before {
  background: radial-gradient(circle at 50% 120%, rgba(0, 0, 0, 0.2) 0%, transparent 55%);
}

.stand-rail {
  width: var(--rail-w);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px 0;
  color: var(--white);
  opacity: 0.92;
}

.stand-dir {
  position: relative;
  z-index: 1;
  font-size: 15px;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 14px;
}

.stand-head {
  position: relative;
  z-index: 1;
  font-size: clamp(34px, 9vw, 52px);
  font-weight: 900;
  line-height: 1.02;
  letter-spacing: -0.03em;
  color: var(--white);
  margin-bottom: 6px;
}

.stand-head--tight {
  font-size: clamp(30px, 8vw, 44px);
  line-height: 1.08;
  font-weight: 800;
  margin-bottom: 4px;
}

.form-tbl,
.panel-embed {
  position: relative;
  z-index: 1;
  padding: 14px;
  background: rgba(0, 0, 0, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.28);
  margin-top: 4px;
}

.field-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 8px;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.stand-quick-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.quick-btn {
  padding: 10px 6px;
  border: 2px solid rgba(255, 255, 255, 0.72);
  background: transparent;
  color: var(--white);
  cursor: pointer;
  font-size: 12px;
  text-align: center;
}

.quick-btn:active {
  transform: scale(0.98);
}

.quick-btn.quick-event-btn {
  min-height: 66px;
  padding: 8px 6px;
  line-height: 1.1;
  text-transform: lowercase;
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-items: center;
  justify-content: center;
}

.quick-main {
  font-size: clamp(12px, 3vw, 15px);
  font-weight: 800;
  line-height: 1.05;
  text-transform: lowercase;
  text-wrap: balance;
  overflow-wrap: anywhere;
  hyphens: auto;
}

.quick-sub {
  font-size: clamp(8px, 2.1vw, 10px);
  line-height: 1.1;
  opacity: 0.88;
  text-transform: lowercase;
}

.tbl-grid-3 {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.28);
  margin-top: 16px;
}

.tbl-cell {
  background: rgba(0, 0, 0, 0.1);
  padding: 14px 8px;
  text-align: center;
}

.tbl-cell .val {
  font-size: clamp(28px, 8vw, 38px);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.03em;
}

.tbl-cell .lbl {
  margin-top: 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.8;
}

.tbl-cell .lbl-en {
  display: block;
  font-size: 9px;
  font-style: italic;
  opacity: 0.62;
}

.group-pick-wrap {
  position: relative;
  z-index: 2;
  margin-top: 12px;
}

.group-picker-btn {
  width: 100%;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(0, 0, 0, 0.2);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
}

.group-picker-btn #default-group {
  overflow-wrap: anywhere;
  word-break: break-word;
  text-align: left;
}

.group-picker-chevron {
  font-size: 11px;
  opacity: 0.8;
}

.group-picker-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  background: rgba(0, 0, 0, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 6px;
  z-index: 40;
  max-height: min(45vh, 320px);
  overflow-y: auto;
}

.group-picker-menu.hidden {
  display: none;
}

.group-option {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--white);
  padding: 8px 10px;
  font-size: 12px;
  cursor: pointer;
}

.group-option.active {
  background: rgba(255, 255, 255, 0.2);
}

.feed-cards {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.feed-card {
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(0, 0, 0, 0.14);
  padding: 10px;
}

.feed-table {
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(0, 0, 0, 0.16);
}

.feed-table-head,
.feed-table-row {
  display: grid;
  grid-template-columns: minmax(112px, 0.9fr) minmax(0, 2.4fr);
  gap: 8px;
  align-items: start;
  padding: 8px 10px;
}

.feed-table-head {
  border-bottom: 1px solid rgba(255, 255, 255, 0.25);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.24);
}

.feed-table-item {
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.feed-table-item:last-child {
  border-bottom: none;
}

.feed-table-row {
  font-size: 12px;
}

.col-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.meta-time {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.1;
}

.meta-type {
  font-weight: 900;
  text-transform: lowercase;
  line-height: 1.1;
}

.meta-user {
  font-weight: 700;
  line-height: 1.1;
  opacity: 0.92;
}

.col-details {
  display: block;
  min-width: 0;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(88px, max-content) 10px minmax(0, 1fr);
  column-gap: 6px;
  row-gap: 2px;
  align-items: start;
}

.detail-key {
  font-weight: 700;
  white-space: nowrap;
}

.detail-sep {
  text-align: center;
  opacity: 0.9;
}

.detail-value {
  min-width: 0;
  overflow-wrap: anywhere;
}

.detail-raw {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.feed-row-meta {
  padding: 0 10px 6px;
  font-size: 11px;
  color: var(--muted);
}

.feed-row-actions {
  padding: 0 10px 10px;
}

.feed-time,
.feed-meta,
.feed-comment-time,
.settings-hint,
.hint {
  color: var(--muted);
}

.feed-time {
  font-size: 11px;
}

.feed-meta {
  margin: 4px 0 8px;
  font-size: 12px;
}

.rx-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0;
}

.rx-btn {
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: var(--white);
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  cursor: pointer;
}

.rx-btn.active {
  background: rgba(255, 255, 255, 0.25);
}

.feed-comment {
  font-size: 12px;
  margin: 6px 0;
  padding: 8px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.feed-comment-text {
  display: block;
  margin-top: 4px;
  color: var(--white);
  white-space: pre-wrap;
}

.comment-row,
.group-create-row,
.group-rename-row,
.invite-row,
.settings-row,
.ban-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.comment-row {
  margin-top: 8px;
}

.comment-input,
.ban-message-input {
  flex: 1;
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.32);
  background: rgba(0, 0, 0, 0.2);
  color: var(--white);
  padding: 8px 10px;
  font-size: 13px;
}

.comment-input::placeholder,
.ban-message-input::placeholder {
  color: rgba(255, 255, 255, 0.84);
}

.comment-send,
.settings-chip,
.settings-toggle,
.btn-transfer,
.btn-danger,
.btn-ban,
.btn-unban,
.btn-remove-member {
  border: 1px solid rgba(255, 255, 255, 0.32);
  background: rgba(0, 0, 0, 0.2);
  color: var(--white);
  cursor: pointer;
}

.comment-send {
  padding: 8px 12px;
}

.feed {
  list-style: none;
  position: relative;
  z-index: 1;
}

.feed li {
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
}

.feed li:last-child {
  border-bottom: none;
}

.stand-gap-top {
  margin-top: 14px;
}

.settings-row {
  margin-bottom: 10px;
}

.settings-chip {
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 12px;
}

.settings-chip.active,
.settings-toggle.active,
.audit-btn.active {
  background: rgba(255, 255, 255, 0.26);
}

.settings-block {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.settings-toggle {
  width: 100%;
  padding: 10px 12px;
  text-align: left;
  font-size: 13px;
}

.group-detail {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.group-name,
.safe-text {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.admin-group-card {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.16);
  color: var(--white);
  padding: 10px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  margin-bottom: 8px;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.admin-stat {
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid var(--line);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
}

.admin-stat b {
  font-size: 19px;
}

.audit-feed li {
  font-size: 12px;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
}

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

.admin-user-row {
  flex-direction: column;
  align-items: flex-start !important;
  gap: 6px;
}

.admin-user-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
}

.ban-badge {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-danger,
.btn-transfer {
  width: 100%;
  padding: 9px;
  margin-top: 8px;
  text-align: left;
}

.btn-ban,
.btn-unban,
.btn-remove-member {
  padding: 2px 8px;
}

.member-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.invite-result {
  font-size: 12px;
  margin-bottom: 10px;
  word-break: break-all;
}

.invite-result code {
  background: rgba(0, 0, 0, 0.25);
  padding: 2px 6px;
}

.feed-live {
  color: #d4ffef;
  font-size: 10px;
  vertical-align: middle;
  animation: pulse 2s ease-in-out infinite;
}

.feed-live.hidden {
  display: none;
}

@keyframes pulse {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 1; }
}

.feed-cards.feed-refresh,
#feed-list.feed-refresh {
  animation: feedFlash 0.35s ease;
}

@keyframes feedFlash {
  from { opacity: 0.6; }
  to { opacity: 1; }
}

.grad-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.74);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}

.grad-card {
  width: 100%;
  max-width: 360px;
  background: #1b1f2d;
  border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 18px;
}

.grad-card h3 {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 14px;
}

.grad-card p {
  margin-bottom: 14px;
  font-size: 17px;
  font-weight: 700;
}

.grad-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 8px;
}

.ban-notify-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  margin-bottom: 8px;
}

.toast {
  position: fixed;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--ink);
  color: var(--white);
  padding: 12px 20px;
  font-size: 13px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 120;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.hidden {
  display: none !important;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 16px;
}

@media (max-width: 430px) {
  .stand-face {
    padding: 22px 16px 16px;
  }

  .brand-cap a {
    font-size: 24px;
  }

  .feed-table-head,
  .feed-table-row {
    grid-template-columns: minmax(98px, 0.9fr) minmax(0, 2.2fr);
  }

  .detail-grid {
    grid-template-columns: minmax(76px, max-content) 10px minmax(0, 1fr);
  }
}
