:root {
  --bg: #16131c;
  --bg2: #221d2e;
  --bg3: #2a2436;
  --bg4: #342c44;
  --pink: #ff9ecf;
  --pink-glow: #ff6b9d;
  --accent: #c9a0ff;
  --accent2: #8be9fd;
  --text: #f4f1f8;
  --muted: #b6aecb;
  --border: #3a3350;
  --discord-blurple: #5865f2;
  --embed-pink: #ff9ecf;
  --radius: 14px;
  --gradient-accent: linear-gradient(135deg, #ff9ecf 0%, #c9a0ff 100%);
  --shadow-soft: 0 8px 28px rgba(0, 0, 0, 0.35);
  --shadow-glow: 0 0 24px rgba(201, 160, 255, 0.22);
  --font: "Segoe UI", "Noto Sans", system-ui, sans-serif;
}

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

body {
  font-family: var(--font);
  background:
    radial-gradient(1200px 600px at 12% -5%, rgba(201, 160, 255, 0.12), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(255, 158, 207, 0.10), transparent 55%),
    linear-gradient(135deg, #141019 0%, #1c1726 50%, #16131c 100%);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
}

.app {
  display: grid;
  grid-template-columns: 1fr 420px;
  grid-template-rows: auto auto 1fr;
  gap: 0;
  min-height: 100vh;
}

.page-single {
  grid-template-columns: 1fr;
  max-width: 1100px;
  margin: 0 auto;
}

.page-wide {
  grid-template-columns: 1fr;
  max-width: 1680px;
  margin: 0 auto;
  width: 100%;
}

.page-main {
  padding: 16px 24px 40px;
}

header {
  grid-column: 1 / -1;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

header h1 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  background: none;
  -webkit-text-fill-color: unset;
}

header h1.brand {
  background: linear-gradient(90deg, var(--pink), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.dash-nav {
  grid-column: 1 / -1;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 0 24px 12px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
}

.dash-nav-link {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  background: transparent;
  border: 1px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.dash-nav-link:hover {
  color: var(--text);
  background: var(--bg3);
}

.dash-nav-link.active {
  color: #fff;
  background: var(--discord-blurple);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 2px 12px rgba(88, 101, 242, 0.35);
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg3);
  border: 1px solid var(--pink);
  color: var(--text);
  padding: 12px 18px;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  z-index: 999;
  animation: toast-in 0.2s ease;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.btn-discord {
  background: var(--discord-blurple);
  color: #fff;
  width: 100%;
  margin-top: 8px;
  padding: 12px;
}

.btn-discord:hover {
  filter: brightness(1.08);
}

.login-divider {
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
  margin: 16px 0 8px;
}

.header-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

select,
input[type="text"],
input[type="password"],
input[type="number"],
input[type="email"],
textarea {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.9rem;
  font-family: inherit;
  width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
}

select {
  width: auto;
  min-width: 120px;
  cursor: pointer;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.field label,
label.field-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0;
}

.field-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.field-row .field {
  flex: 1;
  min-width: 120px;
  margin-bottom: 0;
}

.field-inline {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.8rem;
  color: var(--muted);
}

.field-inline input,
.field-inline select {
  width: auto;
  min-width: 100px;
}

select:focus,
input:focus,
textarea:focus {
  outline: 2px solid var(--pink);
  border-color: transparent;
}

textarea {
  resize: vertical;
  min-height: 80px;
  width: 100%;
  line-height: 1.45;
}

.btn {
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s, filter 0.15s;
  font-family: inherit;
}

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

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

.btn-primary {
  background: var(--gradient-accent);
  color: #1a1b1e;
  box-shadow: 0 4px 14px rgba(255, 107, 157, 0.28);
}

.btn-secondary {
  background: var(--bg4);
  color: var(--text);
}

.btn-danger {
  background: #ed4245;
  color: white;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 0.8rem;
}

.editor {
  padding: 20px 24px 40px;
  overflow-y: auto;
  max-height: calc(100vh - 60px);
}

.preview-panel {
  background: var(--bg);
  border-left: 1px solid var(--border);
  padding: 20px;
  overflow-y: auto;
  max-height: calc(100vh - 60px);
  position: sticky;
  top: 0;
}

.preview-panel h2 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 14px;
}

.panel {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0)), var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-soft);
}

.panel h3 {
  font-size: 0.95rem;
  margin-bottom: 12px;
  color: var(--pink);
}

.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  align-items: center;
}

.row label {
  font-size: 0.8rem;
  color: var(--muted);
  min-width: 80px;
}

.field {
  margin-bottom: 12px;
}

.field label {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 4px;
}

.color-input {
  width: 48px;
  height: 36px;
  padding: 2px;
  cursor: pointer;
  border: none;
  border-radius: 6px;
}

.embed-card {
  background: var(--bg3);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
  position: relative;
}

.embed-card .embed-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.embed-fields-list {
  margin-top: 10px;
}

.embed-field-item {
  background: var(--bg2);
  padding: 10px;
  border-radius: 8px;
  margin-bottom: 8px;
}

/* Discord preview */
.discord-preview {
  background: #313338;
  border-radius: 8px;
  padding: 16px 16px 8px 72px;
  position: relative;
  min-height: 120px;
}

.discord-preview::before {
  content: "";
  position: absolute;
  left: 16px;
  top: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--pink), var(--accent));
}

.discord-author {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 4px;
  color: var(--pink);
}

.discord-content {
  color: #dbdee1;
  font-size: 0.95rem;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: 8px;
}

.discord-banner {
  max-width: 100%;
  border-radius: 8px 8px 0 0;
  display: block;
  margin-bottom: 0;
}

.discord-embed {
  border-left: 4px solid var(--embed-pink);
  background: #2b2d31;
  border-radius: 0 8px 8px 0;
  padding: 12px 16px 12px 12px;
  margin: 4px 0 8px;
  max-width: 520px;
}

.discord-embed.no-border {
  border-left: none;
  padding: 0;
  background: transparent;
}

.discord-embed.no-border img {
  border-radius: 8px;
  max-width: 100%;
}

.discord-embed-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: #fff;
  margin-bottom: 6px;
}

.discord-embed-desc {
  font-size: 0.875rem;
  color: #dbdee1;
  line-height: 1.45;
  white-space: pre-wrap;
}

.discord-embed-desc strong {
  color: #fff;
  font-weight: 700;
}

.discord-embed-desc .inline-emoji,
.discord-content .inline-emoji {
  width: 1.25em;
  height: 1.25em;
  vertical-align: -0.2em;
  display: inline;
}

.discord-embed-field {
  margin-top: 8px;
}

.discord-embed-field-name {
  font-weight: 600;
  font-size: 0.8rem;
  color: #fff;
  margin-bottom: 2px;
}

.discord-embed-image {
  margin-top: 10px;
  max-width: 100%;
  border-radius: 6px;
}

.discord-embed-thumb {
  float: right;
  max-width: 80px;
  border-radius: 6px;
  margin-left: 12px;
}

.discord-embed-footer {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 8px;
}

/* Emoji picker */
.emoji-panel {
  display: none;
  position: fixed;
  z-index: 1000;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  width: 360px;
  max-height: 400px;
  overflow: hidden;
  flex-direction: column;
}

.emoji-panel.hidden {
  display: none;
}

#emoji-panel:not(.hidden) {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 360px;
  padding: 12px;
  position: fixed;
  z-index: 1000;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.emoji-pick {
  border: none;
  background: var(--bg3);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 1.2rem;
  cursor: pointer;
}

.emoji-pick:hover {
  background: var(--bg4);
}

.emoji-panel.open {
  display: flex;
}

.emoji-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
}

.emoji-tabs button {
  flex: 1;
  padding: 10px;
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-weight: 600;
}

.emoji-tabs button.active {
  color: var(--pink);
  border-bottom: 2px solid var(--pink);
}

.emoji-search {
  padding: 8px;
  border-bottom: 1px solid var(--border);
}

.emoji-search input {
  width: 100%;
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
  padding: 8px;
  overflow-y: auto;
  flex: 1;
}

.emoji-grid button {
  background: transparent;
  border: none;
  padding: 6px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1.4rem;
  line-height: 1;
}

.emoji-grid button:hover {
  background: var(--bg4);
}

.emoji-grid button img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.templates-list {
  max-height: 200px;
  overflow-y: auto;
}

.template-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  margin-bottom: 4px;
}

.template-item:hover,
.template-item.active {
  background: var(--bg4);
}

.banner-preview {
  max-height: 160px;
  border-radius: 8px;
  margin-top: 8px;
  object-fit: cover;
  width: 100%;
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg2);
  border: 1px solid var(--pink);
  padding: 12px 20px;
  border-radius: 10px;
  z-index: 2000;
  animation: fadeIn 0.2s;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.toast.error {
  border-color: #ed4245;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.hidden {
  display: none !important;
}

.role-chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 500;
  margin: 2px;
  cursor: pointer;
  border: none;
  color: #fff;
}

.markdown-hint {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 4px;
}

@media (max-width: 1100px) {
  .app {
    grid-template-columns: 1fr;
  }
  .preview-panel {
    border-left: none;
    border-top: 1px solid var(--border);
    max-height: none;
  }
}

.portal-app {
  grid-template-columns: 1fr;
  max-width: 1100px;
  margin: 0 auto;
}

.portal-main {
  padding: 16px 24px 40px;
}

.login-hint {
  text-align: center;
  color: var(--muted);
  padding: 48px 24px;
}

.member-header {
  display: flex;
  gap: 16px;
  align-items: center;
}

.member-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 2px solid var(--pink);
}

.xp-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  margin-top: 8px;
  overflow: hidden;
}

.xp-fill {
  height: 100%;
  background: linear-gradient(90deg, rgba(255, 158, 196, 0.55), rgba(200, 160, 255, 0.5));
  width: 0;
}

.profile-preview-wrap {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  background:
    repeating-conic-gradient(rgba(255, 255, 255, 0.04) 0% 25%, transparent 0% 50%) 50% / 16px 16px,
    var(--bg3);
  border-radius: 8px;
  padding: 12px;
}

.profile-preview-img {
  max-width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border);
  display: block;
}

.badge {
  display: inline-block;
  padding: 4px 8px;
  margin: 4px;
  background: var(--bg3);
  border-radius: 6px;
  font-size: 0.85rem;
}

.tab-nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 0 0 12px;
  margin-bottom: 4px;
}

.tab-nav .tab {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
}

.tab-nav .tab.active {
  background: rgba(201, 160, 255, 0.22);
  border-color: var(--accent);
  color: #fff;
  box-shadow: var(--shadow-glow);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.game-card {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
}

.game-card.locked {
  opacity: 0.55;
}

.game-card .thumb {
  width: 100%;
  height: 100px;
  object-fit: cover;
  border-radius: 6px;
  margin-bottom: 8px;
  display: block;
}

.game-card-title {
  font-weight: 600;
  margin-bottom: 4px;
}

.game-card-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
}

.list-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.search-results {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.search-hit {
  text-align: left;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
}

.search-hit:hover {
  border-color: var(--pink);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
}

.row.wrap {
  flex-wrap: wrap;
  gap: 12px;
}

.catalog-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.catalog-fields {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
}

.catalog-fields label {
  font-size: 0.75rem;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.catalog-fields input[type="text"],
.catalog-fields input[type="number"] {
  width: 100%;
}

.tag {
  display: inline-block;
  background: var(--bg4);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.8rem;
  margin: 2px;
}

.muted {
  color: var(--muted);
  font-size: 0.85rem;
}

.profile-editor-main .profile-editor-grid {
  display: grid;
  grid-template-columns: minmax(520px, 1.2fr) minmax(440px, 0.8fr);
  gap: 28px;
  align-items: start;
}

.profile-editor-top {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.profile-preview-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

.profile-toolbar-field {
  min-width: 160px;
  flex: 1 1 160px;
  max-width: 240px;
  margin: 0;
}

.profile-toolbar-member {
  max-width: 320px;
  flex: 2 1 220px;
}

.profile-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.profile-editor-preview-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}

.profile-editor-preview-center .profile-canvas-wrap {
  width: 100%;
}

.profile-preview-note {
  text-align: center;
  margin: 0;
}

.profile-editor-columns {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
}

.profile-preview-zoom-wrap {
  width: 100%;
  transform-origin: center top;
  transition: transform 0.15s ease;
}

.profile-toolbar-zoom {
  max-width: 180px;
  flex: 0 1 180px;
}

.profile-toolbar-zoom #preview-zoom-val {
  display: block;
  font-size: 0.8rem;
  margin-top: 4px;
}

.profile-editor-tools {
  margin-top: 0;
}

.profile-editor-tools-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  align-items: center;
}

.tool-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--muted);
  cursor: pointer;
}

.tool-check input {
  accent-color: var(--pink);
}

.profile-editor-col h3 {
  margin-bottom: 12px;
}

.profile-col-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.profile-editor-elements {
  margin-top: 0;
}

.profile-elements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.color-field-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--muted);
}

.color-field-row > span {
  font-weight: 600;
  color: var(--text);
}

.color-field-inputs {
  display: flex;
  align-items: center;
  gap: 8px;
}

.color-field-inputs .color-rgb-input {
  flex: 1;
  min-width: 0;
}

.profile-editor-preview {
  position: sticky;
  top: 16px;
}

.profile-editor-preview h3 {
  margin-bottom: 12px;
}

.profile-editor-controls-scroll {
  max-height: calc(100vh - 180px);
  overflow-y: auto;
  padding-right: 8px;
}

.profile-editor-controls-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.profile-editor-controls-grid .panel-block {
  grid-column: 1 / -1;
}

.profile-editor-controls-grid .panel-block-half {
  min-width: 0;
}

@media (max-width: 1400px) {
  .profile-editor-columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

  .profile-editor-main .profile-editor-grid {
    grid-template-columns: 1fr;
  }

  .profile-editor-controls-grid {
    grid-template-columns: 1fr;
  }

  .profile-editor-controls-scroll {
    max-height: none;
  }

  .profile-toolbar-field,
  .profile-toolbar-member {
    max-width: none;
  }
}

.profile-canvas-wrap {
  position: relative;
  width: 100%;
  max-width: none;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  background:
    repeating-conic-gradient(rgba(255, 255, 255, 0.04) 0% 25%, transparent 0% 50%) 50% / 16px 16px,
    var(--bg3);
}

.profile-preview-img {
  display: block;
  width: 100%;
  height: auto;
}

.profile-overlay-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.profile-drag-box {
  position: absolute;
  pointer-events: auto;
  border: 2px dashed rgba(255, 180, 220, 0.9);
  background: rgba(255, 120, 180, 0.15);
  color: #fff;
  font-size: 10px;
  padding: 2px 4px;
  cursor: move;
  border-radius: 6px;
  user-select: none;
}

.element-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 520px;
  overflow-y: auto;
}

.element-control-row {
  background: var(--bg3);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.85rem;
}

.element-control-row label {
  display: block;
}

.mini-label {
  display: block;
  margin-top: 6px;
  font-size: 0.78rem;
  color: var(--muted);
}

.mini-label input[type="range"] {
  width: 100%;
}

.currency-editor-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

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

.currency-editor-card {
  background: var(--bg3);
  border-radius: 10px;
  padding: 14px;
}

.currency-preview {
  width: 48px;
  height: 48px;
  object-fit: contain;
  margin: 8px 0 12px;
  display: none;
}

.currency-icon {
  vertical-align: middle;
  object-fit: contain;
  margin: 0 2px;
}

.emoji-grid button.emoji-all-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: auto;
  min-height: 56px;
  padding: 4px;
  gap: 2px;
}

.emoji-guild {
  display: block;
  font-size: 9px;
  color: var(--muted);
  max-width: 52px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --- Settings page --- */
.settings-main {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  padding-bottom: 40px;
}

.settings-main .panel-wide {
  grid-column: 1 / -1;
}

.settings-field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px 16px;
  margin-top: 12px;
}

.settings-field-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--muted);
}

.settings-field-grid label span {
  font-weight: 600;
  color: var(--text);
}

.settings-field-grid input,
.settings-field-grid textarea,
.settings-field-grid select {
  width: 100%;
}

.settings-section-desc {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.45;
}

.currency-editor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 12px;
}

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

/* ── Портал участника: hero, статы, кафе, ежедневки ───────────── */
.hero-panel {
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(255, 158, 196, 0.16), transparent 55%),
    radial-gradient(120% 140% at 100% 0%, rgba(201, 160, 255, 0.16), transparent 55%),
    var(--bg2);
  border: 1px solid var(--border);
}

.member-head-info h2 {
  margin: 0 0 6px;
}

.member-stats-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

#member-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 4px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  font-size: 0.82rem;
  font-weight: 600;
}

.xp-label {
  margin: 4px 0 0;
  font-size: 0.78rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.stat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 14px 10px;
  border-radius: var(--radius);
  background: var(--bg2);
  border: 1px solid var(--border);
  text-align: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-glow);
}

.stat-ico {
  font-size: 1.5rem;
}

.stat-val {
  font-size: 1.25rem;
  font-weight: 800;
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.stat-lbl {
  font-size: 0.74rem;
  color: var(--muted);
}

.portal-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

/* Кафе */
.cafe-panel {
  background:
    radial-gradient(140% 120% at 100% 0%, rgba(255, 200, 120, 0.12), transparent 60%),
    var(--bg2);
}

.cafe-visual {
  display: flex;
  gap: 16px;
  margin-top: 12px;
}

.cafe-art {
  position: relative;
  flex: 0 0 120px;
  height: 120px;
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 220, 170, 0.18), rgba(201, 160, 255, 0.12)),
    var(--bg3);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}

.cafe-emoji {
  font-size: 3.4rem;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.4));
  animation: cafe-bob 3s ease-in-out infinite;
}

@keyframes cafe-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.cafe-lvl-badge {
  position: absolute;
  bottom: 6px;
  right: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  background: var(--gradient-accent);
  color: #1a1320;
}

.cafe-info {
  flex: 1;
  min-width: 0;
}

.cafe-tier {
  margin: 0 0 6px;
  font-weight: 700;
  color: var(--pink);
}

.cafe-rate {
  font-size: 1.05rem;
  margin-bottom: 10px;
}

.cafe-store-bar {
  height: 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
  overflow: hidden;
  margin-bottom: 4px;
}

.cafe-store-fill {
  height: 100%;
  background: linear-gradient(90deg, #ffd479, #ff9ecf);
  transition: width 0.4s ease;
}

.cafe-workers {
  margin-top: 10px;
  font-size: 0.85rem;
}

.cafe-worker-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.cafe-worker {
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  font-size: 0.78rem;
}

.cafe-upgrade {
  margin-top: 10px;
}

.cafe-hint {
  margin-top: 12px;
  font-size: 0.78rem;
}

/* Ежедневки */
.daily-streak {
  margin: 4px 0 12px;
}

.daily-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.daily-row.done .daily-top {
  color: var(--accent2);
}

.daily-top {
  display: flex;
  justify-content: space-between;
  font-size: 0.86rem;
  margin-bottom: 4px;
  gap: 8px;
}

.daily-bar {
  height: 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
  overflow: hidden;
}

.daily-fill {
  height: 100%;
  background: var(--gradient-accent);
  transition: width 0.4s ease;
}

.tag-ready {
  background: rgba(139, 233, 253, 0.2);
  border-color: var(--accent2);
  color: #d6fbff;
}

.tag-done {
  background: rgba(120, 255, 170, 0.18);
  border-color: #7effa9;
  color: #d6ffe6;
}

@media (max-width: 720px) {
  .portal-cols {
    grid-template-columns: 1fr;
  }
  .cafe-visual {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .cafe-worker-list {
    justify-content: center;
  }
}
