/**
 * My RPG Source - Ability Score Builder
 * --------------------------------------
 * Screen interaction styles for generated-score assignment
 * and the 27-point Point Buy dialog.
 */


/* ==========================================================
   SCORE TRAY AND STAT WORKSPACE
   ========================================================== */

.ability-score-workspace {
  width: 100%;

  display: grid;

  grid-template-columns:
    76px minmax(0, 1fr);

  align-items: stretch;

  gap: 6px;
}

.ability-score-workspace
.stats-grid {
  min-width: 0;
}

.ability-score-hidden-storage {
  display: none;
}

.ability-score-tray {
  min-width: 0;
  padding: 4px;

  background:
    rgba(139, 69, 19, 0.055);

  border:
    1px solid
    var(
      --border-color,
      #5c4033
    );

  border-radius: 4px;
}

.ability-score-tray[hidden] {
  display: none;
}

.ability-score-tray[hidden]
+
.stats-grid {
  grid-column:
    1 / -1;
}

.ability-score-tray-title {
  margin-bottom: 4px;

  color:
    var(
      --accent-color,
      #8b4513
    );

  font-family:
    "Cinzel", serif;

  font-size: 7px;
  font-weight: 700;

  letter-spacing: 0.04em;
  text-align: center;
  text-transform: uppercase;
}

.ability-score-token-list {
  display: grid;

  grid-template-columns:
    repeat(
      2,
      minmax(0, 1fr)
    );

  gap: 3px;
}

.ability-score-token {
  min-width: 0;
  padding: 3px 1px;

  display: flex;
  flex-direction: column;
  align-items: center;

  gap: 0;

  background:
    var(
      --input-bg,
      rgba(255, 255, 255, 0.72)
    );

  color:
    var(
      --text-main,
      #2c221e
    );

  border:
    1px solid
    var(
      --border-color,
      #5c4033
    );

  border-radius: 4px;

  font-family: inherit;

  cursor: grab;

  touch-action: manipulation;
}

.ability-score-token:active {
  cursor: grabbing;
}

.ability-score-token strong {
  font-size: 12px;
  line-height: 1;
}

.ability-score-token span {
  margin-top: 1px;

  font-size: 6px;
  line-height: 1;

  opacity: 0.72;
}

.ability-score-token.assigned {
  background:
    rgba(46, 125, 50, 0.12);
}

.ability-score-token.selected {
  outline:
    2px solid
    var(
      --accent-color,
      #8b4513
    );

  outline-offset:
    1px;

  transform:
    translateY(-1px);
}

.ability-score-tray-message {
  min-height: 22px;
  margin-top: 4px;

  display: flex;
  align-items: center;
  justify-content: center;

  color:
    var(
      --text-main,
      #2c221e
    );

  font-size: 6.5px;
  line-height: 1.15;
  text-align: center;

  opacity: 0.72;
}

.ability-score-clear-btn {
  width: 100%;
  margin-top: 3px;
  padding: 2px;

  background: transparent;

  color:
    var(
      --accent-color,
      #8b4513
    );

  border:
    1px solid
    var(
      --border-color,
      #5c4033
    );

  border-radius: 3px;

  font-family:
    "Cinzel", serif;

  font-size: 6.5px;

  cursor: pointer;
}

.stat-row.score-drop-ready {
  cursor: copy;
}

.stat-row.score-drop-ready
.stat-val {
  border-style: dashed;
}

.stat-row.drag-over {
  background:
    rgba(46, 125, 50, 0.14);

  outline:
    2px solid
    rgba(46, 125, 50, 0.5);

  outline-offset:
    1px;
}

.stat-row.score-assigned
.stat-val {
  background:
    rgba(46, 125, 50, 0.09);
}

.stat-val[readonly] {
  cursor: pointer;
}


/* ==========================================================
   POINT BUY MODAL
   ========================================================== */

body.point-buy-open {
  overflow: hidden;
}

.point-buy-backdrop {
  position: fixed;
  inset: 0;

  z-index: 12000;

  padding: 18px;

  display: flex;
  align-items: center;
  justify-content: center;

  background:
    rgba(10, 14, 18, 0.72);

  backdrop-filter:
    blur(2px);
}

.point-buy-backdrop[hidden] {
  display: none;
}

.point-buy-dialog {
  width:
    min(
      520px,
      100%
    );

  max-height:
    calc(100vh - 36px);

  overflow-y: auto;

  padding: 18px;

  background:
    var(
      --bg-sheet,
      #f4ecd8
    );

  color:
    var(
      --text-main,
      #2c221e
    );

  border:
    2px solid
    var(
      --border-color,
      #5c4033
    );

  border-radius: 14px;

  box-shadow:
    0 24px 70px
    rgba(0, 0, 0, 0.45);
}

.point-buy-header {
  padding-bottom: 12px;

  display: flex;
  align-items: flex-start;
  justify-content: space-between;

  gap: 16px;

  border-bottom:
    1px solid
    rgba(92, 64, 51, 0.28);
}

.point-buy-header h2 {
  margin: 0 0 4px;

  color:
    var(
      --accent-color,
      #8b4513
    );

  font-family:
    "Cinzel", serif;

  font-size: 20px;
}

.point-buy-header p {
  margin: 0;

  font-size: 12px;
  line-height: 1.4;

  opacity: 0.75;
}

.point-buy-counter {
  min-width: 120px;
  padding: 8px 10px;

  display: flex;
  flex-direction: column;
  align-items: center;

  background:
    rgba(139, 69, 19, 0.08);

  border:
    1px solid
    rgba(139, 69, 19, 0.24);

  border-radius: 10px;

  text-align: center;
}

.point-buy-counter span {
  font-family:
    "Cinzel", serif;

  font-size: 9px;
  font-weight: 700;

  text-transform: uppercase;
}

.point-buy-counter strong {
  margin-top: 2px;

  color:
    var(
      --accent-color,
      #8b4513
    );

  font-size: 25px;
  line-height: 1;
}

.point-buy-counter
strong[data-status="complete"] {
  color: #2e7d32;
}

.point-buy-rows {
  margin-top: 12px;

  display: grid;

  gap: 7px;
}

.point-buy-row {
  display: grid;

  grid-template-columns:
    minmax(110px, 1fr)
    36px
    42px
    36px
    76px;

  align-items: center;

  gap: 7px;
}

.point-buy-label {
  font-family:
    "Cinzel", serif;

  font-size: 12px;
  font-weight: 700;
}

.point-buy-step {
  width: 36px;
  height: 32px;

  padding: 0;

  background:
    rgba(139, 69, 19, 0.11);

  color:
    var(
      --text-main,
      #2c221e
    );

  border:
    1px solid
    var(
      --border-color,
      #5c4033
    );

  border-radius: 6px;

  font-size: 19px;
  line-height: 1;

  cursor: pointer;
}

.point-buy-step:disabled {
  cursor: not-allowed;

  opacity: 0.3;
}

.point-buy-value {
  font-size: 19px;
  font-weight: 700;
  text-align: center;
}

.point-buy-cost {
  font-size: 10px;

  opacity: 0.72;
}

.point-buy-message {
  min-height: 20px;
  margin-top: 11px;

  color:
    var(
      --accent-color,
      #8b4513
    );

  font-size: 11px;
  text-align: center;
}

.point-buy-actions {
  margin-top: 12px;
  padding-top: 12px;

  display: flex;
  align-items: center;

  gap: 8px;

  border-top:
    1px solid
    rgba(92, 64, 51, 0.28);
}

.point-buy-action-spacer {
  flex: 1;
}

.point-buy-actions button {
  min-height: 36px;
  padding: 7px 13px;

  border-radius: 7px;

  font-family:
    "Cinzel", serif;

  font-size: 11px;
  font-weight: 700;

  cursor: pointer;
}

.point-buy-secondary {
  background: transparent;

  color:
    var(
      --text-main,
      #2c221e
    );

  border:
    1px solid
    var(
      --border-color,
      #5c4033
    );
}

.point-buy-primary {
  background:
    var(
      --accent-color,
      #8b4513
    );

  color:
    var(
      --bg-sheet,
      #f4ecd8
    );

  border:
    1px solid
    var(
      --accent-color,
      #8b4513
    );
}


/* ==========================================================
   RESPONSIVE AND PRINT
   ========================================================== */

@media screen and (max-width: 500px) {
  .ability-score-workspace {
    grid-template-columns:
      1fr;
  }

  .ability-score-tray {
    grid-column:
      1 / -1;
  }

  .ability-score-token-list {
    grid-template-columns:
      repeat(
        6,
        minmax(0, 1fr)
      );
  }

  .ability-score-tray-message {
    min-height: 14px;
  }

  .point-buy-header {
    flex-direction: column;
  }

  .point-buy-counter {
    width: 100%;
  }

  .point-buy-row {
    grid-template-columns:
      minmax(90px, 1fr)
      34px
      38px
      34px;
  }

  .point-buy-cost {
    grid-column:
      1 / -1;

    text-align: right;
  }

  .point-buy-actions {
    flex-wrap: wrap;
  }

  .point-buy-action-spacer {
    display: none;
  }

  .point-buy-actions button {
    flex: 1;
  }
}

@media print {
  .ability-score-workspace {
    display: block !important;
  }

  .ability-score-tray,
  .point-buy-backdrop {
    display: none !important;
  }
}
