:root {
  --bg: #000000;
  --surface: #101411;
  --surface-2: #18211b;
  --surface-3: #233127;
  --page: #f4ecd8;
  --page-ink: #17120a;
  --page-muted: #665b46;
  --gold: #dcb35c;
  --gold-soft: rgba(220, 179, 92, 0.22);
  --teal: #20d6d2;
  --teal-soft: rgba(32, 214, 210, 0.32);
  --text: #ffffff;
  --muted: #bfc8bf;
  --dim: #7d887e;
  --danger: #ff6b7a;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 600px;
  height: 600px;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Tahoma, Arial, sans-serif;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
}

#app {
  width: 600px;
  height: 600px;
  padding: 8px;
  position: relative;
}

.screen {
  width: 584px;
  height: 584px;
  position: absolute;
  inset: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hidden {
  display: none !important;
}

.topbar {
  min-height: 58px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, rgba(16, 20, 17, 0.98), rgba(24, 33, 27, 0.94));
  border: 1px solid rgba(220, 179, 92, 0.28);
  border-radius: var(--radius);
  flex-shrink: 0;
}

.title-block {
  min-width: 0;
  flex: 1;
}

h1,
p {
  margin: 0;
}

.title-block h1 {
  font-size: 21px;
  line-height: 1.08;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0;
}

.title-block p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.icon-button {
  width: 52px;
  min-width: 52px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--gold);
  font-size: 16px;
  font-weight: 800;
}

.reader-area {
  min-height: 0;
  flex: 1;
  display: flex;
}

.page-panel {
  width: 100%;
  min-height: 0;
  padding: 16px 16px 18px;
  overflow-y: auto;
  overscroll-behavior: contain;
  direction: rtl;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.42), rgba(255, 255, 255, 0) 20%),
    var(--page);
  color: var(--page-ink);
  border: 2px solid rgba(220, 179, 92, 0.74);
  border-radius: var(--radius);
  box-shadow: 0 0 24px rgba(220, 179, 92, 0.16);
  scrollbar-width: none;
}

.page-panel::-webkit-scrollbar,
.list-shell::-webkit-scrollbar,
.surah-list::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.status-line {
  direction: ltr;
  text-align: center;
  color: var(--page-muted);
  font-size: 16px;
  font-weight: 700;
  padding: 26px 8px;
}

.ayah-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.surah-break {
  direction: ltr;
  text-align: center;
  margin: 0 0 2px;
  padding: 8px 10px;
  color: #5c4520;
  border-top: 1px solid rgba(92, 69, 32, 0.32);
  border-bottom: 1px solid rgba(92, 69, 32, 0.32);
  font-size: 15px;
  font-weight: 800;
}

.ayah {
  position: relative;
  display: block;
  text-align: right;
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
  font-size: 24px;
  line-height: 1.58;
  font-weight: 500;
  letter-spacing: 0;
}

.ayah-number {
  min-width: 26px;
  height: 26px;
  margin-left: 6px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  border-radius: 50%;
  border: 1px solid rgba(100, 72, 24, 0.58);
  color: #60451b;
  font-size: 13px;
  line-height: 1;
  font-weight: 800;
  direction: ltr;
}

.action-rail {
  min-height: 76px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  flex-shrink: 0;
}

.rail-button,
.jump-button,
.surah-row {
  position: relative;
  color: var(--text);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 2px solid rgba(255, 255, 255, 0.04);
  border-radius: var(--radius);
}

.rail-button {
  min-height: 76px;
  padding: 9px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  color: var(--muted);
}

.rail-button span {
  color: var(--gold);
  font-size: 21px;
  line-height: 1;
}

.rail-button b {
  font-size: 15px;
  line-height: 1;
  font-weight: 800;
}

.primary {
  background: linear-gradient(180deg, #dcb35c, #9a7028);
  color: #140f08;
  border-color: rgba(255, 242, 191, 0.42);
}

.primary span {
  color: #140f08;
}

.search-strip {
  min-height: 58px;
  padding: 0;
}

.search-input {
  width: 100%;
  height: 58px;
  padding: 0 18px;
  color: var(--text);
  background: var(--surface);
  border: 2px solid rgba(220, 179, 92, 0.25);
  border-radius: var(--radius);
  font-size: 17px;
}

.search-input::placeholder {
  color: var(--dim);
}

.list-shell {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  position: relative;
  border-radius: var(--radius);
}

.list-shell::before,
.list-shell::after {
  content: "";
  position: sticky;
  left: 0;
  right: 0;
  display: block;
  height: 24px;
  pointer-events: none;
  z-index: 2;
}

.list-shell::before {
  top: 0;
  margin-bottom: -24px;
  background: linear-gradient(to bottom, #000 0%, rgba(0, 0, 0, 0) 100%);
}

.list-shell::after {
  bottom: 0;
  margin-top: -24px;
  background: linear-gradient(to top, #000 0%, rgba(0, 0, 0, 0) 100%);
}

.surah-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 2px;
}

.surah-row {
  width: 100%;
  min-height: 72px;
  padding: 10px 12px;
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 10px;
  align-items: center;
  text-align: left;
}

.row-number {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--gold);
  background: rgba(220, 179, 92, 0.12);
  border: 1px solid rgba(220, 179, 92, 0.28);
  border-radius: 50%;
  font-size: 14px;
  font-weight: 800;
}

.row-main {
  min-width: 0;
}

.row-title {
  display: block;
  font-size: 17px;
  line-height: 1.08;
  font-weight: 800;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-meta {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-arabic {
  max-width: 150px;
  direction: rtl;
  text-align: right;
  color: var(--gold);
  font-size: 20px;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.page-jump {
  min-height: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.page-meter {
  height: 190px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--text);
  background:
    radial-gradient(circle at center, rgba(220, 179, 92, 0.24), transparent 58%),
    linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid rgba(220, 179, 92, 0.30);
  border-radius: var(--radius);
}

.page-meter span {
  color: var(--muted);
  font-size: 18px;
  font-weight: 700;
}

.page-meter strong {
  color: var(--gold);
  font-size: 88px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: 0;
}

.jump-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.jump-button {
  min-height: 96px;
  font-size: 22px;
  font-weight: 900;
}

.empty-state {
  padding: 48px 20px;
  color: var(--muted);
  text-align: center;
  font-size: 18px;
  line-height: 1.45;
  background: var(--surface);
  border: 1px solid rgba(220, 179, 92, 0.20);
  border-radius: var(--radius);
}

.focusable {
  outline: none;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease,
    background 180ms ease;
}

.focusable:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 2px rgba(32, 214, 210, 0.2), 0 0 24px var(--teal-soft);
}

button.focusable:active {
  transform: scale(0.96);
}

.toast {
  position: fixed;
  left: 50%;
  top: 22px;
  max-width: 536px;
  padding: 12px 18px;
  color: var(--text);
  background: rgba(16, 20, 17, 0.96);
  border: 1px solid var(--teal);
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 800;
  opacity: 0;
  transform: translateX(-50%) translateY(-14px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
  z-index: 20;
}

.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .focusable,
  .toast {
    transition: none;
  }
}
