﻿@import url("/css/notifications.css");

:root {
  --bg: #07090d;
  --bg-elevated: #0f131a;
  --bg-card: #141a24;
  --text: #eef2f7;
  --text-muted: #8b97a8;
  --green: #b8ff2e;
  --green-dim: #7ed321;
  --orange: #ff9f1a;
  --pink: #ff4d9d;
  --border: rgba(255, 255, 255, 0.08);
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  --radius: 20px;
  --radius-sm: 14px;
  --font: "Manrope", system-ui, sans-serif;
  --font-display: "Unbounded", "Manrope", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

.bg-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
}

.bg-glow--green {
  width: 520px;
  height: 520px;
  top: -120px;
  left: -80px;
  background: rgba(184, 255, 46, 0.12);
}

.bg-glow--orange {
  width: 480px;
  height: 480px;
  right: -100px;
  top: 30%;
  background: rgba(255, 159, 26, 0.1);
}

.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, black 20%, transparent 75%);
  pointer-events: none;
  z-index: 0;
}

.header,
.layout {
  position: relative;
  z-index: 1;
}

.header {
  display: flex;
  align-items: center;
  gap: 16px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 20px 0;
  flex-wrap: wrap;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

.logo__mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--green), var(--green-dim));
  color: #0a0f14;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.85rem;
}

.logo__text {
  display: flex;
  flex-direction: column;
}

.logo__title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1rem;
}

.logo__subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.header__stats {
  display: flex;
  gap: 12px;
  margin-left: auto;
}

.header__stat {
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.header__stat--points {
  display: flex;
  gap: 8px;
  align-items: center;
}

.header__stat-label {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 500;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border: none;
  border-radius: 999px;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s;
}

.btn--primary {
  background: linear-gradient(135deg, var(--green), var(--green-dim));
  color: #0a0f14;
  box-shadow: 0 8px 32px rgba(184, 255, 46, 0.25);
}

.btn--primary:hover {
  transform: translateY(-1px);
}

.btn--ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn--ghost:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

.btn,
.difficulty__btn,
.numpad__key,
.tool-btn {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.btn--block {
  width: 100%;
}

.layout {
  display: grid;
  grid-template-columns: minmax(200px, 240px) 1fr minmax(200px, 240px);
  gap: 24px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px 40px;
  align-items: start;
}

.panel__block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
}

.panel__title {
  margin: 0 0 12px;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.panel__hint {
  margin: 12px 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.panel__user {
  margin: 8px 0 0;
  font-size: 0.85rem;
  color: var(--green);
}

.difficulty {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.difficulty__btn {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.difficulty__btn:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

.difficulty__btn--active {
  border-color: var(--green);
  background: rgba(184, 255, 46, 0.08);
}

.difficulty__pts {
  font-size: 0.75rem;
  color: var(--orange);
  font-weight: 700;
}

.panel__gallery {
  position: relative;
  min-height: 140px;
  overflow: hidden;
}

.panel__thumb {
  position: absolute;
  border-radius: 12px;
  object-fit: cover;
  border: 2px solid var(--border);
  box-shadow: var(--shadow);
  opacity: 0.85;
}

.panel__thumb--1 {
  width: 72px;
  height: 72px;
  top: 8px;
  left: 8px;
  transform: rotate(-6deg);
}

.panel__thumb--2 {
  width: 88px;
  height: 88px;
  top: 24px;
  right: 12px;
  transform: rotate(4deg);
  z-index: 1;
}

.panel__thumb--3 {
  width: 64px;
  height: 64px;
  bottom: 8px;
  left: 40%;
  transform: rotate(8deg);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.modal[hidden] {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.modal__dialog {
  position: relative;
  width: min(400px, 100%);
  padding: 28px;
  border-radius: var(--radius);
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  text-align: center;
}

.modal__title {
  margin: 0 0 8px;
  font-family: var(--font-display);
}

.modal__text {
  margin: 0 0 20px;
  color: var(--text-muted);
}

.modal__actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

@media (max-width: 900px) {
  .header {
    padding: calc(16px + env(safe-area-inset-top, 0px)) 16px 0;
    gap: 10px;
  }

  .layout {
    grid-template-columns: 1fr;
    padding: 20px 16px calc(32px + env(safe-area-inset-bottom, 0px));
  }

  .panel--left {
    order: 1;
  }

  .board-wrap {
    order: 0;
  }

  .panel--right {
    order: 2;
  }

  .panel__gallery {
    display: none;
  }

  .header__stats {
    margin-left: 0;
    width: 100%;
    flex-wrap: wrap;
  }

  .modal {
    padding: 16px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  }

  .modal__dialog {
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
  }
}

@media (max-width: 560px) {
  .logo__subtitle {
    display: none;
  }

  .header .btn--ghost {
    padding: 10px 14px;
    font-size: 0.85rem;
  }

  .header__stat {
    padding: 6px 12px;
    font-size: 0.88rem;
  }

  .panel__block {
    padding: 14px;
  }

  .difficulty__btn {
    padding: 12px 14px;
    min-height: 44px;
  }
}

@media (max-width: 400px) {
  .header .btn--ghost:not(:last-child) {
    font-size: 0;
    padding-inline: 12px;
    min-width: 40px;
  }

  .header .btn--ghost:not(:last-child)::before {
    font-size: 0.85rem;
    content: "ℹ";
  }

  .header .btn--ghost:last-child {
    font-size: 0;
    padding-inline: 12px;
    min-width: 40px;
  }

  .header .btn--ghost:last-child::before {
    font-size: 1rem;
    font-weight: 700;
    content: "←";
  }
}
