:root {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #f4f1e9;
  background: #07101b;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-width: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 15%, rgba(39, 62, 92, 0.22), transparent 38%),
    #07101b;
}

button,
input {
  font: inherit;
}

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

.app-shell {
  width: min(680px, 100%);
  min-height: 470px;
  padding: 38px 48px;
  display: grid;
  align-items: center;
  background: #0b1524;
  border: 1px solid #d4ad5c;
  border-radius: 12px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.36);
  transition: border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}

.app-shell.is-dragging {
  border-color: #f0d184;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.42), 0 0 0 3px rgba(224, 185, 100, 0.12);
  transform: translateY(-1px);
}

.panel[hidden] {
  display: none;
}

.panel-centered {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 14px;
  min-height: 390px;
}

h1,
p {
  margin: 0;
}

h1 {
  font-size: 26px;
  line-height: 1.15;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.star {
  color: #e0b964;
  font-size: 36px;
  line-height: 1;
  user-select: none;
}

.star-small {
  font-size: 28px;
}

.or-text,
.secondary-text,
.small-text,
.local-note {
  color: #aeb8c8;
}

.or-text {
  font-size: 14px;
}

.secondary-text {
  font-size: 14px;
  line-height: 1.5;
}

.small-text,
.local-note {
  font-size: 12px;
  line-height: 1.45;
}

.local-note {
  margin-top: 2px;
}

.royal-button,
.download-button {
  appearance: none;
  border: 1px solid #d4ad5c;
  border-radius: 6px;
  background: #101c2c;
  color: #f0d184;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease, transform 80ms ease;
}

.royal-button {
  min-width: 154px;
  padding: 10px 22px;
  font-size: 15px;
}

.download-button {
  min-width: 118px;
  padding: 8px 13px;
  font-size: 13px;
  white-space: nowrap;
}

.royal-button:hover,
.download-button:hover {
  background: #18283d;
  border-color: #f0d184;
  color: #f6dda1;
}

.royal-button:active,
.download-button:active {
  transform: translateY(1px);
}

.royal-button:focus-visible,
.download-button:focus-visible {
  outline: 2px solid rgba(240, 209, 132, 0.7);
  outline-offset: 3px;
}

.progress-track {
  width: min(350px, 80vw);
  height: 5px;
  margin-top: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #28384d;
}

.progress-bar {
  width: 34%;
  height: 100%;
  border-radius: inherit;
  background: #e0b964;
  animation: loading 1.15s ease-in-out infinite;
}

@keyframes loading {
  0% { transform: translateX(-110%); }
  50% { transform: translateX(95%); }
  100% { transform: translateX(300%); }
}

.success-panel {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.success-heading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  text-align: center;
}

.success-heading h1 {
  color: #f0d184;
  font-size: 24px;
  letter-spacing: 0.07em;
}

.download-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px;
  border: 1px solid #26384f;
  border-radius: 8px;
  background: rgba(16, 28, 44, 0.72);
}

.section-label {
  color: #d9b764;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.download-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

.download-info {
  min-width: 0;
}

.download-kind {
  margin-bottom: 2px;
  color: #9fabbc;
  font-size: 12px;
}

.download-name {
  overflow-wrap: anywhere;
  color: #f4f1e9;
  font-size: 13px;
  line-height: 1.35;
}

.metadata {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.metadata-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.metadata-row {
  display: grid;
  grid-template-columns: 155px minmax(0, 1fr);
  gap: 18px;
  align-items: baseline;
  font-size: 14px;
  line-height: 1.4;
}

.metadata-row span {
  color: #aeb8c8;
}

.metadata-row strong {
  min-width: 0;
  overflow-wrap: anywhere;
  color: #f4f1e9;
  font-weight: 500;
}

.divider {
  height: 1px;
  background: #27384d;
}

.success-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding-top: 2px;
}

.error-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 2px solid #ff746b;
  border-radius: 50%;
  color: #ff746b;
  font-size: 25px;
  line-height: 1;
}

.error-title {
  color: #ff8178;
}

.error-message {
  max-width: 430px;
}

@media (max-width: 620px) {
  body {
    padding: 12px;
  }

  .app-shell {
    min-height: calc(100vh - 24px);
    padding: 28px 22px;
    border-radius: 10px;
  }

  .metadata-row {
    grid-template-columns: 125px minmax(0, 1fr);
    gap: 12px;
    font-size: 13px;
  }

  .download-row {
    grid-template-columns: 1fr;
  }

  .download-button {
    width: 100%;
  }
}
