*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background-color: #ffffff;
  color: #121212;
}

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px 32px;
}

.header {
  width: 100%;
  max-width: 420px;
  margin-bottom: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 48px;
  height: 48px;
  border-radius: 999px;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.15);
}

.brand-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand-text h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
}

.brand-text p {
  margin: 4px 0 0;
  font-size: 14px;
  color: #666666;
}

.main {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.home-actions {
  display: flex;
  width: 100%;
}

.bookmark-button {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border: none;
  border-radius: 12px;
  background-color: #121212;
  color: #ffffff;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
  cursor: pointer;
  transition:
    background-color 0.18s ease,
    transform 0.12s ease,
    box-shadow 0.18s ease;
}

.bookmark-button:hover {
  background-color: #2a2a2a;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}

.bookmark-button:active {
  box-shadow: none;
  transform: translateY(0);
}

.bookmark-button-icon {
  color: #ffd166;
  font-size: 15px;
  line-height: 1;
}

.links-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.links-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.group-title {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #888888;
}

.link-card {
  position: relative;
  display: block;
  padding: 14px 16px;
  border-radius: 12px;
  text-decoration: none;
  background-color: #f8f8f8;
  color: #121212;
  transition:
    background-color 0.18s ease,
    transform 0.12s ease,
    box-shadow 0.18s ease;
}

.link-inner {
  display: flex;
  align-items: center;
  gap: 12px;
}

.link-icon {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #ffffff;
  background-color: #c0c0c0;
  flex-shrink: 0;
}

.link-icon--site {
  background-color: #d51d35;
}

.link-icon--telegram {
  background-color: #229ed9;
}

.link-icon--whatsapp {
  background-color: #25d366;
}

.link-icon--vk {
  background-color: #2787f5;
}

.link-icon--instagram {
  background: radial-gradient(circle at 30% 30%, #fdf497 0, #fdf497 5%, #fd5949 45%, #d6249f 60%, #285aeb 90%);
}

.link-icon--youtube {
  background-color: #ff0000;
}

.link-icon--project {
  background-color: #444444;
}

.link-card--primary {
  background-color: #d51d35;
  color: #ffffff;
}

.link-card--primary .link-description {
  color: #ffe5ea;
}

.link-main {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.link-title {
  font-weight: 600;
  font-size: 15px;
}

.link-description {
  font-size: 13px;
  color: #666666;
}

.link-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
}

.link-card:hover:not(.link-card--primary) {
  background-color: #f0f0f0;
}

.footer {
  margin-top: auto;
  width: 100%;
  max-width: 420px;
  padding-top: 24px;
  font-size: 12px;
  color: #999999;
  text-align: center;
}

/* Admin page */

.admin-header {
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.admin-back {
  font-size: 14px;
  color: #666666;
  text-decoration: none;
  transition: color 0.15s ease;
}

.admin-back:hover {
  color: #d51d35;
}

.admin-page-title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
}

.admin-page-main {
  width: 100%;
  max-width: 420px;
  margin-top: 0;
}

.admin-page-main .admin-hint {
  margin-bottom: 20px;
}

/* Admin panel (block on admin page) */

.admin-panel,
.admin-page-main {
  width: 100%;
  max-width: 420px;
  padding: 16px 14px 18px;
  border-radius: 16px;
  background-color: #f8f8f8;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
}

.admin-panel {
  margin-top: 32px;
}

.admin-title {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 600;
}

.admin-hint {
  margin: 0 0 16px;
  font-size: 12px;
  color: #777777;
}

.admin-block {
  border-top: 1px solid #e0e0e0;
  padding-top: 12px;
  margin-top: 12px;
}

.admin-block:first-of-type {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}

.admin-block-title {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #888888;
}

.admin-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
  font-size: 12px;
}

.admin-field span {
  color: #555555;
}

.admin-field input {
  border-radius: 8px;
  border: 1px solid #dddddd;
  padding: 6px 8px;
  font-size: 13px;
  outline: none;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.admin-field input:focus {
  border-color: #d51d35;
  box-shadow: 0 0 0 1px rgba(213, 29, 53, 0.12);
}

.admin-link-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.admin-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  margin-top: 4px;
}

.admin-checkbox input {
  width: 14px;
  height: 14px;
}

.admin-button {
  margin-top: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: none;
  background-color: #e0e0e0;
  color: #333333;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition:
    background-color 0.15s ease,
    transform 0.1s ease,
    box-shadow 0.15s ease;
}

.admin-button:hover {
  background-color: #d5d5d5;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}

.admin-button:active {
  transform: translateY(0);
  box-shadow: none;
}

.admin-button--primary {
  background-color: #d51d35;
  color: #ffffff;
}

.admin-button--primary:hover {
  background-color: #c11930;
}

.admin-button--ghost {
  background-color: #ffffff;
  border: 1px solid #dddddd;
}

.admin-button--danger {
  background-color: #f44336;
  color: #ffffff;
}

.admin-button--danger:hover {
  background-color: #e53935;
}

.admin-button--small {
  padding: 4px 10px;
  font-size: 12px;
}

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

.admin-links-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  max-height: 200px;
  overflow-y: auto;
}

.admin-links-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background-color: #ffffff;
  font-size: 12px;
  cursor: grab;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    opacity 0.15s ease,
    transform 0.15s ease;
}

.admin-links-item:active {
  cursor: grabbing;
}

.admin-links-item--dragging {
  border-color: rgba(213, 29, 53, 0.45);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.08);
  opacity: 0.58;
  transform: scale(0.99);
}

.admin-drag-handle {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background-color: #f2f2f2;
  color: #888888;
  font-size: 14px;
  line-height: 1;
  flex-shrink: 0;
  user-select: none;
}

.admin-links-item + .admin-links-item {
  margin-top: 4px;
}

.admin-links-item-main {
  flex: 1;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: 6px;
  min-width: 0;
}

.admin-links-item-order {
  grid-row: 1 / span 2;
  color: #999999;
}

.admin-links-item-main strong {
  grid-column: 2;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-links-item-url {
  grid-column: 2;
  display: block;
  color: #666666;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-links-item-actions {
  flex-shrink: 0;
}

.admin-links-empty {
  font-size: 12px;
  color: #888888;
}

@media (min-width: 768px) {
  .page {
    padding-top: 40px;
  }

  .brand-text h1 {
    font-size: 26px;
  }

  .admin-link-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
