:root {
    --safe-top: env(safe-area-inset-top);
    --safe-right: env(safe-area-inset-right);
    --safe-bottom: env(safe-area-inset-bottom);
    --safe-left: env(safe-area-inset-left);

    --frame-gap: 15px;
    --frame-border: 5px;
}

html, body { 
    margin:0; 
    height:100%; 
    background: #000 url('/images/photo_ambartsum_amayakyan_aka_amik.webp') center center / cover no-repeat;
}
#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; z-index: 0; }

.blue-frame {
    position: fixed;
    top: calc(15px + var(--safe-top));
    left: calc(15px + var(--safe-left));
    right: calc(15px + var(--safe-right));
    bottom: calc(15px + var(--safe-bottom));
    border: 5px solid #0000FF;
    z-index: 2;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding: 30px;
    overflow: hidden;
    background: transparent;
}

.blue-frame::before {
    display: none !important;
}

.blue-frame {
    background: transparent !important;
}

.mirror-text {
    position: absolute;
    top: calc(44px + 2px);
    left: 46px;
    font-family: var(--hand);
    font-synthesis-weight: none;
    font-size: var(--reply-size, 24px);
    font-weight: var(--reply-weight, 500);
    line-height: 1.15;
    color: white;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 4px 16px;
    border-radius: 0;
    white-space: nowrap;
    z-index: 1;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

body { --reply-gap: 16px; }

@media (max-width: 560px) {
    body { --reply-gap: 72px; }
}

.mirror-text:hover {
    background-color: rgba(0, 0, 255, 0.6);
}

.highlighted-text {
    font-style: italic;
    text-decoration: underline;
    text-decoration-color: #0000FF;
    text-decoration-thickness: 2px;
    text-underline-offset: 2px;
}

.ambartsum-logo {
    position: absolute;
    top: 15px;
    left: 65px;
    z-index: 999;
    opacity: 1;
}

.ambartsum-logo svg {
    width: 174px;
    height: 69px;
}

body {
    font-family: 'Trebuchet MS', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.nav-lang-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.current-language-display {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
}

.current-lang-label {
    color: rgba(255, 255, 255, 0.6);
    font-size: 10px;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.current-lang-name {
    color: #FFFFFF;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

@media (max-width: 768px) {
    :root { --frame-gap: 10px; --frame-border: 3px; }

    .blue-frame {
        top: calc(10px + var(--safe-top));
        left: calc(10px + var(--safe-left));
        right: calc(10px + var(--safe-right));
        bottom: calc(10px + var(--safe-bottom));
        border-width: 3px;
        padding: 20px;
    }

.ambartsum-logo {
        top: calc(10px + var(--safe-top));
        left: 52px;
    }
    
    .ambartsum-logo svg {
        width: 140px;
        height: 55px;
    }

.nav-text {
        font-size: 13px;
    }
}

@media (max-width: 458px) {
    :root { --frame-gap: 8px; --frame-border: 2px; }

    .blue-frame {
        top: calc(8px + var(--safe-top));
        left: calc(8px + var(--safe-left));
        right: calc(8px + var(--safe-right));
        bottom: calc(8px + var(--safe-bottom));
        border-width: 2px;
        padding: 16px;
    }

.ambartsum-logo {
        top: calc(8px + var(--safe-top));
        left: 46px;
    }
    
    .ambartsum-logo svg {
        width: 120px;
        height: 47px;
    }

.nav-text {
        font-size: 12px;
    }
}

#ui {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 11;
  background: transparent;
  border: none;
  padding: 0;
}

#ui[data-header-follow] {
  --header-fade: 320ms;
  opacity: 1;
  visibility: visible;
  transition:
    opacity var(--header-fade) cubic-bezier(0.22, 0.61, 0.36, 1),
    transform var(--header-fade) cubic-bezier(0.22, 0.61, 0.36, 1),
    visibility 0s;
}

#ui[data-header-follow].header-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateX(-50%) translateY(10px);
  transition:
    opacity var(--header-fade) cubic-bezier(0.4, 0, 0.6, 1),
    transform var(--header-fade) cubic-bezier(0.4, 0, 0.6, 1),
    visibility 0s linear var(--header-fade);
}

@media (prefers-reduced-motion: reduce) {
  #ui[data-header-follow],
  #ui[data-header-follow].header-hidden {
    transform: translateX(-50%);
    transition: opacity 1ms linear, visibility 0s;
  }
}

#btnSettings { display: none; }
#ui .row { 
  gap: 20px; 
  display: flex;
  align-items: center;
  justify-content: center;
  width: auto;
}
.left-controls {
  display: flex;
  gap: 10px;
  align-items: center;
}
.center-controls {
  display: flex;
  gap: 10px;
  align-items: center;
}
.right-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}
.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: rgba(0, 0, 0, 0.6);
  color: #FFFFFF;
  border: none;
  border-radius: 0;
  cursor: pointer;
  transition: background-color 0.3s ease;
  padding: 0;
  margin: 0;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.icon-btn:hover {
  background-color: rgba(0, 0, 255, 0.6);
}

.icon-btn svg {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  margin: 0;
  padding: 0;
}

.text-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  height: 48px;
  background: rgba(0, 0, 0, 0.6);
  border: none;
  border-radius: 0;
  color: white;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  transition: background-color 0.3s ease;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.text-btn input[type="file"] {
  position: absolute;
  left: -9999px;
}

.text-btn:hover {
  background-color: rgba(0, 0, 255, 0.6);
}

.text-btn .material-icons { 
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  font-size: 20px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  outline: none;
}

.icon-btn .material-icons {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  margin: 0;
  padding: 0;
  font-size: 24px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  outline: none;
}

.control-group {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.slider-container {
  position: absolute;
  bottom: 100%;
  left: 0;
  background: rgba(0, 0, 0, 0.6);
  border: none;
  border-radius: 0;
  padding: 8px 8px;
  margin-bottom: 0;
  z-index: 1000;
  width: 48px;
  box-sizing: border-box;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.slider-container::after {
  display: none;
}

.eq-item { 
  display: flex; 
  flex-direction: column; 
  align-items: center; 
  gap: 0; 
  width: 100%;
}
.eq input[type="range"] { 
  position: absolute;
  left: -9999px;
  opacity: 0;
  pointer-events: none;
}

.custom-slider {
  position: relative;
  width: 4px;
  height: 120px;
  background: rgba(255,255,255,.2);
  border-radius: 0;
  cursor: pointer;
}

.custom-slider-thumb {
  position: absolute;
  left: -8px;
  width: 20px;
  height: 5px;
  background: #0066ff;
  border-radius: 0;
  cursor: grab;
  transform: translateY(-50%);
  user-select: none;
}

.custom-slider-thumb:active {
  cursor: grabbing;
}

.custom-slider-fill {
  position: absolute;
  bottom: 0;
  width: 100%;
  background: rgba(0,0,255,.5);
  border-radius: 0;
}

.material-icons {
  background: none !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
}

@media (max-width: 768px) {
  #ui { bottom: 20px; }
  #ui .row { gap: 12px; }
  .left-controls,
  .right-controls { gap: 8px; }

  .icon-btn { width: 42px; height: 42px; }

  .text-btn {
    width: 42px;
    height: 42px;
    padding: 0;
    justify-content: center;
  }
  .text-btn .btn-label { display: none; }

  #btnSettings { display: flex; }

  .center-controls {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 10px);
    transform: translateX(-50%);
    display: none;
    gap: 4px;
    padding: 10px 6px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }

  #ui.settings-open .center-controls { display: flex; }

  .center-controls .control-group {
    flex-direction: column-reverse;
    gap: 6px;
  }

  .center-controls .slider-container {
    display: block !important;
    position: static;
    width: 42px;
    padding: 0;
    background: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .center-controls .custom-slider { height: 96px; }

  .center-controls .icon-btn {
    width: 42px;
    height: 26px;
    background: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    pointer-events: none;
  }
}

@media (max-width: 458px) {
  #ui { bottom: 15px; }
  #ui .row { gap: 10px; }

  .icon-btn { width: 38px; height: 38px; }

  .text-btn { width: 38px; height: 38px; }

  .center-controls .slider-container { width: 38px; }
  .center-controls .custom-slider { height: 84px; }
  .center-controls .icon-btn { width: 38px; height: 24px; }
}
