* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: #f9f9f9;
  direction: rtl;
  color: #222;
  overflow-x: hidden;
}

.quran-cont {
  max-width: 700px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 25px;
  padding: 20px;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 15px;
}

.top-bar img {
  height: 60px;
  width: auto;
  cursor: pointer;
  object-fit: contain;
  flex-shrink: 0;
}

.controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
  flex-grow: 1;
}

label {
  font-weight: 600;
  margin-left: 5px;
  user-select: none;
  font-size: 14px;
  flex-shrink: 0;
}

select {
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid #ccc;
  min-width: 160px;
  font-size: 14px;
  cursor: pointer;
  transition: border-color 0.3s ease;
  flex-grow: 1;
}

select:hover,
select:focus {
  border-color: #4a90e2;
  outline: none;
}

button {
  padding: 8px 18px;
  border: none;
  border-radius: 7px;
  background-color: #4a90e2;
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.3s ease;
  font-size: 14px;
  white-space: nowrap;
  flex-shrink: 0;
}

button:hover {
  background-color: #357abd;
}

.image-slider {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  flex-wrap: nowrap;
}

.image-slider button {
  padding: 16px;
  font-size: 26px;
  font-weight: bold;
  border-radius: 50%;
  width: 60px;
  height: 60px;
  background-color: #4a90e2;
  color: white;
  border: none;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.3s ease, transform 0.2s ease;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-slider button:hover {
  background-color: #357abd;
  transform: scale(1.05);
}

.image-slider img {
  max-width: calc(100% - 140px);
  max-height: 80vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
  user-select: none;
  flex-grow: 1;
}

audio {
  width: 100%;
  outline: none;
  border: none;
  background: none;
  box-shadow: none;
}

.dialog-wrapper {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(3px);
  z-index: 9999;
}

.dialog-wrapper.active {
  display: flex;
}

dialog.iframe-dialog {
  border: none;
  border-radius: 12px;
  max-width: 90vw;
  max-height: 90vh;
  width: 700px;
  background: #fff;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  user-select: text;
  outline: none;
  z-index: 10000;
  margin: auto;
}

dialog.iframe-dialog iframe {
  width: 100%;
  height: 80vh;
  border: none;
  border-radius: 0 0 12px 12px;
  display: block;
  flex-shrink: 0;
}

.close-btn {
  position: absolute;
  top: 12px;
  left: 12px;
  background: transparent;
  border: none;
  color: #555;
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: color 0.2s ease;
  padding: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  user-select: none;
  z-index: 10001;
}

.close-btn:hover,
.close-btn:focus {
  color: #222;
  background-color: rgba(0, 0, 0, 0.05);
  outline: none;
}

@media (max-width: 768px) {
  .quran-cont {
    padding: 15px;
    gap: 15px;
  }

  .top-bar {
    flex-direction: column;
    align-items: center;
    gap: 15px;
    width: 100%;
  }

  .top-bar img {
    height: 50px;
    margin-bottom: 10px;
  }

  .controls {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    width: 100%;
    justify-content: center;
  }

  label {
    text-align: right;
    width: 100%;
    margin-left: 0;
  }

  select,
  button {
    width: 100%;
    font-size: 14px;
    padding: 10px 15px;
  }

  .image-slider {
    justify-content: space-between;
    gap: 10px;
  }

  .image-slider button {
    width: 44px;
    height: 44px;
    font-size: 18px;
    border-radius: 12px;
    background-color: #4a90e2;
  }

  .image-slider img {
    max-width: calc(100% - 110px);
    max-height: 60vh;
  }

  audio {
    margin-top: 15px;
  }

  dialog.iframe-dialog {
    width: 95vw;
    max-height: 95vh;
  }

  dialog.iframe-dialog iframe {
    height: 80vh;
  }

  .close-btn {
    top: 8px;
    left: 8px;
    font-size: 24px;
    width: 32px;
    height: 32px;
  }
}

@media (max-width: 480px) {
  .quran-cont {
    padding: 10px;
    gap: 10px;
  }

  .image-slider {
    flex-direction: column;
    gap: 12px;
  }

  .image-slider button {
    width: 54px;
    height: 54px;
    font-size: 22px;
    border-radius: 14px;
  }

  .image-slider img {
    max-width: 100%;
    max-height: 50vh;
  }
}
