/* Wave Simulator - the original dark look, without Angular Material. */

:root {
  --panel-width: 270px;
  --panel-bg: #222;
  --field-bg: rgb(76, 76, 76);
  --field-border: rgb(176, 176, 176);
  --divider: rgb(76, 76, 76);
  --muted: #aaa;
  --hint: #888;
  --menu-bg: #424242;
  --slide: 310ms ease-in-out;
}

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

html, body {
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  font-family: Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 14px;
  font-weight: 300;
  background: black;
  color: white;
}

[hidden] {
  display: none !important;
}

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.offscreen {
  position: fixed;
  left: -9999px;
  opacity: 0;
}

.icon {
  width: 24px;
  height: 24px;
  fill: currentColor;
  flex: none;
}

button {
  font: inherit;
  color: inherit;
}

:focus {
  outline: none;
}

:focus-visible {
  outline: 1px solid gray;
}

/* ------------------------------------------------------------ simulation */

#scene {
  position: fixed;
  top: 0;
  left: var(--panel-width);
  width: calc(100% - var(--panel-width));
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  transition: left var(--slide), width var(--slide);
}

body.toolbar-right #scene {
  left: 0;
}

body.fullscreen #scene {
  left: 0;
  width: 100%;
}

#scene canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: black;
  display: block;
  touch-action: none;
}

#scene canvas.grabbable {
  cursor: crosshair;
}

/* Overlays sit on top of the canvas but must never swallow its pointer events. */
.grid-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 900;
}

.grid-overlay line {
  stroke: rgba(255, 255, 255, 0.28);
  stroke-width: 1;
}

.grid-overlay.dark line {
  stroke: rgba(0, 0, 0, 0.4);
}

/* Phased-array elements: small rings, numbered in custom mode. */
.array-markers {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 950;
}

.array-marker {
  position: absolute;
  width: 14px;
  height: 14px;
  transform: translate(-50%, -50%);
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.55);
  font: 700 9px/10px Roboto, sans-serif;
  text-align: center;
  color: white;
  text-shadow: 0 0 2px black;
}

.array-marker:not(:empty) {
  width: 18px;
  height: 18px;
  line-height: 14px;
  background: rgba(0, 0, 0, 0.45);
}

.array-marker.dragging {
  border-color: #fff;
  transform: translate(-50%, -50%) scale(1.3);
}

.source-marker {
  position: absolute;
  width: 0;
  height: 0;
  pointer-events: none;
  z-index: 950;
}

.source-marker-ring,
.source-marker-dot {
  position: absolute;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.source-marker-ring {
  width: 22px;
  height: 22px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.55), inset 0 0 0 1px rgba(0, 0, 0, 0.55);
  transition: width 120ms ease-out, height 120ms ease-out;
}

.source-marker-dot {
  width: 5px;
  height: 5px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.55);
}

.source-marker.dragging .source-marker-ring {
  width: 30px;
  height: 30px;
  border-color: #fff;
}

.coord-readout {
  position: absolute;
  left: 54px;
  bottom: 8px;
  padding: 3px 7px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.55);
  color: rgba(255, 255, 255, 0.85);
  font-family: Lato, monospace;
  font-size: 11px;
  letter-spacing: 0.5px;
  white-space: pre;
  pointer-events: none;
  z-index: 1000;
}

.gradient-legend {
  position: absolute;
  right: 0;
  bottom: 0;
  width: min(10px, 5%);
  height: min(200px, 40%);
  pointer-events: none;
  z-index: 1000;
}

.error-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: 420px;
  padding: 20px 24px;
  background: #333;
  border: 1px solid #555;
  border-radius: 8px;
  line-height: 1.5;
  z-index: 3000;
}

/* --------------------------------------------------------------- toolbar */

#toolbar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--panel-width);
  padding-bottom: 30px;
  background: var(--panel-bg);
  /* Scrolls on its own rather than scrolling the page under the canvas. */
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 500;
  transition: transform var(--slide);
}

body.toolbar-right #toolbar {
  left: auto;
  right: 0;
}

body.fullscreen #toolbar {
  transform: translateX(-100%);
}

body.fullscreen.toolbar-right #toolbar {
  transform: translateX(100%);
}

.fullscreen-button {
  position: fixed;
  top: 10px;
  left: calc(var(--panel-width) + 10px);
  display: flex;
  padding: 2px;
  border: none;
  border-radius: 5px;
  background: rgba(147, 147, 147, 0.6);
  opacity: 0.8;
  cursor: pointer;
  z-index: 1000;
  transition: left var(--slide), right var(--slide);
}

.fullscreen-button .icon {
  width: 32px;
  height: 32px;
  filter: drop-shadow(0 0 3px black);
}

body.fullscreen .fullscreen-button {
  left: 10px;
}

body.toolbar-right .fullscreen-button {
  left: auto;
  right: calc(var(--panel-width) + 10px);
}

body.toolbar-right.fullscreen .fullscreen-button {
  right: 10px;
}

.top-container {
  position: sticky;
  top: 0;
  padding-top: 20px;
  background: var(--panel-bg);
  border-bottom: 1px solid var(--divider);
  z-index: 10;
}

/* MaLeTiLabs ana sayfasına dönüş */
.site-back {
  display: inline-block;
  margin: 0 0 12px 20px;
  font-size: 13px;
  color: rgb(160, 160, 160);
  text-decoration: none;
}
.site-back:hover { color: rgb(230, 230, 230); }

.title {
  padding: 0 0 18px 20px;
  font-size: 27px;
  font-weight: 700;
  line-height: 1.15;
  color: rgb(220, 220, 220);
}

/*
 * Gold "REMASTERED": a metallic gradient clipped to the letters, a light band
 * sweeping across it every few seconds, and a soft warm glow. The glow is a
 * copy of the text (data-text) behind it, because text-shadow on clipped text
 * would paint over the gradient.
 */
.remastered {
  position: relative;
  display: inline-block;
  margin-top: 3px;
  /* Sized and spaced to run the width of "Wave Simulator" above it; the
     negative margin cancels the spacing after the last letter. */
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.5em;
  margin-right: -0.5em;
  color: transparent;
  background:
    linear-gradient(110deg, transparent 35%, rgba(255, 255, 255, 0.95) 50%, transparent 65%) -200% 0 / 200% 100% no-repeat,
    linear-gradient(180deg, #fff3b0 0%, #f5d061 28%, #c9962b 55%, #8a5a12 78%, #e8c15a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  animation: gold-sweep 4.5s ease-in-out infinite;
}

.remastered::before {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  z-index: -1;
  color: transparent;
  text-shadow: 0 0 10px rgba(245, 190, 70, 0.45), 0 1px 0 rgba(90, 55, 5, 0.9);
}

@keyframes gold-sweep {
  0%, 55% { background-position: -200% 0, 0 0; }
  100% { background-position: 200% 0, 0 0; }
}

@media (prefers-reduced-motion: reduce) {
  .remastered {
    animation: none;
  }
}

.playback {
  display: flex;
  align-items: center;
  padding: 0 0 10px 10px;
  margin-top: -5px;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}

.icon-button:hover {
  background: rgba(255, 255, 255, 0.08);
}

.icon-button:active {
  background: rgba(255, 255, 255, 0.16);
}

.dock-button {
  margin-left: auto;
  margin-right: 14px;
  opacity: 0.75;
}

.dock-button:hover {
  opacity: 1;
}

.field-group {
  margin-bottom: 20px;
}

.first-group {
  padding-top: 10px;
}

.field-container {
  padding-top: 10px;
  padding-left: 15px;
}

.divider {
  height: 1px;
  margin: 0 10px 8px 10px;
  background: var(--divider);
}

.section-label {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

.hint {
  color: var(--hint);
  font-size: 11px;
  line-height: 1.4;
  padding-right: 20px;
  margin-top: 4px;
}

.space-above {
  margin-top: 10px;
}

/* Background / gradient pickers */

.file-selects {
  display: flex;
  gap: 13px;
}

.file-select {
  width: 114px;
  padding: 6px 12px;
  border: 1px solid #ccc;
  border-radius: 7px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.file-select:hover,
.file-select.drop-hover {
  background: #444;
}

.file-select.drop-hover {
  background: #666;
}

.subtitle {
  display: block;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  white-space: nowrap;
}

.select-title {
  display: block;
  margin-top: 5px;
  font-size: 14px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* Checkboxes and radios, as in the original */

.checkbox-field {
  display: flex;
  align-items: center;
  margin-left: -1px;
}

.checkbox-field label {
  margin-left: 0.6em;
}

input[type="checkbox"],
input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  display: grid;
  place-content: center;
  flex: none;
  margin: 0;
  font: inherit;
  background: var(--field-bg);
  border: 0.1em solid var(--field-border);
  cursor: pointer;
}

input[type="checkbox"] {
  width: 1.15em;
  height: 1.15em;
  border-radius: 0.15em;
}

input[type="radio"] {
  width: 1em;
  height: 1em;
  border-radius: 50%;
}

input[type="checkbox"]:hover {
  transform: scale(1.1);
  transition: 180ms transform ease-in-out;
}

input[type="radio"]:hover {
  transform: scale(1.15);
  transition: 180ms transform ease-in-out;
}

input[type="checkbox"]::before {
  content: "";
  width: 0.65em;
  height: 0.65em;
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
  transform: scale(0);
  transition: 120ms transform ease-in-out;
  box-shadow: inset 1em 1em white;
}

input[type="radio"]::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  transform: scale(0);
  transition: 120ms transform ease-in-out;
  box-shadow: inset 1em 1em white;
}

input[type="checkbox"]:checked::before,
input[type="radio"]:checked::before {
  transform: scale(1);
}

.radio-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  row-gap: 6px;
}

.radio-row label {
  margin: 0 1em 0 0.3em;
  cursor: pointer;
}

/* Sliders */

.range-container {
  display: grid;
  grid-template-columns: 150px auto;
  align-items: center;
  column-gap: 12px;
  margin-top: 5px;
}

.range-label {
  grid-column: 1 / -1;
  margin-bottom: 2px;
}

input[type="range"] {
  width: 150px;
  height: 20px;
  margin: 0;
  background: transparent;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(to right, white var(--fill, 50%), rgb(140, 140, 140) var(--fill, 50%));
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  margin-top: -6px;
  border-radius: 50%;
  background: white;
  border: none;
}

input[type="range"]::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: rgb(140, 140, 140);
}

input[type="range"]::-moz-range-progress {
  height: 4px;
  border-radius: 2px;
  background: white;
}

input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: white;
  border: none;
}

input[type="range"]:focus-visible {
  outline: 1px solid gray;
  outline-offset: 4px;
}

/* Text fields and select */

.text-field-label {
  display: block;
  margin-bottom: 8px;
}

.text-field {
  width: 190px;
  padding: 3px;
  border: none;
  border-radius: 4px;
  background: var(--field-bg);
  color: white;
  font-family: Lato, sans-serif;
  font-size: 14px;
  font-weight: 400;
}

.text-field:focus {
  outline: 1px solid gray;
}

.labeled-field {
  display: flex;
  align-items: center;
  gap: 0.6em;
  margin: 5px 0 5px 25px;
}

.labeled-field .text-field {
  width: 165px;
}

select {
  padding: 3px;
  border: none;
  border-radius: 4px;
  background: var(--field-bg);
  color: white;
  font: inherit;
}

/* Phased-array source list */

.source-list {
  padding: 6px 10px 0 15px;
}

.source-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.source-number {
  width: 16px;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.source-pos {
  width: 92px;
  color: var(--hint);
  font-size: 11px;
  white-space: pre;
}

.text-field.source-phase {
  width: 56px;
}

.icon-button.small {
  width: 26px;
  height: 26px;
}

.icon-button.small .icon {
  width: 16px;
  height: 16px;
}

.text-button:disabled {
  opacity: 0.4;
  cursor: default;
}

/* Video render progress */
.render-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.55);
  z-index: 2500;
}

.render-panel {
  width: min(360px, calc(100vw - 32px));
  padding: 20px 22px;
  border-radius: 8px;
  background: #2a2a2a;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}

.render-title {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 14px;
}

.render-bar {
  height: 6px;
  border-radius: 3px;
  background: #444;
  overflow: hidden;
}

.render-bar-fill {
  width: 0%;
  height: 100%;
  background: #e8834a;
  transition: width 120ms linear;
}

.render-status {
  margin: 10px 0 14px;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

/* Two buttons side by side */
.button-row {
  display: flex;
  gap: 8px;
}

.button-row .text-button + .text-button {
  margin-left: 0;
}

.text-button.recording {
  background: #6b1f1f;
  font-variant-numeric: tabular-nums;
}

.text-button.recording::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 7px;
  border-radius: 50%;
  background: #ff4d4d;
  vertical-align: 1px;
  animation: rec-blink 1s steps(2, start) infinite;
}

@keyframes rec-blink {
  to { visibility: hidden; }
}

/* Slider readouts double as buttons for typing an exact value */
.range-container [data-label][role="button"] {
  cursor: text;
  border-bottom: 1px dashed transparent;
}

.range-container [data-label][role="button"]:hover,
.range-container [data-label][role="button"]:focus-visible {
  border-bottom-color: #888;
  outline: none;
}

.text-field.range-edit {
  width: 64px;
  padding: 1px 4px;
  font-size: 13px;
}

/* Text buttons */

.text-button {
  height: 36px;
  padding: 0 16px;
  margin-left: -6px;
  border: none;
  border-radius: 18px;
  background: #333;
  font-size: 12px;
  font-weight: 300;
  cursor: pointer;
}

.text-button:hover {
  background: #3d3d3d;
}

.text-button:active {
  background: #484848;
}

.reset-parameters {
  margin: 10px 0 20px 10px;
}

.credit {
  margin: 20px 10px 0 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.credit p {
  margin: 0 0 6px 0;
}

.credit .made-with {
  margin-top: 10px;
  font-weight: 500;
  color: #e8834a;
  text-shadow: 0 0 8px rgba(232, 131, 74, 0.35);
}

.credit a {
  color: inherit;
}

.credit a:hover {
  font-weight: 700;
}

/* ----------------------------------------------------------------- menus */

.menu-layer {
  position: fixed;
  inset: 0;
  z-index: 2000;
  pointer-events: none;
}

.menu-panel {
  position: fixed;
  min-width: 112px;
  max-width: 280px;
  max-height: calc(100vh - 16px);
  overflow-y: auto;
  padding: 8px 0;
  border-radius: 4px;
  background: var(--menu-bg);
  box-shadow: 0 2px 4px -1px rgba(0, 0, 0, 0.2), 0 4px 5px rgba(0, 0, 0, 0.14), 0 1px 10px rgba(0, 0, 0, 0.12);
  pointer-events: auto;
}

.menu-item {
  display: flex;
  align-items: center;
  width: 100%;
  height: 48px;
  padding: 0 16px;
  border: none;
  background: transparent;
  font-size: 14px;
  font-weight: 400;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}

.menu-item:hover,
.menu-item:focus-visible,
.menu-item.open {
  background: rgba(255, 255, 255, 0.08);
  outline: none;
}

.menu-label {
  flex: 1;
}

.menu-note {
  margin-left: 6px;
  color: var(--muted);
}

.menu-arrow {
  margin-left: 12px;
  margin-right: -8px;
}

.menu-thumb-holder {
  display: inline-flex;
  width: 50px;
}

.menu-thumb {
  max-width: 40px;
  max-height: 30px;
  border: 1px solid gray;
  border-radius: 3px;
}

.menu-gradient-thumb {
  width: 25px;
  height: 30px;
  border-radius: 3px;
}

/* Telefon / dar ekran: simülasyon hep tam genişlik; panel üstüne kayar (açılır–kapanır) */
@media (max-width: 700px) {
  :root { --panel-width: min(300px, 86vw); }
  #scene, body.toolbar-right #scene { left: 0; width: 100%; }
  #toolbar { box-shadow: 0 0 24px rgba(0, 0, 0, 0.6); }
}

/* Sol alt: yakınlaştır / uzaklaştır / sıfırla (üstten alta) */
.zoom-buttons {
  position: absolute;
  left: 8px;
  bottom: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 1000;
}
.zoom-button {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 8px;
  background: rgba(34, 34, 34, 0.8);
  color: #fff;
  font: 600 22px/1 Lato, sans-serif;
  cursor: pointer;
}
.zoom-button:hover { background: rgba(70, 70, 70, 0.9); }
.zoom-button .icon { width: 20px; height: 20px; fill: currentColor; }

/* Yön seçimi: 2 × 2 (Top Left / Bottom Right) */
.radio-row.radio-grid {
  display: grid;
  grid-template-columns: auto 1fr auto 1fr;
  align-items: center;
  row-gap: 6px;
}

/* Dikey telefon kapısı: yan çevrilene kadar simülasyonun üstünü kaplar */
.rotate-gate {
  position: fixed;
  inset: 0;
  z-index: 4000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  background: #161616;
  color: #eee;
  text-align: center;
}
.rotate-gate[hidden] { display: none; }
.rotate-icon { width: 64px; height: 64px; color: #7db9d8; animation: rotate-hint 2.4s ease-in-out infinite; }
@keyframes rotate-hint { 0%, 20% { transform: rotate(0); } 50%, 70% { transform: rotate(-90deg); } 100% { transform: rotate(0); } }
@media (prefers-reduced-motion: reduce) { .rotate-icon { animation: none; } }
.rotate-title { font: 600 22px Lato, sans-serif; }
.rotate-text { max-width: 280px; color: #aaa; line-height: 1.5; }
.rotate-back { margin-top: 10px; color: #7db9d8; text-decoration: none; }
