/* ドラぽか アドバイザー — カード描画・グリッド */

.dorapoka-card-grid-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dorapoka-card-grid {
  display: grid;
  grid-template-columns: repeat(13, minmax(0, 1fr));
  gap: 4px;
}

.dorapoka-deck-edit-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 0;
}

.dorapoka-deck-edit-label {
  font-size: 10px;
  font-weight: 700;
  line-height: 1.1;
  text-align: center;
}

.dorapoka-count-label {
  font-size: 10px;
  color: #94a3b8;
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.dorapoka-deck-count {
  width: 2.5rem;
  min-height: 36px;
  border-radius: 4px;
  border: 1px solid #475569;
  background: #0f172a;
  color: #e2e8f0;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
}

.dorapoka-suit-expanded {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.dorapoka-suit-row-label {
  font-size: 18px;
  font-weight: 700;
  min-width: 1.25rem;
  padding-top: 12px;
  flex-shrink: 0;
}

.dorapoka-deck-expanded {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

@media (max-width: 640px) {
  .dorapoka-card-grid {
    gap: 3px;
  }

  .dorapoka-deck-expanded {
    gap: 3px;
  }
}

.dorapoka-card-btn {
  min-height: 44px;
  min-width: 0;
  border-radius: 6px;
  border: 2px solid #475569;
  background: linear-gradient(145deg, #1e293b 0%, #0f172a 100%);
  color: #f8fafc;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.1;
  padding: 4px 2px;
  cursor: pointer;
  transition: border-color 0.12s, transform 0.08s, box-shadow 0.12s;
  touch-action: manipulation;
  user-select: none;
}

.dorapoka-card-btn.tile {
  position: relative;
  width: 43px;
  min-width: 43px;
  flex-shrink: 0;
}

.dorapoka-card-btn:active {
  transform: scale(0.96);
}

.dorapoka-card-btn.selected {
  border-color: #fbbf24;
  box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.35);
  background: linear-gradient(145deg, #422006 0%, #1e293b 100%);
}

.dorapoka-card-btn.selected.locked {
  box-shadow:
    0 0 0 2px rgba(251, 191, 36, 0.55),
    inset 0 -3px 0 rgba(180, 83, 9, 0.85);
  cursor: default;
}

.dorapoka-card-btn.selected.locked::after {
  content: '🔒';
  position: absolute;
  top: 1px;
  right: 2px;
  font-size: 8px;
  line-height: 1;
  opacity: 0.85;
}

.dorapoka-card-btn.disabled {
  opacity: 0.35;
  pointer-events: none;
}

.dorapoka-hand-action-btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
  filter: saturate(0.55);
}

.dorapoka-card-btn .card-lv {
  display: block;
  font-size: 9px;
  font-weight: 600;
  color: #94a3b8;
  margin-top: 2px;
}

.dorapoka-lv-cell {
  min-width: 0;
}

.dorapoka-lv-cell input {
  min-height: 36px;
}

/*
 * iOS Safari: フォーカス時の自動ズーム回避（/orbs/ 検索バー・growth 絞り込みと同型）
 */
@media (max-width: 640px) {
  .dorapoka-ios-input-wrap {
    overflow: hidden;
    display: flex;
    align-items: center;
    align-self: stretch;
    min-width: 0;
    min-height: 2rem;
    height: 2rem;
    max-height: 2rem;
  }

  .dorapoka-ios-input-wrap .dorapoka-ios-input {
    box-sizing: border-box;
    font-size: 16px !important;
    line-height: 1.25rem !important;
    height: 2rem !important;
    width: 100% !important;
    max-width: 100% !important;
    transform: none !important;
    margin: 0 !important;
    min-height: 2rem !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
  }

  .dorapoka-ios-input-wrap .dorapoka-ios-input::placeholder {
    font-size: 14px !important;
    line-height: 1.25rem;
    opacity: 0.72;
  }

  .dorapoka-lv-cell .dorapoka-ios-input-wrap {
    width: 100%;
  }
}

.dorapoka-profile-bulk-btn {
  touch-action: manipulation;
}

.dorapoka-lv-cell .dorapoka-profile-atk {
  display: block;
  font-size: 9px;
  font-weight: 700;
  color: #94a3b8;
  text-align: center;
  margin-top: 2px;
  line-height: 1.2;
}

.dorapoka-profile-role-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 3.5rem 4.5rem 4.5rem;
  align-items: center;
  gap: 0.35rem 0.5rem;
  padding: 0.35rem 0.25rem;
  border-bottom: 1px solid #1e293b;
}

.dorapoka-profile-role-head {
  grid-template-columns: minmax(0, 1fr) 3.5rem 4.5rem 4.5rem;
}

.dorapoka-profile-stat {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.15rem;
  font-size: 11px;
  font-weight: 700;
  color: #cbd5e1;
  font-variant-numeric: tabular-nums;
}

.dorapoka-info-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 1.1rem;
  height: 1.1rem;
  padding: 0;
  border: none;
  border-radius: 9999px;
  background: rgba(148, 163, 184, 0.15);
  color: #94a3b8;
  font-size: 0.65rem;
  line-height: 1;
  cursor: help;
  touch-action: manipulation;
}

.dorapoka-info-mark:hover,
.dorapoka-info-mark:focus-visible {
  background: rgba(14, 165, 233, 0.2);
  color: #7dd3fc;
  outline: none;
}

.dorapoka-damage-expand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  padding: 0;
  border: none;
  border-radius: 0.25rem;
  background: rgba(251, 191, 36, 0.12);
  color: #fcd34d;
  font-size: 0.75rem;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
}

.dorapoka-damage-expand:hover,
.dorapoka-damage-expand:focus-visible {
  background: rgba(251, 191, 36, 0.22);
  outline: none;
}

.dorapoka-damage-breakdown {
  animation: dorapoka-damage-expand-in 0.12s ease-out;
}

@keyframes dorapoka-damage-expand-in {
  from {
    opacity: 0;
    transform: translateY(-2px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dorapoka-card-btn .rank {
  display: block;
}

/* ♥ ピンク / ♦ 青 / ♣ 黄緑 / ♠ グレー */
.dorapoka-card-btn.suit-h .rank,
.dorapoka-card-btn.suit-h .suit,
.dorapoka-suit-h {
  color: #f9a8d4;
}

.dorapoka-card-btn.suit-d .rank,
.dorapoka-card-btn.suit-d .suit,
.dorapoka-suit-d {
  color: #60a5fa;
}

.dorapoka-card-btn.suit-c .rank,
.dorapoka-card-btn.suit-c .suit,
.dorapoka-suit-c {
  color: #bef264;
}

.dorapoka-card-btn.suit-s .rank,
.dorapoka-card-btn.suit-s .suit,
.dorapoka-suit-s {
  color: #94a3b8;
}

.dorapoka-current-hand {
  --dorapoka-role-hand-width: 390px;
  --dorapoka-role-card-gap: 4px;
  --dorapoka-role-card-w: calc(
    (var(--dorapoka-role-hand-width) - 9 * var(--dorapoka-role-card-gap)) / 10
  );
  display: flex;
  flex-wrap: wrap;
  gap: var(--dorapoka-role-card-gap);
  align-items: flex-start;
  max-width: var(--dorapoka-role-hand-width);
}

.dorapoka-role-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  width: var(--dorapoka-role-card-w);
  height: calc(var(--dorapoka-role-card-w) * 1.45);
  padding: 4px 2px 3px;
  border-radius: 5px;
  border: 1.5px solid #475569;
  background: linear-gradient(160deg, #243044 0%, #111827 55%, #0b1220 100%);
  box-shadow:
    0 1px 3px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  font-weight: 800;
  line-height: 1;
  user-select: none;
  transition: transform 0.08s ease;
}

.dorapoka-role-card .role-card-rank {
  font-size: 13px;
  letter-spacing: -0.02em;
}

.dorapoka-role-card .role-card-suit {
  font-size: 11px;
}

.dorapoka-role-card.keep {
  border-color: #fbbf24;
  background: linear-gradient(160deg, #5c3a0a 0%, #2a1f0f 45%, #1e293b 100%);
  box-shadow:
    0 2px 5px rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(251, 191, 36, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.dorapoka-role-card.locked {
  border-color: #fbbf24;
  background: linear-gradient(160deg, #5c3a0a 0%, #2a1f0f 45%, #1e293b 100%);
  box-shadow:
    0 2px 5px rgba(0, 0, 0, 0.35),
    inset 0 -3px 0 rgba(180, 83, 9, 0.85),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.dorapoka-role-card.locked::after {
  content: '🔒';
  position: absolute;
  top: 1px;
  right: 2px;
  font-size: 7px;
  line-height: 1;
  opacity: 0.9;
}

.dorapoka-role-card.discard-mark {
  border-color: #f87171;
  background: linear-gradient(160deg, #7f1d1d 0%, #450a0a 45%, #1e293b 100%);
  box-shadow:
    0 2px 5px rgba(0, 0, 0, 0.35),
    0 0 0 2px rgba(248, 113, 113, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.dorapoka-role-card.discard-mark .role-card-rank,
.dorapoka-role-card.discard-mark .role-card-suit {
  opacity: 0.82;
}

.dorapoka-mini-card {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid #64748b;
  background: #1e293b;
  font-size: 11px;
  font-weight: 700;
}

.dorapoka-mini-card.keep {
  border-color: #fbbf24;
  background: #422006;
}

.dorapoka-mini-card.locked {
  border-color: #fbbf24;
  background: #422006;
  box-shadow: inset 0 -2px 0 rgba(180, 83, 9, 0.85);
}

.dorapoka-mini-card-btn.is-locked {
  cursor: default;
}

.dorapoka-mini-card.discard {
  opacity: 0.45;
  text-decoration: line-through;
}

.dorapoka-prob-bar {
  height: 6px;
  border-radius: 3px;
  background: #334155;
  overflow: hidden;
}

.dorapoka-prob-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #0ea5e9, #22d3ee);
  border-radius: 3px;
  transition: width 0.2s;
}

.dorapoka-card-btn.discarded {
  opacity: 0.28;
  filter: grayscale(0.9);
  pointer-events: none;
  border-color: #334155;
}

.dorapoka-mini-card.discard-mark {
  border-color: #f87171;
  background: #450a0a;
  box-shadow: 0 0 0 2px rgba(248, 113, 113, 0.35);
}

.dorapoka-mini-card.need {
  border-color: #38bdf8;
  border-style: dashed;
  background: #0c4a6e;
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.25);
}

.dorapoka-mini-card.wildcard {
  border-color: #facc15;
  color: #fde047;
  background: #422006;
  font-size: 13px;
  line-height: 1;
}

.dorapoka-mini-card.wildcard.need {
  border-color: #facc15;
  border-style: dashed;
  background: #422006;
  color: #fde047;
  box-shadow: 0 0 0 1px rgba(250, 204, 21, 0.25);
}

.dorapoka-mini-card.need-x {
  font-size: 9px;
  color: #7dd3fc;
  margin-left: 1px;
}

.dorapoka-prob-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  padding: 0.1rem 0.35rem;
  margin: -0.1rem -0.35rem;
  border: none;
  border-radius: 0.25rem;
  background: transparent;
  color: #7dd3fc;
  font-weight: 800;
  font-size: inherit;
  line-height: 1.2;
  cursor: pointer;
  touch-action: manipulation;
  text-decoration: underline dotted rgba(125, 211, 252, 0.45);
  text-underline-offset: 2px;
}

.dorapoka-prob-trigger:hover,
.dorapoka-prob-trigger:focus-visible {
  background: rgba(14, 165, 233, 0.12);
  outline: none;
}

.dorapoka-prob-trigger-lg {
  font-size: 1.125rem;
  padding: 0.15rem 0.4rem;
}

.dorapoka-prob-trigger-sm {
  font-size: 0.75rem;
  font-weight: 700;
}

.dorapoka-prob-trigger-hint {
  font-size: 0.65em;
  font-weight: 400;
  opacity: 0.55;
  text-decoration: none;
}

.dorapoka-prob-dialog {
  max-width: min(92vw, 28rem);
  width: calc(100% - 2rem);
  padding: 0;
  border: 1px solid #334155;
  border-radius: 0.5rem;
  background: #0f172a;
  color: #cbd5e1;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.65);
}

.dorapoka-prob-dialog[open] {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
}

.dorapoka-prob-dialog::backdrop {
  background: rgba(2, 6, 23, 0.72);
}

.dorapoka-prob-dialog-inner {
  padding: 0.875rem 1rem 1rem;
}

.dorapoka-prob-dialog-close {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: 0.375rem;
  background: #1e293b;
  color: #94a3b8;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.dorapoka-prob-dialog-close:hover {
  background: #334155;
  color: #e2e8f0;
}

.dorapoka-mini-card-btn,
.dorapoka-role-card-btn {
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  touch-action: manipulation;
}

.dorapoka-role-card-btn:not(:disabled):active .dorapoka-role-card {
  transform: scale(0.96);
}

.dorapoka-role-card-btn.is-locked {
  cursor: default;
}

.dorapoka-mini-card-btn:disabled,
.dorapoka-role-card-btn:disabled {
  cursor: default;
}
.dorapoka-help-panel[hidden] {
  display: none !important;
}
