/* SortScape — daily OSRS ordering puzzle.
   Kept in its own stylesheet while the game is unlisted; can be merged into styles.css at launch. */

.srt-body {
  align-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  background-color: #14110e;
  background-image:
    linear-gradient(rgba(14, 11, 9, 0.35), rgba(9, 7, 6, 0.55)),
    url('assets/feature-images/blood moon rises.png');
  background-size: auto, cover;
  background-repeat: no-repeat;
  background-position: center, center;
  background-attachment: fixed;
}

.srt-container {
  width: min(560px, 94vw);
  margin: 0 auto;
  padding: 16px 0 32px;
  flex: 1 0 auto;
}

.srt-body > .site-footer {
  margin-top: auto;
  flex-shrink: 0;
}

/* ── Header ── */
.srt-header {
  text-align: center;
  margin-bottom: 14px;
}

/* Same treatment as .scribblescape-title (Quill 8 = OSRS NPC dialogue font) */
.srt-title {
  font-family: 'Quill 8', 'RuneScape Bold', Arial, serif;
  color: var(--osrs-gold);
  font-size: 58px;
  margin: 8px 0 4px;
  text-shadow: 2px 2px 0 var(--osrs-black);
}

.srt-meta-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 10px;
}

.srt-puzzle-number {
  font-family: 'RuneScape Bold', Arial, sans-serif;
  color: var(--osrs-yellow);
  font-size: 1.35rem;
  margin: 10px 0 6px;
  text-shadow: 1px 1px 0 var(--osrs-black);
}

.srt-stats-icon {
  width: 16px;
  height: 16px;
  image-rendering: pixelated;
  vertical-align: -3px;
}

.srt-prompt {
  padding: 10px 14px;
  margin: 0;
  font-size: 1.05rem;
  color: var(--osrs-yellow);
}

/* ── Axis labels ── */
.srt-axis-label {
  font-family: 'RuneScape Small', Arial, sans-serif;
  color: #c9b88a;
  text-align: center;
  margin: 6px 0;
  user-select: none;
}

/* ── Card list ── */
.srt-list {
  position: relative;
  touch-action: none; /* pointer-based drag on mobile */
}

.srt-card {
  position: absolute;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  box-sizing: border-box;
  background: #1f1e1b;
  border: 2px solid var(--osrs-ui-border);
  border-radius: 6px;
  box-shadow: inset 0 0 0 1px var(--osrs-black), 0 2px 0 rgba(0, 0, 0, 0.4);
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  transition: transform 0.18s ease, border-color 0.15s ease, background 0.15s ease;
  will-change: transform;
}

.srt-card-pos {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--osrs-ui-border);
  border-radius: 50%;
  font-family: 'RuneScape Bold', Arial, sans-serif;
  color: #c9b88a;
  font-size: 0.9rem;
}

.srt-card-name {
  flex: 1 1 auto;
  font-family: 'RuneScape Bold', Arial, sans-serif;
  color: var(--osrs-yellow);
  font-size: 1.05rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.srt-card-icon,
.srt-reveal-icon {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  image-rendering: pixelated;
  object-fit: contain;
}

.srt-card-value {
  flex: 0 0 auto;
  font-family: 'RuneScape Small', Arial, sans-serif;
  color: var(--osrs-cyan);
}

.srt-card-grip {
  flex: 0 0 auto;
  color: #6f6552;
  font-size: 1.3rem;
  line-height: 1;
}

.srt-card.srt-selected {
  border-color: var(--osrs-cyan);
  background: #24312f;
}

.srt-card.srt-dragging {
  transition: none;
  z-index: 10;
  cursor: grabbing;
  border-color: var(--osrs-gold);
  box-shadow: inset 0 0 0 1px var(--osrs-black), 0 6px 16px rgba(0, 0, 0, 0.6);
}

.srt-card.srt-locked {
  background: #1e3320;
  border-color: #2f7a35;
  cursor: default;
}

.srt-card.srt-locked .srt-card-pos {
  border-color: #2f7a35;
  color: #7ade7f;
}

.srt-card.srt-locked .srt-card-name {
  color: #a8e6ab;
}

.srt-card.srt-locked .srt-card-grip {
  visibility: hidden;
}

@keyframes srt-lock-pulse {
  0% { box-shadow: inset 0 0 0 1px var(--osrs-black), 0 0 0 0 rgba(122, 222, 127, 0.7); }
  100% { box-shadow: inset 0 0 0 1px var(--osrs-black), 0 0 0 12px rgba(122, 222, 127, 0); }
}

.srt-card.srt-just-locked {
  animation: srt-lock-pulse 0.7s ease-out;
}

/* ── Controls ── */
.srt-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
}

.srt-guess-pips {
  display: flex;
  gap: 6px;
}

.srt-pip {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--osrs-gold);
  background: transparent;
}

.srt-pip-used {
  background: #55401a;
  border-color: #6f6552;
}

.srt-submit {
  min-width: 150px;
}

/* ── Guess history squares ── */
.srt-history {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: center;
}

.srt-history-row {
  display: flex;
  gap: 5px;
}

.srt-square {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 1px solid var(--osrs-black);
}

.srt-square-green { background: #3f9d46; }
.srt-square-dark { background: #2a2824; }

/* ── Modals ── */
.srt-dialog {
  position: relative;
  max-width: 440px;
}

.srt-help-green {
  color: #7ade7f;
}

.srt-result-sub {
  color: var(--osrs-cyan);
  font-family: 'RuneScape Small', Arial, sans-serif;
}

.srt-reveal {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 10px 0;
}

.srt-reveal-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  background: #1f1e1b;
  border: 1px solid var(--osrs-ui-border);
  border-radius: 5px;
}

.srt-reveal-pos {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #2f7a35;
  border-radius: 50%;
  color: #7ade7f;
  font-family: 'RuneScape Bold', Arial, sans-serif;
  font-size: 0.85rem;
}

.srt-reveal-name {
  flex: 1 1 auto;
  color: var(--osrs-yellow);
}

.srt-reveal-value {
  flex: 0 0 auto;
  color: var(--osrs-cyan);
  font-family: 'RuneScape Small', Arial, sans-serif;
}

.srt-result-grid {
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: center;
  margin: 10px 0;
}

.srt-result-actions {
  justify-content: center;
  margin-top: 14px;
}

/* Extra specificity needed: shared styles.css has `.modal .dialog p { margin: 0 0 8px }` */
.modal .dialog p.srt-countdown {
  text-align: center;
  margin: 22px 0 0;
}

/* ── Community results (result modal) ── */
.srt-community {
  margin: 16px 0 4px;
}

.srt-community-title {
  color: var(--osrs-gold);
  font-family: 'RuneScape Bold', Arial, sans-serif;
  font-size: 1rem;
  margin: 0 0 8px;
  text-align: center;
}

.srt-community-bars {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.srt-community-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.srt-community-key {
  flex: 0 0 16px;
  text-align: center;
  font-family: 'RuneScape Bold', Arial, sans-serif;
  color: #c9b88a;
}

.srt-community-track {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 7px;
}

.srt-community-bar {
  display: block;
  /* Shrinks when the "You" label needs room so it can never overflow the modal */
  flex: 0 1 auto;
  background: #3f9d46;
  border-radius: 3px;
  padding: 2px 8px;
  color: #0f2711;
  font-family: 'RuneScape Bold', Arial, sans-serif;
  font-size: 0.85rem;
  min-width: 14px;
  box-sizing: border-box;
  white-space: nowrap;
}

.srt-community-bar-x {
  background: #6f3030;
  color: #f0c9c9;
}

/* Player's own bucket keeps its green/red colour — just outlined in gold */
.srt-community-row-mine .srt-community-bar {
  box-shadow: 0 0 0 2px var(--osrs-gold);
}

.srt-community-you {
  flex: 0 0 auto;
  font-family: 'RuneScape Small', Arial, sans-serif;
  color: var(--osrs-gold);
  font-size: 0.85rem;
  white-space: nowrap;
}

/* ── Stats ── */
.srt-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 12px 0;
}

.srt-stat-cell {
  text-align: center;
  background: #1f1e1b;
  border: 1px solid var(--osrs-ui-border);
  border-radius: 5px;
  padding: 8px 4px;
}

.srt-stat-num {
  font-family: 'RuneScape Bold', Arial, sans-serif;
  color: var(--osrs-gold);
  font-size: 1.4rem;
}

.srt-stat-label {
  font-family: 'RuneScape Small', Arial, sans-serif;
  color: #c9b88a;
  font-size: 0.8rem;
}

.srt-dist-title {
  color: var(--osrs-gold);
  font-family: 'RuneScape Bold', Arial, sans-serif;
  margin: 12px 0 6px;
  font-size: 1rem;
}

.srt-dist {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.srt-dist-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.srt-dist-key {
  flex: 0 0 16px;
  text-align: center;
  font-family: 'RuneScape Bold', Arial, sans-serif;
  color: #c9b88a;
}

.srt-dist-bar {
  background: #3f9d46;
  border-radius: 3px;
  padding: 2px 8px;
  color: #0f2711;
  font-family: 'RuneScape Bold', Arial, sans-serif;
  font-size: 0.85rem;
  min-width: 14px;
  box-sizing: border-box;
}

.srt-dist-bar-x {
  background: #6f3030;
  color: #f0c9c9;
}

/* ── Toast ── */
.srt-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1c1a16;
  border: 2px solid var(--osrs-gold);
  border-radius: 6px;
  color: var(--osrs-yellow);
  padding: 8px 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 1100;
  font-family: 'RuneScape Small', Arial, sans-serif;
}

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

/* ── Entry screen ── */
body:has(#srt-entry-screen:not([hidden])) .site-nav {
  position: relative;
  z-index: 1001;
}

.srt-entry-modal {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
  box-sizing: border-box;
}

.srt-entry-modal[hidden] {
  display: none !important;
}

.srt-entry-dialog {
  width: min(440px, 92vw);
  padding: 22px 20px 20px;
  background: var(--osrs-ui-bg);
  border: 2px solid var(--osrs-ui-border);
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  text-align: center;
}

.srt-entry-title {
  font-family: 'Quill 8', 'RuneScape Bold', Arial, serif;
  color: var(--osrs-gold);
  font-size: 58px;
  margin: 0 0 8px;
  text-shadow: 2px 2px 0 var(--osrs-black);
}

.srt-entry-sub {
  margin: 0 0 18px;
  font-size: 0.98rem;
  line-height: 1.4;
  color: rgba(255, 207, 63, 0.92);
  font-family: 'RuneScape', Arial, sans-serif;
}

.srt-entry-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.srt-entry-btn-play {
  width: 100%;
  padding: 14px 20px;
  font-size: 1.25rem;
}

.srt-entry-btn-archive,
.srt-entry-btn-help {
  width: 100%;
}

/* ── Archive ── */
.srt-archive-dialog {
  max-height: min(80vh, 560px);
  display: flex;
  flex-direction: column;
}

.srt-archive-lead {
  margin-bottom: 12px;
}

.srt-archive-list {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: min(50vh, 400px);
}

.srt-archive-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  text-align: left;
  background: #1f1e1b;
  border: 1px solid var(--osrs-ui-border);
  border-radius: 6px;
  color: var(--osrs-yellow);
  font-family: 'RuneScape Bold', Arial, sans-serif;
  cursor: pointer;
}

.srt-archive-item:hover {
  border-color: var(--osrs-gold);
  background: #262420;
}

.srt-archive-num {
  flex: 0 0 auto;
  color: var(--osrs-gold);
  font-family: 'RuneScape Bold', Arial, sans-serif;
}

.srt-archive-prompt {
  flex: 1 1 auto;
  font-size: 0.95rem;
  line-height: 1.35;
}

.srt-archive-detail-prompt {
  color: var(--osrs-yellow);
  margin-bottom: 10px;
}

.srt-back-today {
  text-align: center;
  margin: 4px 0 12px;
}

.modal .dialog p.srt-result-archive {
  text-align: center;
  margin: 14px 0 0;
}

.srt-back-today a,
.modal .dialog p.srt-result-archive a {
  color: var(--osrs-cyan);
  font-family: 'RuneScape Bold', Arial, sans-serif;
  text-decoration: underline;
}

.srt-back-today a:hover,
.modal .dialog p.srt-result-archive a:hover {
  color: var(--osrs-gold);
}

/* ── Mobile ── */
@media (max-width: 480px) {
  .srt-title { font-size: 42px; }
  .srt-card-name { font-size: 0.95rem; }
  .srt-card-value { font-size: 0.8rem; }
  .srt-submit { min-width: 130px; }
}
