/* Tintink — Original Design (Minimalist, No Hover Animations) */

:root {
  --bg: #f7fbff;
  --panel: rgba(255,255,255,.92);
  --line: rgba(15,23,42,.08);
  --text: #0f172a;
  --muted: #64748b;
  --accent: #38bdf8;
  --pink: #f472b6;
  --shadow: 0 18px 45px rgba(15,23,42,.12);
  --radius: 20px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: 'Nunito', system-ui, sans-serif;
  color: var(--text);
  background: radial-gradient(900px 400px at 10% 0%, rgba(56,189,248,.16), transparent 55%),
              radial-gradient(900px 450px at 95% 15%, rgba(244,114,182,.14), transparent 50%),
              var(--bg);
}

/* Скрыть текст до полной загрузки шрифтов (предотвращает «прыжки») */
.fonts-loading .user-name,
.fonts-loading .resource,
.fonts-loading .icon-btn,
.fonts-loading .sort-btn,
.fonts-loading .gallery-fab,
.fonts-loading .snapshot-fab,
.fonts-loading .auth-form input,
.fonts-loading .auth-form button,
.fonts-loading .auth-logo,
.fonts-loading .menu-logo,
.fonts-loading .back-to-menu-btn,
.fonts-loading #toast {
  color: transparent !important;
  opacity: 0 !important;
  transition: opacity 0.15s ease;
}

.fonts-loading .resource,
.fonts-loading .back-to-menu-btn,
.fonts-loading .icon-btn,
.fonts-loading .sort-btn,
.fonts-loading .gallery-fab,
.fonts-loading .snapshot-fab {
  background-color: transparent !important;
}

.material-symbols-rounded {
  font-family: 'Material Symbols Rounded';
  font-weight: normal;
  font-style: normal;
  font-size: 18px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
}

#main-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  touch-action: none;
  cursor: crosshair;
  background: #234f8f;
  z-index: 2;
}

#selection {
  position: fixed;
  display: none;
  border: 2px dashed #94a3b8;
  background: rgba(148,163,184,.1);
  pointer-events: none;
  z-index: 15;
  border-radius: 4px;
}

#selection.ok {
  border-color: #22c55e;
  background: rgba(34,197,94,.10);
}

#selection.bad {
  border-color: #f43f5e;
  background: rgba(244,63,94,.10);
}

#brush-cursor {
  position: fixed;
  z-index: 14;
  pointer-events: none;
  display: none;
  image-rendering: pixelated;
}

/* ==================== LEFT STACK ==================== */

.left-stack,
#left-panel {
  position: fixed;
  top: 16px;
  left: 16px;
  bottom: 16px;
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 150px;
  transition: left .35s ease;
  pointer-events: none;
}

.left-stack > *,
#left-panel > * {
  pointer-events: auto;
}

body.gallery-open .left-stack,
body.gallery-open #left-panel {
  left: calc(min(370px, 100vw) + 16px);
}

/* Profile */
.profile-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding-top: 4px;
}

.user-fab,
#profile-avatar {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: #fff center/cover no-repeat;
  border: 3px solid var(--muted);
  color: var(--muted);
  font-weight: 900;
  font-size: 26px;
  cursor: pointer;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.user-name {
  font-weight: 900;
  font-size: 14px;
  line-height: 1.1;
  text-align: center;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 1px 8px rgba(255,255,255,.6);
}

/* Resources */
.res-row {
  display: flex;
  gap: 6px;
}

.resource {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 4px;
  border-radius: 14px;
  font-size: 12px;
  font-weight: 900;
  border: 1px solid var(--line);
}

.resource.drops {
  flex: 1;
  background: rgba(56,189,248,.12);
  color: #0369a1;
}

.resource.drops.low {
  background: rgba(251,113,133,.14);
  color: #be123c;
}

.resource.shine {
  background: rgba(250,204,21,.16);
  color: #92400e;
}

/* Tools 2x2 */
.block.tools {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.block.tools button {
  height: 34px;
  border: 1px solid rgba(15,23,42,.06);
  background: #f8fafc;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.block.tools button.selected,
.block.tools button.active {
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--accent);
}

/* Palette */
.palette-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

.palette-block {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(15,23,42,.08);
  overflow: hidden;
}

.palette-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  font-weight: 900;
  font-size: 12px;
  color: var(--text);
  border-bottom: 1px solid var(--line);
  user-select: none;
}

.block.palette {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 6px;
}

.block.palette button {
  aspect-ratio: 1;
  border-radius: 6px;
  border: 2px solid rgba(15,23,42,.08);
  cursor: pointer;
  padding: 0;
  min-width: 0;
}

.block.palette button.selected,
.color-swatch.active {
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--accent);
}

/* Brush slider — оставлен для совместимости, но скрыт */
.brush-slider {
  display: none;
}

.palette-switch {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 6px 4px;
  font-weight: 800;
  font-size: 10px;
  color: var(--muted);
  cursor: default;
  box-shadow: 0 2px 8px rgba(15,23,42,.08);
  flex-shrink: 0;
  min-width: 40px;
}

/* Snapshot FAB */
.snapshot-fab {
  width: 100%;
  height: 44px;
  border: none;
  background: var(--panel);
  box-shadow: 0 2px 8px rgba(15,23,42,.08);
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.snapshot-fab .material-symbols-rounded {
  font-size: 24px;
  color: var(--text);
}

.snapshot-fab.selected {
  box-shadow: 0 0 0 2px var(--accent);
}

/* Gallery button */
.gallery-fab,
#btn-feed {
  width: 100%;
  height: 44px;
  border: none;
  background: var(--panel);
  box-shadow: 0 2px 8px rgba(15,23,42,.08);
  border-radius: 12px;
  padding: 0 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 900;
  font-size: 14px;
  color: var(--text);
}

.gallery-fab .fp-icon,
#btn-feed .material-symbols-rounded {
  font-size: 20px;
  transform: rotate(90deg);
  transition: transform .35s ease;
}

body.gallery-open .gallery-fab .fp-icon,
body.gallery-open #btn-feed .material-symbols-rounded {
  transform: rotate(0deg);
}

/* ==================== MINIMAP ==================== */

#minimap {
  position: fixed;
  right: 16px;
  bottom: 16px;
  width: 180px;
  height: 180px;
  border-radius: 22px;
  background: rgba(255,255,255,.96);
  box-shadow: 0 24px 70px rgba(15,23,42,.30), 0 10px 28px rgba(15,23,42,.22);
  z-index: 20;
  cursor: pointer;
  image-rendering: pixelated;
  border: 2px solid rgba(15,23,42,.12);
}

/* ==================== LOGO ==================== */

.logo-top,
#logo-top {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 25;
  pointer-events: none;
}

.logo-top img,
#logo-top img {
  width: 180px;
  max-width: 180px;
  height: auto;
  max-height: 60px;
  display: block;
  filter: drop-shadow(0 8px 20px rgba(15,23,42,.15));
}

/* ==================== GALLERY PANEL ==================== */

#feed-panel,
.gallery-panel {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 40;
  width: min(370px, 100vw);
  height: 100vh;
  background: rgba(255,255,255,.96);
  box-shadow: 20px 0 45px rgba(15,23,42,.12);
  transform: translateX(-112%);
  transition: transform .35s ease;
  display: flex;
  flex-direction: column;
}

#feed-panel.open,
.gallery-panel.open {
  transform: none;
}

.gallery-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 14px 8px;
}

.gallery-title {
  font-weight: 900;
  font-size: 18px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  border: 1px solid rgba(15,23,42,.06);
  background: #f8fafc;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  color: var(--muted);
}

.sort-row {
  display: flex;
  gap: 6px;
  padding: 0 14px 10px;
}

.sort-btn {
  border: none;
  background: #f1f5f9;
  border-radius: 10px;
  padding: 7px 10px;
  font-weight: 800;
  font-size: 12px;
  cursor: pointer;
  color: var(--muted);
}

.sort-btn.selected {
  background: rgba(56,189,248,.16);
  color: #0369a1;
}

.feed-search {
  padding: 0 14px 10px;
}

#feed-search {
  width: 100%;
  border: 1px solid rgba(15,23,42,.1);
  background: #f8fafc;
  border-radius: 12px;
  padding: 9px 12px;
  font: inherit;
  font-weight: 700;
  outline: none;
}

.feed {
  flex: 1;
  overflow-y: auto;
  padding: 0 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ==================== FEED POST ==================== */

.feed-post,
.art-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid rgba(15,23,42,.06);
  border-radius: 20px;
  padding: 14px;
  box-shadow: 0 10px 24px rgba(15,23,42,.06);
  width: 100%;
}

.feed-post.flash,
.art-card.flash {
  box-shadow: 0 0 0 3px var(--accent);
}

.feed-post-author,
.art-top {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.art-card {
  max-width: 340px;
}

.feed-post-avatar,
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 900;
  font-size: 15px;
  flex: none;
  background-size: cover;
  background-position: center;
}

.feed-post-username,
.art-author {
  font-weight: 800;
  font-size: 14px;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.art-author {
  cursor: pointer;
}

.art-time {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  flex-shrink: 0;
}

.avatar {
  cursor: pointer;
}

.feed-post-image,
.art-thumb {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 6px;
  image-rendering: pixelated;
  border: 1px solid rgba(15,23,42,.08);
  background: #f8fafc;
  object-fit: contain;
}

.feed-post-caption,
.art-desc {
  font-size: 14px;
  font-weight: 700;
  margin-top: 10px;
  line-height: 1.4;
  white-space: pre-wrap;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.feed-post-actions,
.art-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

/* Bottom row: like + time */
.art-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
}

.feed-like-btn,
.like-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  border: none;
  background: transparent;
  cursor: default;
  padding: 8px 12px;
  border-radius: 999px;
  color: #9ca3af;
  font-weight: 800;
  font-size: 13px;
  transition: background .15s ease, color .15s ease;
}

.like-btn .material-symbols-rounded {
  cursor: pointer;
  padding: 4px;
  margin: -4px;
}

.like-btn.has-count {
  background: rgba(15,23,42,.05);
  color: var(--muted);
}

.like-btn.liked {
  background: rgba(244,114,182,.12);
  color: #ef4444;
}

.feed-like-btn .material-symbols-rounded,
.like-btn .material-symbols-rounded {
  font-size: 20px;
}

.feed-like-count,
.like-lbl {
  font-size: 13px;
  font-weight: 800;
  color: var(--muted);
}

.feed-like-btn:disabled,
.like-btn:disabled {
  opacity: .5;
  cursor: default;
}

.mini-btn {
  border: none;
  background: #f1f5f9;
  border-radius: 10px;
  padding: 6px 8px;
  font-weight: 800;
  font-size: 11px;
  cursor: pointer;
  color: var(--text);
}

.mini-btn.pin.on {
  background: rgba(250,204,21,.25);
  color: #92400e;
}

.empty {
  color: var(--muted);
  font-weight: 700;
  padding: 12px;
  border-radius: 16px;
  border: 1px dashed rgba(15,23,42,.12);
}

/* ==================== SNAPSHOT MODAL ==================== */

#snapshot-modal,
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15,23,42,.35);
}

#snapshot-modal.visible,
.modal-overlay.visible {
  display: flex;
}

.modal-card {
  width: min(520px, 100%);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  background: #fff;
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 20px;
  display: grid;
  gap: 14px;
}

/* Snapshot modal specific */
.shot-modal-card {
  width: min(520px, 100%);
  max-height: calc(100vh - 40px);
  overflow: hidden;
  background: #fff;
  border-radius: 24px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.shot-modal-header {
  display: flex;
  justify-content: flex-end;
  padding: 0;
}

.shot-modal-close {
  border: none;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
  color: var(--muted);
  padding: 0;
}

.shot-modal-close:hover {
  color: var(--text);
}

#shot-comment {
  width: 100%;
  border: 1px solid rgba(15,23,42,.1);
  background: #f8fafc;
  border-radius: 14px;
  padding: 10px;
  font: inherit;
  font-weight: 600;
  resize: none;
  min-height: 44px;
  max-height: 4.2em;
  outline: none;
  font-size: 13px;
  line-height: 1.4;
  overflow-y: auto;
  display: block;
  word-break: break-word;
}

/* ==================== PHOTO MODAL ==================== */

.photo-modal-card {
  width: min(520px, 100%);
  max-height: calc(100vh - 40px);
  overflow: hidden;
  background: #fff;
  border-radius: 24px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.photo-modal-image-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #f8fafc;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.photo-modal-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  display: block;
}

.photo-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border: none;
  background: rgba(255,255,255,.92);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  box-shadow: 0 2px 8px rgba(15,23,42,.15);
  transition: color .15s ease, background .15s ease;
}

.photo-modal-close:hover {
  color: var(--text);
  background: #fff;
}

.photo-modal-footer {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-shrink: 0;
}

.photo-modal-author {
  display: flex;
  align-items: center;
  gap: 8px;
}

.photo-modal-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 900;
  font-size: 13px;
  flex: none;
  background: var(--accent);
}

.photo-modal-author-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.photo-modal-name {
  font-weight: 800;
  font-size: 13px;
  color: var(--text);
}

.photo-modal-time {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}

.photo-modal-download {
  width: 100%;
  border: none;
  background: #f1f5f9;
  border-radius: 14px;
  padding: 11px 14px;
  font-weight: 900;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--text);
  transition: background .15s ease;
}

.photo-modal-download:hover {
  background: #e2e8f0;
}

#snapshot-preview,
#shot-preview {
  width: 100%;
  height: auto;
  border-radius: 14px;
  border: 1px solid rgba(15,23,42,.08);
  background: #fff;
}

#snapshot-caption,
#shot-comment {
  width: 100%;
  border: 1px solid rgba(15,23,42,.1);
  background: #f8fafc;
  border-radius: 14px;
  padding: 10px;
  font: inherit;
  font-weight: 600;
  resize: none;
  min-height: 44px;
  outline: none;
  font-size: 13px;
}

.shot-link-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

#snapshot-link,
#shot-link {
  flex: 1;
  border: 1px solid rgba(15,23,42,.1);
  background: #f8fafc;
  border-radius: 12px;
  padding: 9px 10px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  outline: none;
  min-width: 0;
}

.shot-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.switch {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 800;
  color: var(--muted);
}

.switch input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.shot-actions {
  display: flex;
  gap: 8px;
}

.shot-actions button {
  flex: 1;
  border: none;
  border-radius: 14px;
  padding: 11px 6px;
  font-weight: 900;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

#snapshot-publish,
#shot-publish {
  background: rgba(34,197,94,.16);
  color: #166534;
}

#snapshot-save,
#shot-save {
  background: rgba(56,189,248,.16);
  color: #0369a1;
}

#snapshot-share,
#shot-share {
  background: rgba(167,139,250,.16);
  color: #6d28d9;
}

#snapshot-meta,
#shot-status {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  min-height: 14px;
}

/* ==================== AUTH OVERLAY ==================== */

#auth-overlay,
.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(255,255,255,.72);
}

.auth-card {
  width: min(340px, 100%);
  background: rgba(255,255,255,.96);
  border-radius: 28px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.auth-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 14px;
}

.auth-logo img {
  width: 160px;
}

.auth-form {
  display: grid;
  gap: 10px;
}

.auth-form input {
  width: 100%;
  border: 1px solid rgba(15,23,42,.1);
  background: #f8fafc;
  border-radius: 16px;
  padding: 12px;
  outline: none;
  font: inherit;
  font-weight: 700;
}

.auth-form button {
  border: none;
  border-radius: 16px;
  padding: 12px;
  background: var(--accent);
  color: #fff;
  font-weight: 900;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-error {
  color: #be123c;
  font-size: 12px;
  font-weight: 800;
  min-height: 14px;
}

/* ==================== ADMIN PANEL ==================== */

#admin-panel {
  position: fixed;
  bottom: 16px;
  right: 206px;
  z-index: 25;
  pointer-events: auto;
  display: none;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

#admin-panel.visible {
  display: flex;
}

#admin-menu {
  display: none;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid rgba(15,23,42,.06);
  background: #fff;
  box-shadow: var(--shadow);
  align-items: flex-end;
}

#admin-menu button {
  border: none;
  background: #f8fafc;
  border-radius: 10px;
  padding: 8px 10px;
  font-weight: 700;
  cursor: pointer;
  text-align: right;
  font-size: 12px;
}

#admin-toggle {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  border: 1px solid rgba(15,23,42,.06);
  background: #f8fafc;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

#admin-menu {
  display: none;
  flex-direction: column;
  gap: 6px;
  min-width: 180px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid rgba(15,23,42,.06);
  background: #fff;
  box-shadow: var(--shadow);
}

#admin-menu button {
  border: none;
  background: #f8fafc;
  border-radius: 10px;
  padding: 8px 10px;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
  font-size: 12px;
}

/* ==================== TOAST ==================== */

#toast {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%) translateY(-90px);
  z-index: 120;
  background: #fff;
  border-radius: 999px;
  box-shadow: var(--shadow);
  padding: 12px 20px;
  font-weight: 800;
  font-size: 14px;
  transition: transform .35s ease;
  pointer-events: none;
}

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

/* ==================== UTILITIES ==================== */

.hidden {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ==================== NO TEXT SELECTION ==================== */

.left-stack,
.gallery-panel,
.block,
.resource,
.user-fab,
.gallery-fab,
.snapshot-fab,
.tool-btn,
.palette-btn,
.art-card,
.art-thumb,
.icon-btn,
.sort-btn,
.like-btn,
#minimap,
#brush-cursor,
#selection,
#toast,
.auth-card,
.auth-form input,
.auth-form button,
#admin-menu button,
#feed-search,
.art-author {
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

/* ==================== SCREENS ==================== */

.screen {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column; /* Изменено: логотип будет строго НАД картой, а не перекрывать её */
  align-items: center;
  justify-content: flex-start;
  overflow: hidden;
}

/* Фон меню — единый цвет глубокой воды (как на игровом Canvas) */
#menu-screen {
  background: #0a284b;
  padding-top: 40px; /* Отступ для логотипа сверху */
}

/* ==================== MENU ==================== */

.menu-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 40px;
  width: 100%;
  height: 100%;
  z-index: 5;
}

.menu-logo {
  flex: none;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10;
}

.menu-logo img {
  width: 320px;
  max-width: 80vw;
  height: auto;
  display: block;
  filter: drop-shadow(0 8px 24px rgba(15,23,42,.30));
}

/* Карта архипелага с горизонтальной прокруткой */
#menu-islands-list {
  position: relative;
  flex: 1; /* Занимает всё оставшееся пространство экрана */
  width: 100vw;
  height: 100%;
  overflow-x: auto; /* Включаем горизонтальный скролл */
  overflow-y: hidden; /* Запрещаем вертикальный скролл */
  background-color: #0a284b;
  padding: 20px;

  /* Плавный инерционный скролл на смартфонах */
  -webkit-overflow-scrolling: touch;
}

/* Контейнер превью острова */
.menu-island-wrapper {
  position: absolute;
  cursor: pointer;

  /* Базовый масштаб острова в меню */
  transform: scale(3.5);
  transform-origin: center center;
  transition: transform 0.2s ease-in-out;

  /* Включаем фиксацию мыши для всего контейнера */
  pointer-events: auto;
}

/* Увеличение при наведении на контейнер */
.menu-island-wrapper:hover {
  transform: scale(3.9);
  z-index: 100;
}

/* Нижний слой: вода */
.island-static-water {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  pointer-events: none; /* Пропускает клик сквозь себя на родителя */
  z-index: 1;
}

/* Верхний слой: суша */
.island-dynamic-land {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  pointer-events: none; /* Пропускает клик сквозь себя на родителя */
  z-index: 2;
  transition: filter 0.2s ease-in-out;
}

/* Свечение суши при наведении */
.menu-island-wrapper:hover .island-dynamic-land {
  filter: brightness(1.15);
}



/* ==================== GLOBAL HUD ==================== */

#global-hud {
  position: fixed;
  bottom: 16px;
  left: 16px;
  z-index: 35;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
}

#global-hud .profile-top {
  flex-direction: row;
  gap: 8px;
  padding-top: 0;
}

#global-hud .user-fab {
  width: 40px;
  height: 40px;
  font-size: 16px;
}

#global-hud .user-name {
  font-size: 13px;
  max-width: 100px;
}

#global-hud .res-row {
  gap: 4px;
}

/* В игре HUD не должен перекрывать left-stack — он ниже */

/* Скрыть дубли profile-top/res-row внутри game-screen */
#game-screen #profile-top-game,
#game-screen .res-row {
  display: none !important;
}

/* ==================== BACK TO MENU ==================== */

.back-to-menu-btn {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 35;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  transition: background .15s ease;
  pointer-events: auto;
}

.back-to-menu-btn:hover {
  background: #e2e8f0;
}

/* ==================== RESPONSIVE ==================== */

@media (max-width: 700px) {
  .left-stack,
  #left-panel {
    width: 120px;
  }
  #logo-top img {
    width: 120px;
  }
  #minimap {
    width: 130px;
    height: 130px;
  }
}

/* ==================== CONTEXT MENU ==================== */

.context-menu {
  position: fixed;
  z-index: 200;
  background: #fff;
  border: 1px solid rgba(15,23,42,.1);
  border-radius: 14px;
  box-shadow: 0 10px 40px rgba(15,23,42,.2);
  padding: 6px;
  min-width: 180px;
  display: none;
}

.context-menu.visible {
  display: block;
}

.context-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: none;
  background: transparent;
  border-radius: 10px;
  width: 100%;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  font-size: 13px;
  color: var(--text);
  transition: background .15s ease;
}

.context-menu-item:hover {
  background: #f1f5f9;
}

.context-menu-item.danger {
  color: #ef4444;
}

.context-menu-item.danger:hover {
  background: rgba(239,68,68,.08);
}

.context-menu-item .material-symbols-rounded {
  font-size: 18px;
  color: var(--muted);
}

.context-menu-item.danger .material-symbols-rounded {
  color: #ef4444;
}

.context-menu-divider {
  height: 1px;
  background: rgba(15,23,42,.08);
  margin: 6px 10px;
}

/* ==================== MODAL OVERLAY ==================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(15,23,42,.4);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.visible {
  display: flex;
}

.modal-card {
  background: #fff;
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 24px;
  max-width: 400px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-title {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 16px;
  color: var(--text);
}

.modal-input {
  width: 100%;
  border: 1px solid rgba(15,23,42,.1);
  background: #f8fafc;
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  outline: none;
  margin-bottom: 12px;
}

.modal-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(56,189,248,.15);
}

.modal-row {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}

.modal-row .modal-input {
  flex: 1;
  margin-bottom: 0;
}

.modal-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 4px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.modal-btn {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: 12px;
  font: inherit;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: background .15s ease;
}

.modal-btn.primary {
  background: var(--accent);
  color: #fff;
}

.modal-btn.primary:hover {
  background: #0ea5e9;
}

.modal-btn.secondary {
  background: #f1f5f9;
  color: var(--text);
}

.modal-btn.secondary:hover {
  background: #e2e8f0;
}

.modal-btn.danger {
  background: #ef4444;
  color: #fff;
}

.modal-btn.danger:hover {
  background: #dc2626;
}
