/* Outrora wiki theme — aligned with Tibiana / site VPS */

@font-face {
  font-family: 'martelregular';
  src: url('../fonts/martel.woff') format('woff');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

:root {
  --wiki-bg: #102129;
  --wiki-parchment: #f1e0c6;
  --wiki-parchment-dark: #d5c0a1;
  --wiki-parchment-mid: #e8d4b4;
  --wiki-text: #5a2800;
  --wiki-link: #0042a0;
  --wiki-link-hover: #0080c2;
  --wiki-caption: #505050;
  --wiki-border: #5a2800;
  --wiki-muted: #7a5a3a;
  --wiki-btn-top: #848484;
  --wiki-btn-bottom: #424242;
  --wiki-font: Verdana, Tahoma, Helvetica, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 12px;
}

body.wiki-body {
  margin: 0;
  padding: 16px;
  min-height: 100vh;
  font-family: var(--wiki-font);
  font-size: 12px;
  line-height: 1.35;
  color: var(--wiki-text);
  background: var(--wiki-bg) url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="4" height="4"><rect fill="%23102129" width="4" height="4"/><rect fill="%231a2f38" width="1" height="1"/></svg>');
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--wiki-link);
  font-weight: bold;
  text-decoration: none;
}
a:hover {
  color: var(--wiki-link-hover);
  text-decoration: underline;
}

.wiki-wrap {
  max-width: 980px;
  margin: 0 auto;
}

.wiki-panel {
  background: var(--wiki-parchment);
  border: 1px solid #000;
  color: var(--wiki-text);
}

.wiki-caption {
  background: var(--wiki-caption);
  color: #fff;
  font-family: var(--wiki-font);
  font-size: 10pt;
  font-weight: bold;
  padding: 5px 10px 6px;
  text-align: left;
}

.wiki-caption .martel {
  font-family: martelregular, var(--wiki-font);
  font-size: 15px;
  font-weight: normal;
  text-shadow: 2px 2px 2px #000;
}

.wiki-panel-body {
  padding: 8px 10px 12px;
  background: var(--wiki-parchment-mid);
}

.wiki-back {
  display: inline-block;
  margin: 0 0 8px;
  font-size: 11px;
}

/* Controls */
.wiki-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
  padding: 8px;
  background: var(--wiki-parchment);
  border: 1px solid #a08060;
}

.wiki-search {
  flex: 1;
  min-width: 160px;
  position: relative;
}

.wiki-search input {
  width: 100%;
  padding: 4px 8px;
  border: 1px solid var(--wiki-border);
  background: #fff8ee;
  color: var(--wiki-text);
  font-family: var(--wiki-font);
  font-size: 11px;
}

.wiki-search input:focus {
  outline: 1px solid var(--wiki-link);
}

.wiki-sort,
.wiki-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.wiki-btn,
.sort-btn {
  font-family: var(--wiki-font) !important;
  font-size: 9px !important;
  font-weight: bold;
  color: #fff !important;
  background: #5a5a5a;
  background-image: linear-gradient(#6e6e6e, #3f3f3f);
  border: none;
  border-top: 1px solid var(--wiki-btn-top);
  border-bottom: 1px solid var(--wiki-btn-bottom);
  border-radius: 7px;
  padding: 3px 12px;
  min-width: 0;
  cursor: pointer;
  text-decoration: none !important;
}

.wiki-btn:hover,
.sort-btn:hover {
  text-decoration: underline !important;
  color: #fff !important;
}

.wiki-btn.active,
.sort-btn.active {
  background: #2f2f2f;
  background-image: linear-gradient(#454545, #222);
  color: #ffe9a8 !important;
}

.wiki-stats {
  margin: 0 0 8px;
  font-size: 10px;
  color: var(--wiki-muted);
}

/* Lists — items & monsters use the same compact grid */
.wiki-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: #000;
  border: 1px solid #000;
}

.wiki-card,
.monster-card,
.item-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px;
  text-decoration: none !important;
  color: var(--wiki-text) !important;
  font-weight: normal;
  min-height: 40px;
}

.monster-card:hover,
.item-card:hover,
.wiki-card:hover {
  filter: brightness(1.05);
  outline: 1px solid var(--wiki-link);
}

.monster-info,
.item-info {
  flex: 1;
  min-width: 0;
}

.monster-name,
.item-name {
  font-size: 11px;
  font-weight: bold;
  color: var(--wiki-text);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.monster-exp,
.item-details {
  font-size: 10px;
  color: var(--wiki-muted);
  font-weight: normal;
}

/* Items & Monsters — same compact grid (sem zebra) */
#item-list,
#monster-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  gap: 4px;
  background: transparent;
  border: none;
}

#item-list .item-card,
#monster-list .monster-card {
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  padding: 6px 4px 5px;
  min-height: 0;
  text-align: center;
  background: var(--wiki-parchment);
  border: 1px solid #a08060;
}

#item-list .item-card img,
#monster-list .monster-card img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  background: transparent;
  border: none;
  flex-shrink: 0;
}

#item-list .item-info,
#monster-list .monster-info {
  flex: none;
  width: 100%;
}

#item-list .item-name,
#monster-list .monster-name {
  font-size: 10px;
  white-space: normal;
  line-height: 1.2;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

#item-list .item-details,
#monster-list .monster-exp {
  font-size: 9px;
  line-height: 1.2;
}

.no-results,
.loading,
.error {
  padding: 12px;
  font-size: 11px;
  text-align: center;
  background: var(--wiki-parchment);
  color: var(--wiki-text);
}

.error {
  background: #f3d0c0;
  color: #8a1f1f;
  border: 1px solid #8a1f1f;
}

/* Detail pages */
.wiki-detail {
  display: grid;
  grid-template-columns: 140px 1fr 1fr;
  gap: 8px;
}

.wiki-detail-box {
  background: var(--wiki-parchment);
  border: 1px solid #a08060;
  padding: 8px;
}

.wiki-detail-box h2,
.wiki-detail-box h3 {
  margin: 0 0 6px;
  font-size: 11px;
  color: var(--wiki-text);
  border-bottom: 1px solid #c4a882;
  padding-bottom: 3px;
}

.wiki-detail-box p,
.wiki-detail-box li {
  margin: 2px 0;
  font-size: 11px;
}

.wiki-detail-box ul {
  margin: 0;
  padding-left: 16px;
}

.wiki-detail .monster-image img,
.monster-image img {
  width: 96px;
  height: 96px;
  max-width: 96px;
  max-height: 96px;
  object-fit: contain;
  display: block;
  margin: 8px auto 0;
  background: transparent;
  border: none;
  image-rendering: auto;
}

/* Item detail sprite — menor, alinhado ao visual do monstro */
.wiki-detail .item-image img,
.item-image img {
  width: 64px;
  height: 64px;
  max-width: 64px;
  max-height: 64px;
  object-fit: contain;
  display: block;
  margin: 8px auto 0;
  background: transparent;
  border: none;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.wiki-description,
.description {
  font-style: italic;
  font-size: 10px;
  color: var(--wiki-muted);
  margin: 8px 0 0;
  padding: 6px;
  background: rgba(255,255,255,0.25);
  border: 1px solid #c4a882;
}

.flag-badge {
  display: inline-block;
  padding: 1px 6px;
  margin: 1px;
  background: var(--wiki-caption);
  color: #fff;
  border-radius: 3px;
  font-size: 9px;
  font-weight: bold;
}

.attribute-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.attribute-list li {
  padding: 2px 0;
  border-bottom: 1px solid #c4a882;
  font-size: 11px;
}

.dropped-by-section,
.loot-container {
  margin-top: 8px;
  padding: 8px;
  background: var(--wiki-parchment);
  border: 1px solid #a08060;
  grid-column: 1 / -1;
}

.dropped-by-section h3,
.loot-container h2 {
  margin: 0 0 6px;
  font-size: 11px;
}

/* Loot e Dropped by — mesmo layout: 8 por linha, mesma sprite */
.dropped-by-list,
.loot {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 4px;
  width: 100%;
}

.monster-link,
.loot-item-link {
  display: block;
  padding: 3px 2px;
  background: var(--wiki-parchment-dark);
  border: 1px solid #a08060;
  font-size: 9px;
  color: var(--wiki-link) !important;
  text-decoration: none !important;
  text-align: center;
  min-width: 0;
}

.monster-link:hover,
.loot-item-link:hover {
  background: var(--wiki-parchment);
  filter: brightness(1.03);
}

.loot-item {
  text-align: center;
  width: 100%;
  min-width: 0;
}

.loot-image-container {
  position: relative;
  display: inline-block;
}

.dropped-by-list .loot-image-container img,
.loot .loot-image-container img,
.loot-image-container img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  image-rendering: auto;
}

.loot-count {
  position: absolute;
  right: -2px;
  bottom: -2px;
  background: #505050;
  color: #fff;
  font-size: 8px;
  padding: 0 3px;
  border-radius: 2px;
}

.loot-info {
  font-size: 9px;
  color: var(--wiki-text);
  margin-top: 2px;
  line-height: 1.15;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

@media (max-width: 900px) {
  .dropped-by-list,
  .loot {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .dropped-by-list,
  .loot {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  #item-list,
  #monster-list {
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  }
}

/* Legacy class bridges used by existing HTML */
.container {
  max-width: 980px;
  margin: 0 auto;
  background: var(--wiki-parchment-mid);
  border: 1px solid #000;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
  backdrop-filter: none;
}

.container > h1 {
  margin: 0;
  padding: 5px 10px 6px;
  background: var(--wiki-caption);
  color: #fff;
  font-family: var(--wiki-font);
  font-size: 10pt;
  font-weight: bold;
  text-align: left;
  text-shadow: none;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 8px 10px;
  padding: 8px;
  background: var(--wiki-parchment);
  border: 1px solid #a08060;
  border-radius: 0;
  box-shadow: none;
  justify-content: flex-start;
}

.search-box {
  flex: 1;
  min-width: 160px;
  max-width: none;
  position: relative;
}

.search-box input {
  width: 100%;
  padding: 4px 24px 4px 8px;
  border: 1px solid var(--wiki-border);
  border-radius: 0;
  font-size: 11px;
  font-family: var(--wiki-font);
  background: #fff8ee;
  color: var(--wiki-text);
  box-shadow: none;
}

.search-box input:focus {
  outline: 1px solid var(--wiki-link);
  border-color: var(--wiki-link);
  box-shadow: none;
}

.search-icon {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  color: var(--wiki-muted);
}

.category-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 0 10px 10px;
}

.category-tab {
  font-family: var(--wiki-font) !important;
  font-size: 11px !important;
  font-weight: bold;
  color: #fff !important;
  background: #5a5a5a;
  background-image: linear-gradient(#6e6e6e, #3f3f3f);
  border: none;
  border-top: 1px solid var(--wiki-btn-top);
  border-bottom: 1px solid var(--wiki-btn-bottom);
  border-radius: 7px;
  padding: 7px 10px;
  min-height: 30px;
  width: 100%;
  cursor: pointer;
  text-decoration: none !important;
  text-align: center;
  line-height: 1.2;
}

.category-tab:hover {
  text-decoration: underline !important;
  color: #fff !important;
  filter: brightness(1.08);
}

.category-tab.active {
  background: #2f2f2f;
  background-image: linear-gradient(#454545, #222);
  color: #ffe9a8 !important;
}

@media (max-width: 700px) {
  .category-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }
}

.stats {
  margin: 0 10px 8px;
  text-align: left;
  color: var(--wiki-muted);
  font-size: 10px;
}

#monster-list,
#item-list {
  margin: 0 10px 10px;
}

/* Detail layout generated by JS */
#monster-detail > .container,
#item-detail > .container,
#monster-detail > .wiki-detail,
#item-detail > .wiki-detail {
  display: grid;
  grid-template-columns: 140px 1fr 1fr;
  gap: 8px;
  max-width: none;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
}

.center-container,
.left-container,
.right-container {
  background: var(--wiki-parchment);
  border: 1px solid #a08060;
  padding: 8px;
}

.center-container h2,
.left-container h2,
.right-container h2,
.center-container h3,
.left-container h3,
.right-container h3 {
  margin: 0 0 6px;
  font-size: 11px;
  color: var(--wiki-text);
  border-bottom: 1px solid #c4a882;
  padding-bottom: 3px;
}

.center-container p,
.left-container p,
.right-container p,
.center-container li,
.left-container li,
.right-container li {
  margin: 2px 0;
  font-size: 11px;
}

.voices .voice,
.voice {
  font-size: 10px;
  font-style: italic;
  color: var(--wiki-muted);
  margin-bottom: 4px;
}

.monster-image img {
  margin: 8px auto 0;
}

html.is-embed #monster-detail > .container,
html.is-embed #item-detail > .container,
html.is-embed #monster-detail > .wiki-detail,
html.is-embed #item-detail > .wiki-detail {
  grid-template-columns: 100px 1fr 1fr;
  gap: 6px;
}

html.is-embed .monster-image img {
  width: 72px;
  height: 72px;
  max-width: 72px;
  max-height: 72px;
}

html.is-embed .item-image img {
  width: 48px;
  height: 48px;
  max-width: 48px;
  max-height: 48px;
}

html.is-embed .wiki-panel {
  border: none;
  background: transparent;
}

html.is-embed .wiki-panel-body {
  padding: 0;
  background: transparent;
}

html.is-embed .wiki-caption {
  margin-bottom: 6px;
}

/* ========== EMBED (inside MyAAC parchment) ========== */
html.is-embed,
html.is-embed body.wiki-body {
  background: transparent !important;
  min-height: 0;
}

body.wiki-body.is-embed,
html.is-embed body.wiki-body {
  padding: 0;
  font-size: 11px;
}

html.is-embed .wiki-wrap,
html.is-embed .container {
  max-width: none;
  margin: 0;
  border: none;
  background: transparent;
}

html.is-embed .container > h1,
html.is-embed .wiki-caption {
  font-size: 10pt;
}

html.is-embed .controls,
html.is-embed .wiki-controls {
  margin: 0 0 6px;
  padding: 6px;
}

html.is-embed .category-tabs {
  margin: 0 0 8px;
  gap: 7px;
}

html.is-embed .category-tab {
  font-size: 10px !important;
  padding: 6px 8px;
  min-height: 28px;
}

html.is-embed .stats,
html.is-embed .wiki-stats {
  margin: 0 0 6px;
}

html.is-embed #monster-list,
html.is-embed #item-list {
  margin: 0;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 3px;
}

html.is-embed #item-list .item-card,
html.is-embed #monster-list .monster-card {
  padding: 4px 3px;
  gap: 3px;
  min-height: 0;
}

html.is-embed #item-list .item-card img,
html.is-embed #monster-list .monster-card img {
  width: 40px;
  height: 40px;
}

html.is-embed #item-list .item-name,
html.is-embed #monster-list .monster-name {
  font-size: 9px;
}

html.is-embed #item-list .item-details,
html.is-embed #monster-list .monster-exp {
  font-size: 8px;
}

html.is-embed .dropped-by-list,
html.is-embed .loot {
  gap: 3px;
  grid-template-columns: repeat(8, minmax(0, 1fr));
}

html.is-embed .dropped-by-list .loot-image-container img,
html.is-embed .loot .loot-image-container img {
  width: 48px;
  height: 48px;
}

html.is-embed .wiki-detail {
  grid-template-columns: 110px 1fr 1fr;
  gap: 6px;
}

html.is-embed .wiki-detail .monster-image img {
  width: 72px;
  height: 72px;
}

html.is-embed .wiki-detail .item-image img {
  width: 48px;
  height: 48px;
}

html.is-embed .wiki-back {
  margin-bottom: 6px;
}

@media (max-width: 700px) {
  .wiki-detail {
    grid-template-columns: 1fr;
  }

  .controls,
  .wiki-controls {
    flex-direction: column;
    align-items: stretch;
  }
}

/* ========== Wiki home (index) ========== */
.wiki-home-header {
  margin-bottom: 12px;
  text-align: center;
  color: #c9b896;
}

.wiki-home-header .logo {
  font-family: martelregular, var(--wiki-font);
  font-size: 28px;
  color: #e8d060;
  text-shadow: 2px 2px 4px #000, 0 0 12px rgba(232, 208, 96, 0.35);
  margin: 0 0 4px;
}

.wiki-home-header p {
  margin: 0;
  font-size: 11px;
  color: #9ab0b8;
}

.wiki-home-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}

.wiki-home-links {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: #000;
  border: 1px solid #000;
}

.wiki-home-link {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 7px 10px;
  background: var(--wiki-parchment);
  color: var(--wiki-text) !important;
  font-weight: normal;
  text-decoration: none !important;
}

.wiki-home-link:nth-child(even) {
  background: var(--wiki-parchment-dark);
}

.wiki-home-link:hover {
  filter: brightness(1.04);
  outline: 1px solid var(--wiki-link);
}

.wiki-home-link .title {
  font-weight: bold;
  font-size: 11px;
  color: var(--wiki-link);
  display: block;
}

.wiki-home-link:hover .title {
  color: var(--wiki-link-hover);
  text-decoration: underline;
}

.wiki-home-link .desc {
  display: block;
  font-size: 10px;
  color: var(--wiki-muted);
  margin-top: 1px;
}

.wiki-home-footer {
  margin-top: 10px;
  text-align: center;
  font-size: 10px;
  color: #8a9aa0;
}

.wiki-home-footer a {
  color: #b8c8d0;
}

@media (max-width: 700px) {
  .wiki-home-grid {
    grid-template-columns: 1fr;
  }
}
