:root {
  --paper: #ece0c4;
  --panel: #f4ead2;
  --ocean: #a9c1c3;
  --wave: #4c727c;
  --sea-ink: #34586a;
  --land-empty: #ddd1b3;
  --ink: #3f2c1e;
  --ink-soft: #7a5f45;
  --accent: #962c1c;
  --gold: #a8843c;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  color: var(--ink);
  font-family: 'Cormorant Garamond', Georgia, serif;
  background: var(--paper);
}

/* Kâğıt dokusu, lekeler ve kenarlarda yaşlanma gölgesi */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  background:
    radial-gradient(ellipse at center, transparent 50%, rgba(86, 54, 22, 0.32) 100%),
    radial-gradient(circle at 78% 22%, rgba(140, 96, 40, 0.07), transparent 18%),
    radial-gradient(circle at 18% 74%, rgba(140, 96, 40, 0.06), transparent 22%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.3 0 0 0 0 0.2 0 0 0 0 0.1 0 0 0 0.13 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  /* Karışım modu (mix-blend-mode) kullanma: haritanın her karesinde tüm ekranı yeniden karıştırıp kasmaya yol açıyor. */
  will-change: transform;
}

#map { position: fixed; inset: 0; width: 100%; height: 100%; cursor: grab; }
#map:active { cursor: grabbing; }

/* ---------- Deniz ---------- */
/* Deniz SVG'nin arkasındaki ayrı bir katman: dalgalar GPU'da kayar, haritayı yeniden çizdirmez. */
#sea { position: fixed; inset: 0; overflow: hidden; background: var(--ocean); }
.sea-pan { position: absolute; inset: -14px -36px; will-change: transform; }
.sea-waves {
  position: absolute;
  inset: 0 -36px 0 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='36' height='14'%3E%3Cpath d='M0 7 q4.5 -4 9 0 t9 0 t9 0 t9 0' fill='none' stroke='%234c727c' stroke-opacity='0.3' stroke-width='0.8' stroke-linecap='round'/%3E%3C/svg%3E");
  animation: drift 7s linear infinite;
  will-change: transform;
}
@keyframes drift { to { transform: translateX(-36px); } }
.coast { fill: none; stroke: var(--wave); stroke-linejoin: round; vector-effect: non-scaling-stroke; pointer-events: none; }
.graticule { fill: none; stroke: var(--wave); stroke-width: 0.5; stroke-opacity: 0.4; stroke-dasharray: 2 4; vector-effect: non-scaling-stroke; }
.lat-line { fill: none; stroke: var(--accent); stroke-width: 0.8; stroke-opacity: 0.45; stroke-dasharray: 6 3 1 3; vector-effect: non-scaling-stroke; }
.lat-line.equator { stroke-width: 1.1; stroke-opacity: 0.6; }
.lat-label {
  font-family: 'IM Fell English', Georgia, serif;
  font-style: italic;
  fill: var(--accent);
  fill-opacity: 0.75;
  letter-spacing: 0.12em;
  pointer-events: none;
}
.rhumb { stroke: var(--ink); stroke-width: 0.5; stroke-opacity: 0.13; vector-effect: non-scaling-stroke; pointer-events: none; }
.rhumb.main { stroke-opacity: 0.22; }
.hub-dark { fill: var(--ink); fill-opacity: 0.55; }
.hub-light { fill: var(--panel); stroke: var(--ink); stroke-width: 0.4; stroke-opacity: 0.5; }
.sea-label {
  font-family: 'IM Fell English', Georgia, serif;
  font-style: italic;
  fill: var(--sea-ink);
  fill-opacity: 0.72;
  letter-spacing: 0.32em;
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
}

/* ---------- Ülkeler ---------- */
.country-shape {
  stroke: var(--ink);
  stroke-width: 0.5;
  stroke-opacity: 0.7;
  vector-effect: non-scaling-stroke;
  transition: fill 0.4s, fill-opacity 0.3s;
}
.country-shape.has-songs { cursor: pointer; }
.country-shape.has-songs:hover { stroke: var(--accent); stroke-width: 1.6; stroke-opacity: 1; fill-opacity: 0.85; }
.country-shape.dim { fill: var(--land-empty); fill-opacity: 0.7; cursor: pointer; }
.country-shape.no-songs { fill: var(--land-empty); }
.country-shape.selected,
.country-shape.selected:hover { fill: var(--accent); fill-opacity: 0.88; stroke: var(--ink); stroke-width: 0.8; }

/* Kaydırma/yakınlaştırma sırasında en pahalı çizgileri gizle; hareket bitince geri gelir. */
#map.moving .coast:not(:last-child), #map.moving .borders, #map.moving .rhumbs { display: none; }

/* Elle boyanmış haritalardaki gibi sınır boyunca koyulaşan boya bandı */
.borders {
  fill: none;
  stroke: var(--ink);
  stroke-width: 5;
  stroke-opacity: 0.07;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

.label {
  font-family: 'IM Fell English SC', 'Cormorant Garamond', Georgia, serif;
  fill: var(--ink);
  text-anchor: middle;
  dominant-baseline: central;
  letter-spacing: 0.07em;
  pointer-events: none;
  paint-order: stroke;
  stroke: #f3e7c9;
  stroke-linejoin: round;
  stroke-opacity: 0.75;
}
.label.empty { fill: var(--ink-soft); opacity: 0.65; }
.label.selected { fill: #fbf3e0; stroke: var(--accent); stroke-opacity: 1; }

/* ---------- Rota ve sinyal ---------- */
.route-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.6;
  stroke-dasharray: 5 4;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}
.route-ship { fill: var(--accent); stroke: #fbf3e0; stroke-width: 1.2; vector-effect: non-scaling-stroke; }

/* Radyo sinyali: HTML katmanı, yalnızca transform/opacity canlandırılıyor (GPU) */
#beacon { position: fixed; left: 0; top: 0; width: 0; height: 0; pointer-events: none; will-change: transform; }
#beacon[hidden] { display: none; }
#beacon .ring {
  position: absolute;
  left: -34px; top: -34px;
  width: 68px; height: 68px;
  border: 1.5px solid var(--accent);
  border-radius: 50%;
  opacity: 0;
  transform: scale(0.12);
}
#beacon.playing .ring { animation: radio 2.4s cubic-bezier(0.2, 0.6, 0.35, 1) infinite; }
#beacon.playing .ring:nth-child(2) { animation-delay: 0.8s; }
#beacon.playing .ring:nth-child(3) { animation-delay: 1.6s; }
@keyframes radio {
  0% { transform: scale(0.12); opacity: 0.9; }
  100% { transform: scale(1.6); opacity: 0; }
}
#beacon .dot {
  position: absolute;
  left: -5px; top: -5px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px #fbf3e0;
}
#beacon.playing .dot { animation: pulse-dot 1.2s ease-in-out infinite; }
@keyframes pulse-dot { 50% { transform: scale(1.35); } }

/* ---------- Çerçeve (derece cetvelli kenar) ---------- */
.frame { position: fixed; inset: 0; pointer-events: none; z-index: 6; }
.band { position: absolute; display: block; }
.band.top, .band.bottom {
  left: 10px; right: 10px; height: 7px;
  background: repeating-linear-gradient(90deg, var(--ink) 0 28px, var(--panel) 28px 56px);
}
.band.left, .band.right {
  top: 10px; bottom: 10px; width: 7px;
  background: repeating-linear-gradient(0deg, var(--ink) 0 28px, var(--panel) 28px 56px);
}
.band.top { top: 10px; } .band.bottom { bottom: 10px; }
.band.left { left: 10px; } .band.right { right: 10px; }
.band { outline: 1px solid var(--ink); opacity: 0.85; }
.frame::before {
  content: '';
  position: absolute;
  inset: 4px;
  border: 1.5px solid var(--ink);
}
.frame::after {
  content: '';
  position: absolute;
  inset: 21px;
  border: 1px solid var(--ink);
  opacity: 0.7;
}

/* ---------- Pusula gülü ---------- */
#compass {
  position: fixed;
  left: 44px;
  bottom: 44px;
  width: 150px;
  height: 150px;
  z-index: 4;
  pointer-events: none;
  overflow: visible;
}
.dial { animation: spin 240s linear infinite; transform-origin: 0 0; }
@keyframes spin { to { transform: rotate(360deg); } }
.c-ring { fill: rgba(244, 234, 210, 0.75); stroke: var(--ink); stroke-width: 1.4; }
.c-ring.thin { fill: none; stroke-width: 0.7; }
.c-tick { stroke: var(--ink); stroke-width: 0.8; }
.s-dark { fill: var(--ink); }
.s-light { fill: var(--panel); stroke: var(--ink); stroke-width: 0.8; }
.star path:nth-last-child(-n+8) { stroke-width: 1; }
.c-letter {
  font-family: 'IM Fell English SC', Georgia, serif;
  font-size: 17px;
  fill: var(--ink);
  text-anchor: middle;
  dominant-baseline: central;
}
.needle { transition: transform 1.4s cubic-bezier(0.34, 1.56, 0.64, 1); }
.needle.idle { animation: sway 6s ease-in-out infinite; }
@keyframes sway { 0%, 100% { transform: rotate(-7deg); } 50% { transform: rotate(7deg); } }
.n-red { fill: var(--accent); stroke: #fbf3e0; stroke-width: 0.8; }
.n-ink { fill: var(--ink); stroke: #fbf3e0; stroke-width: 0.8; opacity: 0.85; }
.c-hub { fill: var(--gold); stroke: var(--ink); stroke-width: 1.2; }

/* ---------- Kartuş ---------- */
.brand {
  position: fixed;
  top: 36px;
  left: 40px;
  z-index: 7;
  padding: 8px 26px 12px;
  pointer-events: none;
  background: var(--panel);
  border: 1px solid var(--ink);
  outline: 1px solid var(--ink);
  outline-offset: 4px;
  text-align: center;
  box-shadow: 0 6px 18px rgba(60, 38, 18, 0.22);
}
.kicker {
  font-family: 'IM Fell English', Georgia, serif;
  font-style: italic;
  font-size: 15px;
  letter-spacing: 0.2em;
  color: var(--ink-soft);
  line-height: 1;
}
.kicker span { color: var(--gold); font-style: normal; font-size: 12px; }
.brand h1 {
  margin: 2px 0 0;
  font-family: 'IM Fell English SC', Georgia, serif;
  font-weight: 400;
  font-size: 30px;
  letter-spacing: 0.08em;
  color: var(--accent);
  line-height: 1.1;
}
.rule { position: relative; height: 12px; margin: 2px 0; }
.rule::before {
  content: '';
  position: absolute;
  left: 0; right: 0; top: 50%;
  border-top: 1px solid var(--ink-soft);
}
.rule span {
  position: relative;
  padding: 0 8px;
  font-size: 10px;
  color: var(--gold);
  background: var(--panel);
}
.brand p { margin: 0; font-size: 16px; font-style: italic; color: var(--ink-soft); letter-spacing: 0.04em; }

/* ---------- Araçlar ---------- */
#tooltip {
  position: fixed;
  z-index: 10;
  pointer-events: none;
  padding: 3px 12px;
  background: var(--panel);
  border: 1px solid var(--ink);
  color: var(--ink);
  font-size: 16px;
  font-style: italic;
  transform: translate(14px, -32px);
  white-space: nowrap;
  box-shadow: 0 3px 8px rgba(60, 38, 18, 0.2);
  animation: tip-in 0.18s ease-out;
}
@keyframes tip-in { from { opacity: 0; transform: translate(14px, -26px); } }

#toast {
  position: fixed;
  z-index: 10;
  left: 50%;
  bottom: 190px;
  padding: 6px 16px;
  background: var(--ink);
  color: var(--panel);
  font-size: 16px;
  font-style: italic;
  opacity: 0;
  transform: translate(-50%, 8px);
  pointer-events: none;
}
#toast.show { animation: toast 2.4s ease both; }
@keyframes toast {
  0% { opacity: 0; transform: translate(-50%, 8px); }
  12%, 80% { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; transform: translate(-50%, -6px); }
}

.map-tools {
  position: fixed;
  top: 36px;
  right: 40px;
  z-index: 7;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

button {
  font: inherit;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--ink);
  border-radius: 2px;
  width: 40px;
  height: 40px;
  font-size: 20px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, transform 0.15s;
}
button:hover:not(:disabled) { background: var(--ink); color: var(--panel); }
button:active:not(:disabled) { transform: scale(0.94); }
button:disabled { opacity: 0.35; cursor: default; }
.map-tools .lang { font-size: 13px; letter-spacing: 0.08em; margin-top: 6px; }

/* ---------- Oynatıcı ---------- */
#player {
  position: fixed;
  z-index: 7;
  left: 50%;
  bottom: 36px;
  transform: translateX(-50%);
  width: min(780px, calc(100% - 32px));
  padding: 10px 12px;
  background: var(--panel);
  border: 1px solid var(--ink);
  outline: 1px solid var(--ink);
  outline-offset: 4px;
  box-shadow: 0 10px 28px rgba(40, 32, 22, 0.32);
}

.now { display: flex; align-items: center; gap: 16px; }
#player:not(.idle) #categories { margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px dashed var(--ink-soft); }

#categories { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chip {
  width: auto;
  height: auto;
  padding: 3px 12px 4px;
  border-radius: 999px;
  font-size: 15px;
  font-style: italic;
  border-color: var(--ink-soft);
}
.chip.active { background: var(--accent); border-color: var(--accent); color: #fbf3e0; font-style: normal; }
.chip.active:hover:not(:disabled) { background: var(--accent); color: #fbf3e0; }

.video {
  flex: none;
  width: 160px;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--ink);
  border: 1px solid var(--ink);
  filter: sepia(0.3);
}
.video iframe, .video #yt { width: 100%; height: 100%; display: block; }
#player.idle .video { display: none; }

.meta { flex: 1; min-width: 0; }
.meta > div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meta.swap > div { animation: swap-in 0.6s ease both; }
.meta.swap > div:nth-child(2) { animation-delay: 0.06s; }
.meta.swap > div:nth-child(3) { animation-delay: 0.12s; }
@keyframes swap-in { from { opacity: 0; transform: translateY(6px); } }
.country { font-family: 'IM Fell English SC', Georgia, serif; font-size: 15px; letter-spacing: 0.1em; color: var(--accent); }
.title { font-size: 19px; font-weight: 600; line-height: 1.2; }
.channel { font-size: 15px; font-style: italic; color: var(--ink-soft); }

.eq { display: none; gap: 2px; align-items: flex-end; height: 11px; margin-right: 7px; vertical-align: -1px; }
#player.playing .eq { display: inline-flex; }
.eq i { width: 2.5px; height: 100%; background: var(--accent); transform-origin: bottom; animation: eq 0.9s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: -0.3s; animation-duration: 0.7s; }
.eq i:nth-child(3) { animation-delay: -0.6s; animation-duration: 1.1s; }
.eq i:nth-child(4) { animation-delay: -0.15s; animation-duration: 0.8s; }
@keyframes eq { 0%, 100% { transform: scaleY(0.25); } 50% { transform: scaleY(1); } }

.controls { display: flex; gap: 8px; flex: none; }
.controls button { width: 46px; height: 46px; border-radius: 50%; font-size: 16px; }

/* ---------- Açılış animasyonu ---------- */
body.intro .country-shape { animation: ink-in 1s ease-out both; animation-delay: var(--d, 0s); }
@keyframes ink-in { from { fill-opacity: 0; } }
body.intro .labels, body.intro .sea-labels { animation: fade-in 1.2s ease 2s both; }
body.intro .brand { animation: drop-in 1s cubic-bezier(0.2, 0.8, 0.2, 1) 0.4s both; }
body.intro .map-tools { animation: fade-in 1s ease 1.2s both; }
body.intro #player { animation: rise-in 1s cubic-bezier(0.2, 0.8, 0.2, 1) 1.4s both; }
body.intro #compass { animation: compass-in 1.6s cubic-bezier(0.2, 0.8, 0.2, 1) 1s both; }
body.intro .frame { animation: fade-in 1.2s ease both; }
body.intro #sea { animation: fade-in 1.8s ease 0.3s both; }
@keyframes fade-in { from { opacity: 0; } }
@keyframes drop-in { from { opacity: 0; transform: translateY(-16px); } }
@keyframes rise-in { from { opacity: 0; transform: translate(-50%, 24px); } }
@keyframes compass-in { from { opacity: 0; transform: rotate(-120deg) scale(0.6); } }

@media (max-width: 760px), (max-height: 620px) {
  #compass { display: none; }
}

@media (max-width: 560px) {
  .band { display: none; }
  .frame::after { inset: 8px; }
  .brand { top: 18px; left: 18px; padding: 4px 14px 6px; }
  .brand h1 { font-size: 22px; }
  .brand p, .rule, .kicker { display: none; }
  .map-tools { top: 18px; right: 18px; }
  #player { bottom: 16px; }
  .now { gap: 10px; }
  .chip { font-size: 13px; padding: 2px 9px 3px; }
  .video { width: 96px; }
  .title { font-size: 16px; }
  .controls { gap: 5px; }
  .controls button { width: 38px; height: 38px; font-size: 14px; }
  #toast { bottom: 200px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Amblem: küre-plak (yivler, enlem-boylam, kırmızı etiket, pikap kolu) ---------- */
.brand .emblem { display: block; width: 74px; height: 74px; margin: 2px auto 2px; overflow: visible; }
.e-ring { fill: var(--panel); stroke: var(--ink); stroke-width: 1.3; }
.e-ring.thin { fill: none; stroke-width: 0.6; }
.e-ticks line { stroke: var(--ink); stroke-width: 0.7; }
.e-disc { fill: var(--ink); }
.e-grooves circle { fill: none; stroke: #f4ead2; stroke-opacity: 0.16; stroke-width: 0.55; }
.e-globe ellipse, .e-globe line, .e-globe path { fill: none; stroke: var(--gold); stroke-width: 0.75; stroke-opacity: 0.9; }
.e-label { fill: var(--accent); stroke: var(--gold); stroke-width: 1.2; }
.e-label-ring { fill: none; stroke: #f4ead2; stroke-opacity: 0.45; stroke-width: 0.5; stroke-dasharray: 1.2 1.6; }
.e-star { fill: #f4ead2; }
.e-star-dk { fill: #e4d3ad; }
.e-hole { fill: var(--paper); stroke: var(--ink); stroke-width: 0.6; }
.e-pivot { fill: var(--gold); stroke: var(--ink); stroke-width: 1; }
.e-tonearm { fill: none; stroke: var(--ink); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.e-head { fill: var(--gold); stroke: var(--ink); stroke-width: 0.8; }
.brand .emblem .e-globe, .brand .emblem .e-grooves { transform-origin: 0 0; animation: spin 90s linear infinite; }
body:has(#player.playing) .brand .emblem .e-globe, body:has(#player.playing) .brand .emblem .e-grooves { animation-duration: 6s; }   /* şarkı çalarken plak döner */

/* faruktuna.com: kartuşun altında, tıklanabilir */
.site-link {
  pointer-events: auto;
  display: inline-block;
  margin-top: 4px;
  font-family: 'IM Fell English SC', Georgia, serif;
  font-size: 14px;
  letter-spacing: 0.14em;
  color: var(--ink-soft);
  text-decoration: none;
  border-top: 1px solid rgba(122, 95, 69, 0.35);
  padding-top: 3px;
}
.site-link:hover { color: var(--accent); }

/* Geri dönüş: harita araçlarının solunda, eski etiket gibi */
.back-link {
  position: fixed;
  top: 36px;
  right: 96px;
  z-index: 7;
  padding: 7px 14px 8px;
  background: var(--panel);
  border: 1px solid var(--ink);
  outline: 1px solid var(--ink);
  outline-offset: 3px;
  color: var(--ink);
  font-family: 'IM Fell English', Georgia, serif;
  font-style: italic;
  font-size: 16px;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(60, 38, 18, 0.18);
  transition: background 0.2s, color 0.2s;
}
.back-link:hover { background: var(--ink); color: var(--panel); }
.bl-short { display: none; }
body.intro .back-link { animation: fade-in 1s ease 1.2s both; }

@media (max-width: 900px) {
  .bl-long { display: none; }
  .bl-short { display: inline; }
}
@media (max-width: 560px) {
  .brand .emblem { display: inline-block; vertical-align: middle; width: 30px; height: 30px; margin: 0 6px 0 0; }
  .brand h1 { display: inline-block; vertical-align: middle; }
  .site-link { display: block; font-size: 11px; margin-top: 2px; padding-top: 2px; }
  .back-link { top: 98px; left: 18px; right: auto; padding: 4px 10px 5px; font-size: 13.5px; outline-offset: 2px; }
}
