/**
 * PocketSkills Web Portal — stone panels, menus, tables, forms
 */

.stone-box {
  background: var(--bg-surface);
  border: 2px solid var(--frame-darkest);
  border-radius: var(--radius-md);
  box-shadow:
    inset 0 0 0 1px var(--frame-border),
    inset 0 2px 0 var(--bevel-light),
    0 8px 24px rgba(0, 0, 0, 0.7);
  overflow: hidden;
  position: relative;
}

.stone-box.ornate::before,
.stone-box.ornate::after {
  content: "❖";
  position: absolute;
  top: 6px;
  color: var(--gold-dark);
  font-size: 10px;
  z-index: 2;
  text-shadow: 0 0 2px #000;
}
.stone-box.ornate::before { left: 8px; }
.stone-box.ornate::after { right: 8px; }

.panel-head {
  background: linear-gradient(180deg, #5a412c 0%, #3a281a 52%, #261a10 100%);
  border-bottom: 2px solid var(--frame-darkest);
  box-shadow: inset 0 1px 0 var(--bevel-light-strong);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.panel-head h2,
.panel-head h3 {
  font-family: var(--font-title);
  font-size: 0.95rem;
  color: #fff4d4;
  text-shadow: 1px 1px 0 #000, 0 0 6px rgba(232, 184, 58, 0.3);
  letter-spacing: 0.6px;
  margin: 0;
  font-weight: 700;
}

.panel-head h2 {
  font-size: 1.05rem;
}

.panel-body {
  padding: 16px;
  background: radial-gradient(circle at center top, rgba(46, 34, 24, 0.28), transparent 70%), var(--bg-surface-2);
}

.panel-body > *:last-child {
  margin-bottom: 0;
}

/* Sidebar menus */
.menu-group {
  margin: 0;
}

.menu-group-header {
  width: 100%;
  text-align: left;
  background: linear-gradient(180deg, #5a412c, #2a1d13);
  border: none;
  border-bottom: 1px solid var(--frame-darkest);
  box-shadow: inset 0 1px 0 var(--bevel-light);
  padding: 9px 12px;
  font-family: var(--font-title);
  font-size: 0.82rem;
  color: var(--gold-light);
  font-weight: 700;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all var(--transition-fast);
}

.menu-group-header:hover {
  background: linear-gradient(180deg, #6a4d34, #362619);
  color: #fff;
}

.menu-group-header .toggle-icon {
  font-size: 0.7rem;
  transition: transform var(--transition-normal);
  color: var(--gold-primary);
}

.menu-group.collapsed .toggle-icon {
  transform: rotate(-90deg);
}

.menu-list {
  list-style: none;
  padding: 8px 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: rgba(0, 0, 0, 0.18);
}

.menu-group.collapsed .menu-list {
  display: none;
}

.menu-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 0.82rem;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.menu-link::before {
  content: "›";
  color: var(--gold-dark);
  font-weight: bold;
  font-size: 1.05rem;
  line-height: 1;
}

.menu-link:hover {
  background: rgba(74, 56, 38, 0.45);
  color: #fff;
  border-color: var(--frame-mid);
  transform: translateX(2px);
}

.menu-link:hover::before {
  color: var(--gold-light);
}

.menu-link.active {
  background: linear-gradient(90deg, rgba(139, 108, 35, 0.5), rgba(74, 56, 38, 0.12));
  border-color: var(--gold-dark) var(--frame-border) var(--frame-border) var(--gold-primary);
  border-left-width: 3px;
  color: var(--gold-light);
  font-weight: 700;
}

.menu-link.active::before {
  content: "✦";
  font-size: 0.7rem;
  color: var(--gold-primary);
}

.stone-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 16px;
  min-height: 36px;
  background: linear-gradient(180deg, var(--frame-light) 0%, var(--frame-border) 50%, #291d12 100%);
  border: 1px solid var(--frame-darkest);
  border-radius: var(--radius-sm);
  box-shadow:
    inset 0 1px 0 var(--bevel-light-strong),
    inset 0 -2px 0 var(--bevel-dark),
    0 2px 4px rgba(0, 0, 0, 0.5);
  color: #f7edd4;
  font-family: var(--font-title);
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: none;
  text-shadow: 1px 1px 1px #000;
  transition: transform 0.08s ease, filter var(--transition-fast);
  user-select: none;
}

.stone-btn:hover:not(:disabled) {
  filter: brightness(1.12);
  color: #fff;
}

.stone-btn:active:not(:disabled) {
  transform: translateY(1px);
}

.stone-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed !important;
}

.stone-btn.gold,
.stone-btn.cta {
  background: linear-gradient(180deg, #e2c069 0%, #b98f32 50%, #7d5c18 100%);
  border-color: #4f390c;
  color: #1f1404;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.3);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    inset 0 -2px 0 rgba(0, 0, 0, 0.35),
    0 2px 4px rgba(0, 0, 0, 0.5);
}

.stone-btn.gold:hover:not(:disabled),
.stone-btn.cta:hover:not(:disabled) {
  filter: none;
  background: linear-gradient(180deg, #ecca74 0%, #c69a3a 50%, #87641c 100%);
  color: #150d03;
}

.stone-btn.red {
  background: linear-gradient(180deg, #c74848 0%, #8f2626 50%, #591515 100%);
  border-color: #380d0d;
  color: #fff0f0;
}

.stone-btn.full-w { width: 100%; }
.stone-btn.large {
  min-height: 46px;
  padding: 12px 22px;
  font-size: 1.05rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.rpg-table-wrapper {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--frame-darkest);
  border-radius: var(--radius-sm);
  background: var(--bg-surface-3);
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.8);
}

.rpg-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
  text-align: left;
}

.rpg-table th {
  background: linear-gradient(180deg, #423020 0%, #2d1f14 100%);
  color: var(--gold-light);
  font-family: var(--font-title);
  padding: 10px 12px;
  border-bottom: 2px solid var(--frame-darkest);
  border-right: 1px solid var(--frame-mid);
  text-shadow: 1px 1px 0 #000;
  font-weight: 700;
  white-space: nowrap;
}

.rpg-table th:last-child { border-right: none; }

.rpg-table td {
  padding: 9px 12px;
  border-bottom: 1px solid rgba(56, 40, 26, 0.6);
  border-right: 1px solid rgba(56, 40, 26, 0.3);
  color: var(--text-dim);
  vertical-align: middle;
}

.rpg-table td:last-child { border-right: none; }

.rpg-table tbody tr:nth-child(even) {
  background: rgba(0, 0, 0, 0.22);
}

.rpg-table tbody tr:hover {
  background: rgba(139, 108, 35, 0.2);
}

.rpg-table tbody tr:hover td {
  color: var(--text-bright);
}

.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-weight: bold;
  font-size: 0.75rem;
}

.rank-1 { background: linear-gradient(135deg, #ffe066, #b38600); color: #1a1400; }
.rank-2 { background: linear-gradient(135deg, #e0e0e0, #808080); color: #111; }
.rank-3 { background: linear-gradient(135deg, #cd7f32, #7a4614); color: #fff; }
.rank-other { color: var(--text-muted); font-weight: 700; }

.guild-tag {
  display: block;
  font-size: 0.72rem;
  color: #c79aff; /* the guild's purple, as over heads in the game */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.online-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  border: 1px solid var(--frame-border);
}

.online-pill.on {
  color: var(--rarity-uncommon);
  border-color: rgba(111, 214, 111, 0.45);
}

.rpg-form-group {
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rpg-label {
  font-size: 0.8rem;
  font-family: var(--font-title);
  color: var(--gold-light);
}

.rpg-input {
  background: var(--frame-darkest);
  border: 1px solid var(--frame-border);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 0.88rem;
  box-shadow: inset 1px 1px 4px rgba(0, 0, 0, 0.8);
  outline: none;
  width: 100%;
}

.rpg-input:focus {
  border-color: var(--gold-primary);
  box-shadow: 0 0 8px rgba(232, 184, 58, 0.35), inset 1px 1px 4px rgba(0, 0, 0, 0.8);
}

.rpg-input::placeholder {
  color: var(--text-muted);
}

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(6, 4, 2, 0.85);
  backdrop-filter: blur(3px);
  z-index: 500;
  place-items: center;
  padding: 16px;
  overflow-y: auto;
}

.modal-overlay.active {
  display: grid;
  animation: fade-in 0.15s ease-out;
}

.modal-dialog {
  width: min(100%, 620px);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border: 2px solid var(--gold-dark);
  border-radius: var(--radius-md);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.95);
  overflow: hidden;
}

.modal-header {
  background: linear-gradient(180deg, #5b4129, #352315);
  border-bottom: 2px solid var(--frame-darkest);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-family: var(--font-title);
  color: #fff3d0;
  font-size: 1.1rem;
  margin: 0;
}

.modal-close-btn {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--frame-border);
  color: #f7edd4;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
}

.modal-close-btn:hover {
  background: var(--ruby);
  color: #fff;
}

.modal-body {
  padding: 18px;
  overflow-y: auto;
}

.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1000;
  pointer-events: none;
}

.toast {
  background: linear-gradient(180deg, #302013, #1a110a);
  border: 1px solid var(--gold-dark);
  border-radius: var(--radius-sm);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.8);
  padding: 10px 16px;
  color: var(--text-main);
  font-size: 0.85rem;
  pointer-events: auto;
  animation: slide-in-right 0.25s ease-out;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 320px;
}

.mini-rank-wrap {
  padding: 0;
}

.mini-rank-head,
.mini-rank-row {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 48px;
  gap: 8px;
  align-items: center;
  padding: 9px 12px;
}

.mini-rank-head {
  background: rgba(0, 0, 0, 0.28);
  color: var(--gold-light);
  font-family: var(--font-title);
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--frame-darkest);
}

.mini-rank-head span:first-child {
  text-align: center;
}

.mini-rank-head span:last-child,
.mini-rank-row .mini-rank-lvl {
  text-align: right;
}

.mini-rank-list {
  display: flex;
  flex-direction: column;
}

.mini-rank-row {
  width: 100%;
  border: 0;
  border-bottom: 1px solid rgba(56, 40, 26, 0.5);
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.mini-rank-row .rank-badge {
  justify-self: center;
}

.mini-rank-more {
  display: block;
  padding: 9px 12px;
  text-align: center;
  font-size: 0.78rem;
  border-top: 1px solid var(--frame-darkest);
  background: rgba(0, 0, 0, 0.18);
}

.mini-rank-row:last-child {
  border-bottom: none;
}

.mini-rank-row:hover {
  background: rgba(139, 108, 35, 0.18);
}

.mini-rank-name {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.mini-rank-name strong {
  color: var(--text-main);
  font-size: 0.82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mini-rank-name small {
  color: var(--text-muted);
  font-size: 0.7rem;
}

.mini-rank-lvl {
  color: var(--gold-primary);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Icons (icons.js): drawn in the text's colour, a soft filled body, lively on hover */
.ico {
  width: 1.15em;
  height: 1.15em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -0.2em;
  transition: transform var(--transition-fast), filter var(--transition-fast);
}

.ico .f {
  fill: currentColor;
  fill-opacity: 0.22;
}

.menu-group-title {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.menu-group-title .ico {
  width: 1.35em;
  height: 1.35em;
  color: var(--gold-primary);
}

.menu-group-header:hover .menu-group-title .ico {
  transform: rotate(-10deg) scale(1.15);
  filter: drop-shadow(0 0 4px rgba(255, 200, 80, 0.6));
}

/* the group you are in glows softly */
.menu-group:has(.menu-link.active) .menu-group-title .ico {
  color: var(--gold-light);
  animation: icon-glow 2.6s ease-in-out infinite;
}

.topbar-link:hover .ico,
.topbar-play:hover .ico {
  transform: scale(1.15) rotate(-8deg);
}

@keyframes icon-glow {
  0%, 100% { filter: drop-shadow(0 0 1px rgba(255, 200, 80, 0.3)); }
  50% { filter: drop-shadow(0 0 5px rgba(255, 200, 80, 0.8)); }
}

@media (prefers-reduced-motion: reduce) {
  .ico { transition: none; }
  .menu-group:has(.menu-link.active) .menu-group-title .ico { animation: none; }
}

.menu-out {
  margin-left: 6px;
  font-size: 0.75em;
  color: var(--gold-dark);
}

/* Pages under a long list (util.js pager): ‹ 1 … 4 5 6 … 90 › and "41–50 of 900" */
.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 16px 0 4px;
}

.pager-btn {
  min-width: 34px;
  height: 34px;
  padding: 0 9px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--frame-border);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, var(--frame-light), var(--frame-mid));
  box-shadow: inset 0 1px 0 var(--bevel-light);
  color: var(--text-dim);
  font-family: var(--font-title);
  font-size: 0.82rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-decoration: none;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

a.pager-btn:hover,
button.pager-btn:hover {
  color: var(--gold-light);
  border-color: var(--gold-dark);
}

.pager-btn.current {
  color: #1f1404;
  border-color: #4f390c;
  background: linear-gradient(180deg, #e2c069, #b98f32);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.3);
}

.pager-btn[aria-disabled="true"] {
  opacity: 0.35;
}

.pager-step {
  font-size: 1.05rem;
}

.pager-gap {
  color: var(--text-muted);
  padding: 0 2px;
}

.pager-info {
  flex-basis: 100%;
  text-align: center;
  font-size: 0.74rem;
  color: var(--text-muted);
}
