/* RPG Widget — estilos do widget
 * Arquivo independente do build. Edite aqui e suba apenas este arquivo.
 * Enfileirado pelo plugin via wp_enqueue_style (class-assets.php).
 */

/* Scoped reset — não afeta o tema global (Divi, etc.) */
#game-root, #game-root *, #game-root *::before, #game-root *::after {
  box-sizing: border-box;
}

.rpg-widget {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 99999;
  font-size: 16px;
  line-height: 1.5;
  font-family: 'Source Sans 3', Arial, sans-serif;
}

/* ── FAB ── */
.rpg-fab {
  width: 60px; height: 60px;
  border: 0; border-radius: 999px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; color: #fff7ed;
  background: linear-gradient(180deg, #f59e0b 0%, #b45309 100%);
  box-shadow: 0 14px 30px rgba(0,0,0,.35);
  transition: transform .16s, filter .16s;
}
.rpg-fab:hover  { filter: brightness(1.06); transform: translateY(-1px); }
.rpg-fab:active { transform: scale(.95); }

/* ── Panel ── */
.rpg-panel {
  position: fixed;
  right: 24px; bottom: 100px;
  width: min(380px, calc(100vw - 32px));
  height: min(82vh, 720px);
  background: #0f172a; color: #e5e7eb;
  border: 1px solid rgba(148,163,184,.22);
  border-radius: 12px;
  display: flex; flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(2,6,23,.6);
  opacity: 0; transform: translateY(18px) scale(.98);
  pointer-events: none;
  transition: opacity .22s, transform .22s;
}
.rpg-panel.is-open {
  opacity: 1; transform: translateY(0) scale(1); pointer-events: auto;
}

/* ── Panel header ── */
.rpg-panel-header {
  flex-shrink: 0;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 18px 18px 0;
}
.rpg-header-title-row {
  display: flex; align-items: center; gap: 7px;
}
.rpg-panel-title    { margin: 0; font-size: 20px; line-height: 1.1; color: #f8fafc; font-family: 'Cinzel', serif; }
.rpg-panel-subtitle { margin: 4px 0 0; color: #475569; font-size: 13px; }

.rpg-btn-switch {
  flex-shrink: 0;
  background: none; border: none;
  cursor: pointer; padding: 2px 3px; border-radius: 6px;
  font-size: 15px; line-height: 1;
  transition: transform .25s ease, opacity .16s;
  opacity: .65;
}
.rpg-btn-switch:hover  { opacity: 1; }
.rpg-btn-switch.open   { transform: rotate(180deg); opacity: 1; }

.rpg-btn-close {
  flex-shrink: 0;
  width: 34px; height: 34px;
  border: 0; border-radius: 999px;
  background: rgba(148,163,184,.1);
  color: #64748b; cursor: pointer;
  font-size: 20px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: background .16s, color .16s, transform .16s;
}
.rpg-btn-close:hover  { background: rgba(148,163,184,.2); color: #f1f5f9; }
.rpg-btn-close:active { transform: scale(.92); }

/* ── Tabs ── */
.rpg-tabs {
  flex-shrink: 0;
  display: flex;
  padding: 14px 18px 0;
  border-bottom: 1px solid rgba(148,163,184,.1);
}
.rpg-tab {
  flex: 1; padding: 8px 4px 10px;
  background: none; border: none;
  border-bottom: 2px solid transparent;
  color: #475569;
  font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .6px;
  cursor: pointer; font-family: inherit;
  transition: color .16s, border-color .16s;
}
.rpg-tab:hover { color: #94a3b8; }
.rpg-tab.active { color: #fbbf24; border-bottom-color: #f59e0b; }

/* ── Scrollable content ── */
.rpg-panel-content {
  flex: 1; min-height: 0;
  overflow-y: auto;
  padding: 14px 18px 18px;
  scrollbar-width: thin;
  scrollbar-color: rgba(180,83,9,.7) rgba(15,23,42,.4);
}
.rpg-panel-content::-webkit-scrollbar       { width: 5px; }
.rpg-panel-content::-webkit-scrollbar-track {
  background: rgba(15,23,42,.4); border-radius: 999px; margin: 6px 0;
}
.rpg-panel-content::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #fbbf24, #b45309); border-radius: 999px;
}
.rpg-panel-content::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #fcd34d, #d97706);
}

/* ── Char picker ── */
.rpg-char-picker-title {
  margin: 0 0 12px;
  color: #475569; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .8px;
}
.rpg-char-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.rpg-char-card {
  display: flex; flex-direction: column; gap: 5px;
  padding: 14px 12px;
  border-radius: 14px;
  background: rgba(30,41,59,.8);
  border: 2px solid rgba(148,163,184,.1);
  cursor: pointer; text-align: left; font-family: inherit;
  transition: border-color .18s, background .18s;
}
.rpg-char-card:hover:not(:disabled) {
  border-color: rgba(245,158,11,.35);
  background: rgba(30,41,59,1);
}
.rpg-char-card.active {
  border-color: #f59e0b;
  background: rgba(245,158,11,.06);
  cursor: default;
}
.rpg-char-card:disabled { opacity: .55; cursor: not-allowed; }
.rpg-char-card-switch-btn {
  margin-top: 10px;
  width: 100%;
  padding: 6px 8px;
  border: 1px solid rgba(245,158,11,.3);
  border-radius: 8px;
  background: rgba(245,158,11,.08);
  color: #fbbf24;
  font-size: 12px; font-weight: 700; font-family: inherit;
  cursor: pointer;
  transition: background .16s, border-color .16s;
}
.rpg-char-card-switch-btn:hover:not(:disabled) {
  background: rgba(245,158,11,.18);
  border-color: rgba(245,158,11,.55);
}
.rpg-char-card-switch-btn:disabled { opacity: .45; cursor: not-allowed; }
.rpg-char-card-name  { color: #f1f5f9; font-size: 15px; font-weight: 700; }
.rpg-char-card-stats { color: #475569; font-size: 12px; margin-top: 2px; }
.rpg-char-card-badge {
  display: inline-block; align-self: flex-start; margin-top: 4px;
  padding: 2px 7px; border-radius: 6px;
  background: rgba(245,158,11,.12);
  border: 1px solid rgba(245,158,11,.28);
  color: #fbbf24; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .4px;
}

/* ── Sections ── */
.rpg-section {
  margin-top: 12px; padding: 14px;
  border-radius: 16px;
  background: rgba(15,23,42,.72);
  border: 1px solid rgba(148,163,184,.1);
}
.rpg-section:first-child { margin-top: 0; }
.rpg-section-title {
  margin: 0 0 10px;
  color: #475569; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .8px;
}

/* ── Rows ── */
.rpg-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 9px 12px; border-radius: 10px;
  background: rgba(30,41,59,.72); margin-top: 6px;
}
.rpg-row:first-of-type { margin-top: 0; }
.rpg-label { color: #cbd5e1; font-size: 14px; }
.rpg-value { color: #fbbf24; font-size: 14px; font-weight: 700; }

/* ── Resource bars ── */
.rpg-resource {
  margin-top: 6px; padding: 10px 12px;
  border-radius: 10px; background: rgba(30,41,59,.72);
}
.rpg-resource:first-of-type { margin-top: 0; }
.rpg-resource-header { display: flex; justify-content: space-between; margin-bottom: 6px; }
.rpg-resource-label  { color: #cbd5e1; font-size: 14px; }
.rpg-resource-value  { color: #fbbf24; font-size: 13px; font-weight: 700; }
.rpg-bar-track {
  height: 6px; border-radius: 999px;
  background: rgba(148,163,184,.15); overflow: hidden;
}
.rpg-bar-fill { height: 100%; border-radius: 999px; transition: width .4s ease; }
.rpg-bar-pv { background: linear-gradient(90deg, #ef4444, #f97316); }
.rpg-bar-pm { background: linear-gradient(90deg, #3b82f6, #8b5cf6); }

/* ── Item row ── */
.rpg-item-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 12px; border-radius: 10px;
  background: rgba(30,41,59,.72); margin-top: 6px;
}
.rpg-item-row:first-of-type { margin-top: 0; }
.rpg-item-name { color: #e2e8f0; font-size: 14px; }
.rpg-item-qty  {
  color: #fbbf24; font-size: 13px; font-weight: 700;
  background: rgba(245,158,11,.1); border: 1px solid rgba(245,158,11,.2);
  border-radius: 6px; padding: 2px 8px;
}

/* ── Local tab ── */
.rpg-local-reino-name {
  font-family: 'Cinzel', serif;
  font-size: 20px; font-weight: 700;
  color: #f8fafc; line-height: 1.2;
  margin-bottom: 8px;
}
.rpg-local-nome {
  font-size: 16px; font-weight: 700;
  color: #f1f5f9; margin-bottom: 8px;
}
.rpg-local-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.rpg-local-tag {
  padding: 2px 9px; border-radius: 6px;
  background: rgba(148,163,184,.1);
  border: 1px solid rgba(148,163,184,.18);
  color: #94a3b8; font-size: 11px; font-weight: 700;
  text-transform: capitalize; letter-spacing: .3px;
}
.rpg-local-breadcrumb {
  font-size: 12px; color: #334155; margin-bottom: 6px;
  display: flex; align-items: center; gap: 5px;
}
.rpg-local-breadcrumb-sep { color: #1e293b; }
.rpg-local-desc {
  margin: 10px 0 0;
  font-size: 13px; color: #64748b; line-height: 1.55;
}

/* ── Adventure choice buttons ── */
.rpg-btn-choice {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  width: 100%; margin-top: 8px;
  padding: 12px 14px;
  border: 1px solid rgba(148,163,184,.18);
  border-radius: 10px;
  background: rgba(30,41,59,.72);
  color: #e2e8f0; font-size: 14px; font-family: inherit;
  text-align: left; cursor: pointer;
  transition: border-color .16s, background .16s;
}
.rpg-btn-choice:first-of-type { margin-top: 0; }
.rpg-btn-choice:hover:not(:disabled) {
  border-color: rgba(245,158,11,.45);
  background: rgba(30,41,59,1);
}
.rpg-btn-choice:active:not(:disabled) { transform: scale(.99); }
.rpg-btn-choice:disabled { opacity: .45; cursor: not-allowed; }
.rpg-btn-choice-label { color: #f1f5f9; font-weight: 600; }
.rpg-btn-choice-hint  { color: #64748b; font-size: 12px; }

/* ── Adventure HUD list ── */
.rpg-adv-empty {
  font-size: 12px; color: #475569; padding: 6px 0 2px;
}
.rpg-adv-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  background: rgba(30,41,59,.6);
  border: 1px solid rgba(148,163,184,.12);
  border-radius: 10px;
  margin-top: 7px;
}
.rpg-adv-item:first-of-type { margin-top: 0; }
.rpg-adv-item-info { flex: 1; min-width: 0; }
.rpg-adv-item-title {
  color: #f1f5f9; font-size: 13px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rpg-adv-item-meta { color: #64748b; font-size: 11px; margin-top: 2px; }
.rpg-adv-btn {
  flex-shrink: 0;
  padding: 5px 11px;
  border-radius: 7px;
  border: 1px solid rgba(245,158,11,.4);
  background: rgba(245,158,11,.07);
  color: #fbbf24; font-size: 11px; font-weight: 700;
  cursor: pointer; transition: background .14s;
  white-space: nowrap;
}
.rpg-adv-btn:hover:not(:disabled) { background: rgba(245,158,11,.18); }
.rpg-adv-btn:disabled { opacity: .45; cursor: not-allowed; }
.rpg-adv-btn.primary {
  border-color: rgba(99,102,241,.4);
  background: rgba(99,102,241,.1);
  color: #a5b4fc;
}
.rpg-adv-btn.primary:hover:not(:disabled) { background: rgba(99,102,241,.22); }

/* ── Modal box (sem overlay — flutua livremente, arrastável e redimensionável) ── */
.rpg-modal {
  position: fixed;
  z-index: 99999;
  width: min(580px, 96vw);
  max-height: 84vh;
  display: flex; flex-direction: column;
  background: #0f172a;
  border: 1px solid rgba(245,158,11,.3);
  border-radius: 16px;
  box-shadow: 0 32px 96px rgba(0,0,0,.8),
              0 0 0 1px rgba(245,158,11,.1),
              inset 0 1px 0 rgba(255,255,255,.04);
  overflow: hidden;
}
.rpg-modal.is-dragging  { cursor: grabbing !important; user-select: none; }
.rpg-modal.is-resizing  { user-select: none; }

/* ── Alças de redimensionamento ── */
.rpg-resize-handle { position: absolute; z-index: 20; }
.rpg-resize-n  { top: 0;    left: 14px; right: 14px; height: 7px; cursor: ns-resize;   }
.rpg-resize-s  { bottom: 0; left: 14px; right: 14px; height: 7px; cursor: ns-resize;   }
.rpg-resize-e  { right: 0;  top: 14px; bottom: 14px; width:  7px; cursor: ew-resize;   }
.rpg-resize-w  { left: 0;   top: 14px; bottom: 14px; width:  7px; cursor: ew-resize;   }
.rpg-resize-nw { top: 0; left: 0;   width: 14px; height: 14px; cursor: nwse-resize; }
.rpg-resize-ne { top: 0; right: 0;  width: 14px; height: 14px; cursor: nesw-resize; }
.rpg-resize-sw { bottom: 0; left: 0;  width: 14px; height: 14px; cursor: nesw-resize; }
.rpg-resize-se { bottom: 0; right: 0; width: 14px; height: 14px; cursor: nwse-resize; }
/* Indicador visual nos cantos */
.rpg-resize-se::after, .rpg-resize-sw::after,
.rpg-resize-ne::after, .rpg-resize-nw::after {
  content: ''; position: absolute; width: 7px; height: 7px;
}
.rpg-resize-se::after { right: 3px;  bottom: 3px;  border-right:  2px solid rgba(245,158,11,.4); border-bottom: 2px solid rgba(245,158,11,.4); }
.rpg-resize-sw::after { left: 3px;   bottom: 3px;  border-left:   2px solid rgba(245,158,11,.4); border-bottom: 2px solid rgba(245,158,11,.4); }
.rpg-resize-ne::after { right: 3px;  top: 3px;     border-right:  2px solid rgba(245,158,11,.4); border-top:    2px solid rgba(245,158,11,.4); }
.rpg-resize-nw::after { left: 3px;   top: 3px;     border-left:   2px solid rgba(245,158,11,.4); border-top:    2px solid rgba(245,158,11,.4); }
/* Indicador visual nas bordas centrais */
.rpg-resize-e::after, .rpg-resize-w::after,
.rpg-resize-n::after, .rpg-resize-s::after {
  content: ''; position: absolute;
  background: rgba(245,158,11,.22); border-radius: 999px;
  transition: background .15s;
}
.rpg-resize-e:hover::after, .rpg-resize-w:hover::after,
.rpg-resize-n:hover::after, .rpg-resize-s:hover::after {
  background: rgba(245,158,11,.5);
}
.rpg-resize-e::after, .rpg-resize-w::after {
  top: 50%; transform: translateY(-50%); width: 3px; height: 28px; left: 2px;
}
.rpg-resize-n::after, .rpg-resize-s::after {
  left: 50%; transform: translateX(-50%); height: 3px; width: 28px; top: 2px;
}

/* ── Botão resetar tamanho/posição ── */
.rpg-modal-reset-btn {
  flex-shrink: 0;
  background: none; border: none;
  color: #64748b; font-size: 14px; line-height: 1;
  cursor: pointer; padding: 0 8px 0 0;
  transition: color .14s; opacity: .7;
}
.rpg-modal-reset-btn:hover { color: #f59e0b; opacity: 1; }

/* ── Modal Header ── */
.rpg-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 18px;
  background: linear-gradient(135deg, rgba(245,158,11,.1) 0%, rgba(15,23,42,.8) 100%);
  border-bottom: 1px solid rgba(245,158,11,.18);
  cursor: grab;
  user-select: none;
  flex-shrink: 0;
}
.rpg-modal.is-dragging .rpg-modal-header { cursor: grabbing; }
.rpg-modal-header-title {
  font-family: 'Cinzel', serif;
  font-size: 13px; font-weight: 700;
  color: #fbbf24; letter-spacing: .6px;
  text-transform: uppercase;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  flex: 1;
}
.rpg-modal-close {
  background: none; border: none;
  color: #475569; font-size: 22px; line-height: 1;
  cursor: pointer; padding: 0 0 0 12px;
  transition: color .14s; flex-shrink: 0;
}
.rpg-modal-close:hover { color: #f1f5f9; }

/* ── Modal Body ── */
.rpg-modal-body {
  flex: 1; overflow-y: auto;
  padding: 22px 22px 24px;
  scrollbar-width: thin;
  scrollbar-color: rgba(148,163,184,.15) transparent;
}
.rpg-modal-body::-webkit-scrollbar { width: 5px; }
.rpg-modal-body::-webkit-scrollbar-thumb { background: rgba(148,163,184,.15); border-radius: 3px; }

/* ── Scene image ── */
.rpg-modal-img-wrap {
  margin: -22px -22px 20px;
  overflow: hidden; max-height: 230px;
}
.rpg-modal-img {
  width: 100%; height: 230px;
  object-fit: cover; display: block;
}

/* ── Scene title ── */
.rpg-modal-scene-title {
  font-family: 'Cinzel', serif;
  font-size: 19px; font-weight: 700;
  color: #f8fafc; margin: 0 0 14px;
  letter-spacing: .2px; line-height: 1.3;
}

/* ── Narrative ── */
.rpg-modal-narrative {
  color: #cbd5e1; font-size: 15px;
  line-height: 1.8; margin: 0 0 20px;
}

/* ── Choices ── */
.rpg-modal-choices { margin-top: 2px; }
.rpg-modal-choice {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  width: 100%; margin-top: 9px;
  padding: 13px 16px;
  background: rgba(30,41,59,.65);
  border: 1px solid rgba(148,163,184,.14);
  border-radius: 11px;
  color: #e2e8f0; font-size: 14px; font-family: inherit;
  text-align: left; cursor: pointer;
  transition: border-color .15s, background .15s, transform .12s;
}
.rpg-modal-choice:first-of-type { margin-top: 0; }
.rpg-modal-choice:hover:not(:disabled) {
  border-color: rgba(245,158,11,.45);
  background: rgba(30,41,59,1);
  transform: translateX(3px);
}
.rpg-modal-choice:active:not(:disabled) { transform: translateX(1px); }
.rpg-modal-choice:disabled { opacity: .38; cursor: not-allowed; }
.rpg-modal-choice.locked  { opacity: .45; }
.rpg-modal-choice-label { color: #f1f5f9; font-weight: 600; }
.rpg-modal-choice-hint  { color: #64748b; font-size: 12px; }

/* ── Ending banners ── */
.rpg-modal-ending {
  padding: 14px 16px; border-radius: 11px;
  text-align: center; font-weight: 700; font-size: 15px;
  margin-bottom: 8px;
}
.rpg-modal-ending.success {
  background: rgba(34,197,94,.07);
  border: 1px solid rgba(34,197,94,.28);
  color: #86efac;
}
.rpg-modal-ending.failure {
  background: rgba(239,68,68,.07);
  border: 1px solid rgba(239,68,68,.28);
  color: #fca5a5;
}

/* ── Advancing indicator ── */
.rpg-modal-advancing { text-align: center; padding: 8px; color: #64748b; font-size: 14px; }

/* ── Empty / loading ── */
.rpg-empty {
  text-align: center; padding: 36px 12px; color: #334155;
}
.rpg-empty-icon  { font-size: 28px; margin-bottom: 8px; }
.rpg-empty-label { font-size: 13px; }
.rpg-loading { text-align: center; padding: 36px 12px; color: #334155; font-size: 14px; }

/* ── Login form ── */
.rpg-login-sub { margin: 0 0 18px; font-size: 13px; color: #475569; }
.rpg-field { margin-bottom: 12px; }
.rpg-field label {
  display: block; margin-bottom: 5px;
  font-size: 11px; font-weight: 700; color: #64748b;
  text-transform: uppercase; letter-spacing: .5px;
}
.rpg-input {
  width: 100%; padding: 13px 14px;
  background: rgba(30,41,59,.9);
  border: 1px solid rgba(148,163,184,.3); border-radius: 7px;
  color: #f1f5f9; font-size: 15px; font-family: inherit;
  transition: border-color .16s; outline: none;
}
.rpg-input:focus { border-color: #f59e0b; }
.rpg-input::placeholder { color: #475569; }
.rpg-btn-primary {
  width: 100%; margin-top: 6px; padding: 14px;
  border: 0; border-radius: 7px;
  background: linear-gradient(135deg, #f59e0b, #b45309);
  color: #fff7ed; font-size: 15px; font-weight: 700; font-family: inherit;
  cursor: pointer; transition: filter .16s, transform .16s;
}
.rpg-btn-primary:hover   { filter: brightness(1.08); }
.rpg-btn-primary:active  { transform: scale(.98); }
.rpg-btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.rpg-error {
  margin-top: 10px; padding: 10px 12px; border-radius: 10px;
  background: rgba(239,68,68,.1); border: 1px solid rgba(239,68,68,.22);
  color: #fca5a5; font-size: 13px;
}
.rpg-btn-logout {
  width: 100%; margin-top: 14px; padding: 10px;
  border: 1px solid rgba(148,163,184,.12); border-radius: 10px;
  background: transparent; color: #475569; font-size: 13px; font-family: inherit;
  cursor: pointer; transition: color .16s, border-color .16s;
}
.rpg-btn-logout:hover { color: #ef4444; border-color: rgba(239,68,68,.28); }

@media (max-width: 640px) {
  .rpg-widget { right: 16px; bottom: 16px; }
  .rpg-panel  {
    right: 16px; bottom: 88px;
    width: calc(100vw - 32px);
    height: min(78vh, 640px);
  }
}
