:root {
  color-scheme: light;
  --yellow: #fffc00;
  --yellow-soft: #fff36a;
  --black: #070707;
  --ink: #111111;
  --panel: #ffffff;
  --panel-dark: #151515;
  --muted: #5b5b5b;
  --line: rgba(0, 0, 0, 0.16);
  --line-dark: rgba(255, 255, 255, 0.16);
  --green: #19b384;
  --coral: #ed6757;
  --shadow: 0 14px 34px rgba(0, 0, 0, 0.2);
  --arabic-font: "Cairo", "DIN Next LT Arabic", "Noto Kufi Arabic", "Geeza Pro", "Arial Arabic", Tahoma, Arial, sans-serif;
  --latin-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-family: var(--arabic-font);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--yellow);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at top right, rgba(255, 255, 255, 0.65), transparent 260px),
    linear-gradient(180deg, var(--yellow), #ffe600);
}

body.is-dragging {
  cursor: grabbing;
  user-select: none;
}

body.is-dragging .drag-handle {
  cursor: grabbing;
}

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.shell {
  width: min(100%, 520px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 14px 14px 112px;
}

.topbar {
  display: block;
  min-height: 0;
  padding: 8px;
  color: #fff;
  background: var(--black);
  border: 2px solid var(--black);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.headline {
  position: relative;
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: flex-start;
  min-height: 29px;
  gap: 8px;
}

.eyebrow {
  flex: 0 0 auto;
  width: auto;
  margin: 0;
  padding: 7px 10px;
  color: var(--black);
  background: var(--yellow);
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 900;
  line-height: 1;
}

.header-title {
  position: static;
  margin-right: auto;
  max-width: min(58%, 280px);
  min-width: 0;
  color: #fff;
  text-align: left;
  direction: ltr;
  font-family: var(--latin-font);
  font-size: clamp(0.7rem, 3vw, 1rem);
  font-weight: 900;
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 12vw, 3.15rem);
  line-height: 0.95;
  letter-spacing: 0;
}

h2 {
  font-size: 1.26rem;
  line-height: 1.2;
}

.choice-overlay {
  position: sticky;
  top: 10px;
  z-index: 20;
  margin: 12px 0 4px;
  padding: 14px 16px;
  color: var(--yellow);
  text-align: center;
  background: var(--black);
  border: 3px solid #fff;
  border-radius: 8px;
  box-shadow: 0 9px 0 rgba(0, 0, 0, 0.28);
  font-size: clamp(1.15rem, 6vw, 1.72rem);
  font-weight: 950;
  line-height: 1.15;
}

.choice-overlay.prompt-pop {
  animation: prompt-pop 360ms ease;
}

@keyframes prompt-pop {
  0% {
    opacity: 0.55;
    transform: translateY(-8px) scale(0.96);
  }

  70% {
    transform: translateY(2px) scale(1.02);
  }

  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.panel {
  display: none;
  margin-top: 14px;
}

.panel.active {
  display: block;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  color: var(--black);
}

.section-title.compact {
  margin-top: 18px;
}

.section-title span {
  color: var(--black);
  font-size: 1rem;
  font-weight: 900;
}

.ranking-list,
.artists-list,
.results-list {
  display: grid;
  gap: 9px;
}

.ranking-list {
  min-height: 72px;
  margin-top: 8px;
}

.empty-ranking {
  display: grid;
  place-items: center;
  min-height: 82px;
  padding: 14px;
  color: rgba(255, 255, 255, 0.78);
  background: var(--panel-dark);
  border: 2px dashed rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  font-weight: 900;
}

.code-field {
  display: grid;
  gap: 8px;
  margin: 14px 0 0;
  color: var(--black);
  font-size: 0.88rem;
  font-weight: 900;
}

.code-field input {
  width: 100%;
  height: 46px;
  padding: 0 12px;
  color: #fff;
  background: var(--black);
  border: 2px solid var(--black);
  border-radius: 8px;
  outline: none;
}

.code-field input:focus {
  border-color: #fff;
}

.artist-row {
  display: grid;
  grid-template-columns: 40px 48px minmax(0, 1fr) 48px;
  gap: 10px;
  align-items: center;
  min-height: 86px;
  padding: 12px;
  color: #fff;
  background: var(--black);
  border: 2px solid var(--black);
  border-radius: 8px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.16);
}

.drag-placeholder {
  min-height: 86px;
  background: rgba(0, 0, 0, 0.18);
  border: 3px dashed var(--black);
  border-radius: 8px;
}

.drag-ghost {
  position: fixed;
  top: 0;
  right: auto;
  left: 0;
  z-index: 100;
  pointer-events: none;
  opacity: 0.96;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.42);
  will-change: transform;
}

.rank-number,
.drag-handle,
.icon-button {
  display: grid;
  place-items: center;
  width: 100%;
  height: 48px;
  border-radius: 8px;
  font-weight: 900;
}

.rank-number {
  color: var(--black);
  background: var(--yellow);
  font-size: 1.2rem;
}

.drag-handle,
.icon-button {
  color: #fff;
  background: #242424;
  border: 1px solid var(--line-dark);
  cursor: grab;
}

.drag-handle {
  touch-action: none;
}

.icon-button {
  cursor: pointer;
  font-size: 1.45rem;
}

.remove-button {
  color: var(--yellow);
}

.artist-pick {
  display: block;
  min-height: 106px;
  width: 100%;
  padding: 18px 16px;
  color: var(--black);
  text-align: right;
  background: var(--panel);
  border: 2px solid var(--black);
  border-radius: 8px;
  box-shadow: 0 8px 0 var(--black);
  cursor: pointer;
}

.artist-pick:active {
  transform: translateY(3px);
  box-shadow: 0 5px 0 var(--black);
}

.pick-name,
.artist-name {
  min-width: 0;
}

.pick-name strong,
.pick-name span,
.artist-name strong,
.artist-name span {
  display: block;
  overflow-wrap: anywhere;
}

.pick-name strong,
.artist-name strong {
  font-size: 1.48rem;
  line-height: 1.25;
}

.pick-name span,
.artist-name span {
  margin-top: 5px;
  direction: ltr;
  text-align: right;
  font-size: 1rem;
  font-weight: 800;
}

.pick-name span {
  color: var(--muted);
}

.artist-name span {
  color: rgba(255, 255, 255, 0.68);
}

.action-bar {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  place-items: center;
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
  background: rgba(255, 252, 0, 0.9);
  border-top: 2px solid var(--black);
  backdrop-filter: blur(12px);
}

.primary-button {
  width: min(100%, 492px);
  min-height: 54px;
  color: var(--yellow);
  background: var(--black);
  border: 2px solid var(--black);
  border-radius: 8px;
  box-shadow: 0 7px 0 rgba(0, 0, 0, 0.35);
  cursor: pointer;
  font-weight: 900;
}

.primary-button:disabled {
  color: rgba(0, 0, 0, 0.42);
  background: rgba(255, 255, 255, 0.54);
  box-shadow: none;
  cursor: default;
}

.notice {
  margin: 6px 0 12px;
  padding: 12px;
  color: #fff;
  background: var(--black);
  border: 2px solid var(--black);
  border-radius: 8px;
  font-weight: 900;
}

.result-row {
  display: grid;
  gap: 13px;
  padding: 16px;
  color: #fff;
  background: var(--black);
  border: 2px solid var(--black);
  border-radius: 8px;
}

.result-top {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
}

.position {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  color: var(--black);
  background: var(--yellow);
  border: 3px solid #fff;
  border-radius: 12px;
  box-shadow:
    0 5px 0 rgba(255, 252, 0, 0.3),
    inset 0 -3px 0 rgba(0, 0, 0, 0.16);
  font-size: 1.8rem;
  font-weight: 900;
  line-height: 1;
}

.result-name {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 900;
  line-height: 1.18;
}

.result-name strong,
.result-name span,
.result-name em {
  display: inline;
  overflow-wrap: anywhere;
}

.result-name em {
  color: rgba(255, 255, 255, 0.68);
  direction: ltr;
  font-style: normal;
  font-size: 1.05rem;
  font-weight: 800;
}

.result-name strong {
  font-size: 1.4rem;
}

.points {
  color: var(--yellow);
  font-size: 1.14rem;
  font-weight: 900;
  white-space: nowrap;
}

.bar-track {
  height: 14px;
  overflow: hidden;
  background: #343434;
  border-radius: 8px;
}

.bar-fill {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--yellow), var(--yellow-soft), #fff);
  border-radius: 8px;
  transition: width 260ms ease;
}

.hidden {
  display: none !important;
}

@media (max-width: 380px) {
  .shell {
    padding-right: 10px;
    padding-left: 10px;
  }

  .topbar {
    padding: 10px;
  }

  .artist-row {
    grid-template-columns: 34px 42px minmax(0, 1fr) 42px;
    gap: 6px;
    padding: 10px;
  }

  .rank-number,
  .drag-handle,
  .icon-button {
    height: 42px;
  }

}
