/* ── Font (self-hosted) ── */
@font-face {
  font-family: 'Cormorant Garamond';
  font-style: normal;
  font-weight: 300;
  font-display: block;
  src: url('fonts/cormorant-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Cormorant Garamond';
  font-style: normal;
  font-weight: 300;
  font-display: block;
  src: url('fonts/cormorant-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Cormorant Garamond';
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url('fonts/cormorant-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Cormorant Garamond';
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url('fonts/cormorant-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

html, body {
  margin: 0; padding: 0;
  background: #191919;
  font-family: 'Cormorant Garamond', serif;
  color: #e0e0e0;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
  width: 100%; height: 100dvh;
}
body { display: flex; flex-direction: column; }
body.landscape { flex-direction: row; }

#main-area {
  flex: 1; position: relative; overflow: hidden;
}
#main-canvas {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
}

/* ── Strip ── */
#strip {
  height: 150px;
  background: #191919;
  border-top: none;
  padding: 0 10px;
  display: flex; flex-direction: row; align-items: center; justify-content: flex-start;
  gap: 10px; overflow-x: auto; flex-shrink: 0;
  opacity: 0; transition: opacity 0.3s;
}
#strip::-webkit-scrollbar { height: 4px; }
#strip::-webkit-scrollbar-track { background: rgba(255,255,255,0.03); }
#strip::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 2px; }
#strip::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.4); }
#strip.ready { opacity: 1; }
body.landscape #strip {
  position: absolute; top: 0; bottom: 0; right: 0;
  height: auto; width: 190px;
  flex-direction: column; overflow-y: auto; overflow-x: hidden;
  border-top: none; border-left: 1px solid rgba(255,255,255,0.06);
  padding: 10px 0; gap: 12px; align-items: center; justify-content: flex-start;
}
body.landscape #strip::-webkit-scrollbar { height: auto; width: 4px; }
body.landscape #strip::-webkit-scrollbar-track { background: rgba(255,255,255,0.03); }
body.landscape #strip::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 2px; }
body.landscape #strip::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.4); }

/* ── Contour cards ── */
.contour-card {
  width: 105px; height: 120px;
  border: 1.5px solid rgba(255,255,255,0.3);
  border-radius: 10px;
  background: rgba(35,35,35,0.8);
  transition: all 0.3s;
  cursor: pointer; flex-shrink: 0; touch-action: manipulation;
}
body.landscape .contour-card { width: 160px; height: 133px; }
.contour-card { display: flex; align-items: center; justify-content: center; overflow: hidden; }
.contour-card canvas { width: 100%; height: 100%; border-radius: 9px; }
.contour-card.selected {
  border-color: rgba(255,255,255,0.7);
  box-shadow: 0 0 24px rgba(255,255,255,0.2);
  transform: translateY(-5px) scale(1.05);
}
body.landscape .contour-card.selected {
  transform: translateX(-5px) scale(1.05);
}
.contour-card.found {
  border-color: rgba(255,255,255,0.35);
  box-shadow: 0 0 12px rgba(255,255,255,0.1);
  pointer-events: none;
}

/* ── Loading screen ── */
#loading-screen {
  position: absolute; inset: 0; z-index: 350;
  display: flex; align-items: center; justify-content: center;
  background: #191919;
  transition: opacity 0.8s;
}
#loading-screen span {
  font-size: 52px; font-weight: 300; letter-spacing: 10px;
  color: rgba(220,220,220,0.6);
  animation: pulse-loading 2.5s ease-in-out infinite;
}
@keyframes pulse-loading {
  0%,100% { opacity: 0.4; } 50% { opacity: 1; }
}

/* ── Title screen ── */
#title-screen {
  position: absolute; inset: 0; z-index: 300;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: #191919;
  transition: opacity 2s;
}
#title-screen h1 { font-size: 86px; font-weight: 300; letter-spacing: 12px; margin: 0; }
#title-screen p { font-size: 22px; color: rgba(220,220,220,0.75); letter-spacing: 4px; margin: -9px 0 21px 0; }
#title-screen .sub { font-size: 16px; letter-spacing: 2px; animation: pulse-sub 3s ease-in-out infinite; }
#title-screen .sub a { color: inherit; text-decoration: none; }
#title-screen .sub a:hover { color: rgba(220,220,220,0.75); }
.title-sep { margin: 0 6px; opacity: 0.3; }
@keyframes pulse-sub { 0%,100% { color: rgba(180,180,180,0.35); } 50% { color: rgba(220,220,220,0.75); } }

/* ── Tutorial overlay (dimming) ── */
#tut-overlay {
  position: fixed; inset: 0; z-index: 190;
  background: rgba(0,0,0,0.3);
  opacity: 0; transition: opacity 0.5s; pointer-events: none;
}
#tut-overlay.visible { opacity: 1; }
#tut-overlay.strong { background: rgba(0,0,0,0.6); pointer-events: auto; }

/* ── Size hint (dots tutorial) ── */
#size-hint {
  position: fixed; z-index: 201;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  font-size: 18px; letter-spacing: 2px; color: rgba(220,220,220,0.9);
  opacity: 0; transition: opacity 0.6s; pointer-events: none;
}
#size-hint span {
  background: rgba(25,25,25,0.85); border: 1px solid rgba(255,255,255,0.2);
  border-radius: 10px; padding: 12px 22px; white-space: nowrap; line-height: 1;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
#size-hint.visible { opacity: 1; }

/* ── Hints tip (level 2 tutorial) ── */
#hints-tip {
  position: fixed; z-index: 201;
  display: flex; flex-direction: column; align-items: flex-end; gap: 8px;
  font-size: 18px; letter-spacing: 2px; color: rgba(220,220,220,0.9);
  opacity: 0; transition: opacity 0.6s; pointer-events: none;
}
#hints-tip svg { margin-right: 6px; }
#hints-tip span {
  background: rgba(25,25,25,0.85); border: 1px solid rgba(255,255,255,0.2);
  border-radius: 10px; padding: 12px 22px; white-space: nowrap; line-height: 1;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
#hints-tip.visible { opacity: 1; }

/* ── Settings ── */
#settings-btn {
  position: absolute; top: 12px; right: 14px; z-index: 210;
  color: rgba(200,200,200,0.25);
  cursor: pointer; line-height: 1;
  transition: color 0.2s;
}
#settings-btn:hover { color: rgba(200,200,200,0.50); }
#settings-btn.active { color: rgba(200,200,200,0.55); }
#settings-panel {
  position: absolute; top: 42px; right: 14px; z-index: 210;
  background: rgba(30,30,30,0.92);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  padding: 10px 14px;
  display: none;
  font-size: 14px; letter-spacing: 1px;
  color: rgba(200,200,200,0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
#settings-panel.open { display: block; }
#settings-panel label {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  white-space: nowrap; margin-bottom: 6px;
}
#settings-panel label:last-child { margin-bottom: 0; }
#settings-panel input[type="checkbox"] {
  accent-color: rgba(220,220,220,0.85);
  width: 16px; height: 16px;
}
.settings-sep {
  height: 1px;
  background: rgba(255,255,255,0.08);
  margin: 8px 0;
}
.settings-action {
  display: block; width: 100%;
  font-family: 'Cormorant Garamond', serif;
  font-size: 14px; letter-spacing: 1px;
  color: rgba(200,200,200,0.7);
  background: none; border: none;
  padding: 6px 0;
  cursor: pointer; text-align: left;
  transition: color 0.2s;
}
.settings-action:hover {
  color: rgba(220,220,220,0.95);
}

/* ── Level complete ── */
#level-complete {
  position: absolute; inset: 0; z-index: 250;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: rgba(20,20,20,0.75);
  transition: opacity 3s;
  letter-spacing: 6px;
  font-size: 46px; font-weight: 300;
  color: rgba(220,220,220,0.7);
  opacity: 0; pointer-events: none;
}
#level-complete.visible { opacity: 1; pointer-events: auto; }
#level-buttons { display: flex; gap: 16px; margin-top: 24px; }

.level-btn {
  font-family: 'Cormorant Garamond', serif;
  font-size: 16px; letter-spacing: 2px;
  color: rgba(220,220,220,0.7);
  background: rgba(35,35,35,0.6);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  padding: 12px 24px;
  cursor: pointer;
  transition: all 0.3s;
}
.level-btn:hover {
  background: rgba(50,50,50,0.8);
  border-color: rgba(255,255,255,0.3);
}

.all-levels-link {
  display: block;
  margin-top: 20px;
  font-size: 14px;
  letter-spacing: 2px;
  color: rgba(180,180,180,0.35);
  text-decoration: none;
  transition: color 0.3s;
}
.all-levels-link:hover { color: rgba(220,220,220,0.6); }

/* ── Level transition overlay ── */
#transition-overlay {
  position: absolute; inset: 0; z-index: 400;
  background: rgba(25,25,25,0.90);
  opacity: 0; pointer-events: none;
  transition: opacity 0.4s;
  display: flex; align-items: center; justify-content: center;
}
#transition-overlay.active { opacity: 1; pointer-events: auto; }
#transition-overlay span {
  font-family: 'Cormorant Garamond', serif;
  font-size: 28px; letter-spacing: 1px;
  color: rgba(220,220,220,0.75);
}
