html {
  height: -webkit-fill-available;
}
html, body {
  margin: 0;
  height: 100%;
  width: 100%;
  min-height: -webkit-fill-available;
  overflow: hidden;
  background: linear-gradient(120deg, #0d1b2a, #1b263b, #2e1a47, #001f54);
  background-size: 800% 800%;
  animation: ambientFlow 90s ease infinite;
  font-family: 'Segoe UI', sans-serif;
  color: white;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
@supports (-webkit-touch-callout: none) {
  body {
    height: -webkit-fill-available;
  }
}
@keyframes ambientFlow {
  0% { background-position: 0% 50%; }
  25% { background-position: 50% 100%; }
  50% { background-position: 100% 50%; }
  75% { background-position: 50% 0%; }
  100% { background-position: 0% 50%; }
}
#time {
  font-size: min(3.5rem, 10vw);
  font-weight: bold;
  text-shadow: 2px 2px 10px rgba(0, 0, 0, 0.8),
               4px 4px 20px rgba(0, 0, 0, 0.4);
  padding: 0 1em;
  cursor: pointer;
  transition: opacity 0.2s;
  min-height: 1.2em;
}
#time:empty::after {
  content: "";
  display: block;
  position: fixed;
  left: 0;
  bottom: 0px;
  width: 100vw;
  height: 6px;
  background: linear-gradient(90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.5) 50%,
    rgba(255, 255, 255, 0) 100%);
  animation: loadingBar 3s linear infinite;
  opacity: 0.7;
  z-index: 1000;
}
@keyframes loadingBar {
  0% { transform: translateX(-100vw); }
  50% { transform: translateX(0); }
  100% { transform: translateX(100vw); }
}
#loading-bar, #loading-bar .bar { display: none !important; }
#loading-bar::before {
  content: '';
  position: fixed;
  bottom: 0;
  width: 60vw;
  height: 120px;
  left: -60vw;
  background: radial-gradient(ellipse at center, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0.5) 60%, rgba(255,255,255,0) 100%);
  filter: blur(4px);
  pointer-events: none;
  opacity: 0.7;
  animation: loadingBarGlow 6s cubic-bezier(0.42,0,0.58,1) infinite, loadingBarPulse 2s ease-in-out infinite alternate;
  transform: translateY(80px);
}
#loading-bar .bar::after {
  display: none;
}
@keyframes loadingBarGlow {
  0%   { left: -60vw; }
  100% { left: 100vw; }
}
@keyframes loadingBarPulse {
  0% { opacity: 0.4; }
  100% { opacity: 1; }
}
#time:hover {
  opacity: 0.8;
}
#english {
  font-size: min(1.5rem, 6vw);
  color: rgba(255, 255, 255, 0.8);
  margin-top: 1em;
  display: flex;
  flex-direction: column;
  gap: 0.2em;
}
.translation {
  font-size: min(1.5rem, 4.5vw);
  opacity: 0.8;
  text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.4);
}
.literal-label {
  opacity: 0.6;
}
#settings-icon, #play-icon {
  position: fixed;
  bottom: 1rem;
  width: 28px;
  height: 28px;
  cursor: pointer;
  transition: opacity 0.3s;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}
#settings-icon {
  right: 1rem;
  opacity: 0.3;
}
#play-icon {
  left: 1rem;
  opacity: 0.15;
}
#settings-icon:hover, #play-icon:hover {
  opacity: 0.8;
}
#play-icon path {
  transition: all 0.2s ease;
}
#settings-panel {
  position: fixed;
  bottom: 3rem;
  right: 1rem;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  padding: 1.5rem;
  border-radius: 8px;
  width: min(300px, calc(100vw - 2rem));
  margin-left: 1rem;
  transform: translateX(120%);
  transition: transform 0.3s ease;
  text-align: left;
  max-height: calc(100vh - 6rem);
  overflow-y: auto;
}
#settings-panel.open {
  transform: translateX(0);
}
.setting-group {
  margin-bottom: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.setting-group label {
  font-size: 0.9rem;
  opacity: 0.9;
  flex: 1;
  min-width: 0;
  user-select: none;
}
.setting-group .toggle-switch {
  flex: 0 0 auto;
}
.setting-group:has(input:disabled) {
  opacity: 0.5;
}
.setting-group:has(input:disabled) label {
  opacity: 1;
  cursor: not-allowed;
}
.setting-group select {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  padding: 0.3rem 0.5rem;
  border-radius: 4px;
  font-size: 0.9rem;
  cursor: pointer;
  outline: none;
  appearance: none;
  min-width: 130px;
  flex: 0 0 auto;
}
.setting-group select:hover {
  background: rgba(255, 255, 255, 0.15);
}
.setting-group select:focus {
  border-color: rgba(255, 255, 255, 0.3);
}
.setting-group.has-select {
  position: relative;
}
.setting-group.has-select::after {
  content: '▼';
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.6);
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}
.setting-group .slider-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 0 0 auto;
  min-width: 130px;
}
.speed-slider {
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.1);
  outline: none;
  opacity: 0.7;
  transition: opacity .2s;
  flex: 1;
}
.speed-slider:hover {
  opacity: 1;
}
.speed-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #1b263b;
  border: 2px solid rgba(255, 255, 255, 0.8);
  cursor: pointer;
  transition: all 0.2s;
}
.speed-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #1b263b;
  border: 2px solid rgba(255, 255, 255, 0.8);
  cursor: pointer;
  transition: all 0.2s;
}
.speed-slider::-webkit-slider-thumb:hover {
  background: #2e1a47;
  transform: scale(1.1);
}
.speed-slider::-moz-range-thumb:hover {
  background: #2e1a47;
  transform: scale(1.1);
}
.speed-value {
  font-size: 0.9rem;
  opacity: 0.8;
  min-width: 45px;
  text-align: right;
  user-select: none;
}
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex: 0 0 auto;
}
.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.2);
  transition: .3s;
  border-radius: 24px;
}
.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}
input:checked + .toggle-slider {
  background-color: #1b263b;
}
input:checked + .toggle-slider:before {
  transform: translateX(20px);
}
input:disabled + .toggle-slider {
  background-color: rgba(255, 255, 255, 0.1);
  cursor: not-allowed;
}
input:disabled + .toggle-slider:before {
  background-color: rgba(255, 255, 255, 0.3);
}
.divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  margin: 1rem 0;
}
.footer-links {
  font-size: 0.8rem;
  opacity: 0.7;
}
.footer-links a {
  color: white;
  text-decoration: none;
}
.footer-links a:hover {
  text-decoration: underline;
}
.donate-button {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  background: #2563eb;
  color: white;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  text-decoration: none;
  font-size: 0.9rem;
  line-height: 1;
  transition: background-color 0.2s ease;
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.donate-button:hover {
  background: #1d4ed8;
}
.donate-button:active {
  background: #1e40af;
}
.donate-icon {
  font-size: 1.4rem;
  line-height: 1;
  display: flex;
  align-items: center;
}
.donate-text {
  position: relative;
  top: 1px;
  line-height: 1;
}
.audio-hint {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.9rem;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}
.audio-hint.show {
  opacity: 1;
  animation: fadeInOut 3s forwards;
}
@keyframes fadeInOut {
  0% { opacity: 0; }
  20% { opacity: 1; }
  80% { opacity: 1; }
  100% { opacity: 0; }
}
.hidden {
  display: none !important;
}

