@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

body{
  margin:0;
  background:#222;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  height:100vh;
  font-family:Georgia, serif;
}

.book{
  width:96%;
  height:90%;
  background:#efe1b6;
  border:8px solid #5a4632;
  display:flex;
}

.page{
  width:50%;
  padding:28px;
  box-sizing:border-box;
}

.page-indicator {
  width: 120px;
  text-align: center;
  background: transparent;
  border: none;
  color: #eee;
  font-family: inherit;
  font-size: 16px;
  outline: none;
  cursor: pointer;
  transition: color 0.2s, text-shadow 0.2s;
}

.page-indicator.active {
  color: #fff;
  text-shadow: 0 0 6px rgba(255,255,255,0.8);
}

.page-indicator:focus {
  text-decoration: underline;
}

.left{
  border-right:4px solid #5a4632;
}

.box{
  border:3px solid #5a4632;
  padding:14px;
  margin-bottom:18px;
}

.name{
  font-size:34px;
  font-weight:bold;
  text-align:center;
  letter-spacing: 0.8px;
}

.grade{
  text-align:center;
  font-style:italic;
  margin-bottom:20px;
}

/* Level badge + name row */
.name-row{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:12px;
  padding: 24px;
  margin-bottom: 18px;
  background-image: url(../general/textures/paper/dark_paper_small.png);
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
}

.level-badge{
  width:44px;
  height:36px;
  border-radius:6px;
  border:2px solid rgba(0,0,0,0.08);
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:bold;
  color:#fff;
  font-size:14px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
  font-family: 'Press Start 2P', 'Courier New', monospace;
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* color variants for level badge — match bookmark colors */
.level-badge.o{ background:#fdac3b; }
.level-badge.l1{ background:#c83038; }
.level-badge.l2{ background:#4c92ab; }
.level-badge.if{ background:#448a9a; }
.level-badge.l3{ background:#a95a98; }
.level-badge.l4{ background:#567252; }
.level-badge.l5{ background:#434868; }

.image-box{
  width:260px;
  height:320px;
  margin:0 auto 24px auto;
  perspective:1000px;
}

.flip-card{
  width:100%;
  height:100%;
  background: url(../general/textures/paper/light_paper_square.png);
  background-size: 100% 100%;
  position:relative;
  cursor:pointer;
  overflow: visible; /* allow scaled images to extend beyond card */
}

.flip-inner{
  position:relative;
  width:100%;
  height:100%;
  transition: transform 0.6s;
  transform-style: preserve-3d;
}

.flip-card.flipped .flip-inner{
  transform: rotateY(180deg);
}

.flip-front, .flip-back{
  position:absolute;
  width:100%;
  height:100%;
  top:0;
  left:0;
  display:flex;
  align-items:center;
  justify-content:center;
  backface-visibility:hidden;
}

.flip-back{
  transform: rotateY(180deg);
}

.flip-front img, .flip-back img{
  max-width:100%;
  max-height:100%;
  object-fit:contain;
  /* Prefer nearest-neighbor / pixelated scaling for pixel-art PNGs */
  image-rendering: crisp-edges;
  image-rendering: pixelated;
  -ms-interpolation-mode: nearest-neighbor; /* IE */
  transform: scale(var(--img-scale, 1.05));
  transform-origin: center center;
  transition: transform 200ms ease;
}

.flip-card:hover .flip-front img,
.flip-card:hover .flip-back img{
  transform: scale(calc(var(--img-scale, 1.05) * 1.07));
}

.flip-card[aria-pressed="true"]{
  outline: 3px solid rgba(255,255,255,0.12);
}

/* Bookmarks (left side tabs) */
.bookmarks{
  position:absolute;
  left:-28px; /* sit outside the book border so it doesn't touch inner boxes */
  top:40px;
  display:flex;
  flex-direction:column;
  gap:10px;
  z-index:45;
}

.bookmark{
  width:44px;
  height:40px;
  border-radius:6px;
  border:2px solid rgba(0,0,0,0.08);
  display:flex;
  align-items:center;
  justify-content:flex-start;
  cursor:pointer;
  font-weight:bold;
  box-shadow:0 2px 6px rgba(0,0,0,0.12);
  padding-left:8px;
  overflow:hidden;
  transition: width 220ms ease, transform 220ms ease;
}

.bookmark:focus{ outline:3px solid rgba(90,70,50,0.12); }

.bm0{ background: #fdac3b; color: #fff; }
.bm1{ background: #c83038; color: #fff; }
.bm2{ background: #4c92ab; color: #fff; }
.bm3{ background: #448a9a; color: #fff; }
.bm4{ background: #a95a98; color: #fff; }
.bm5{ background: #567252; color: #fff; }
.bm6{ background: #434868; color: #fff; }

.bookmark .num{
  width:22px;
  display:inline-block;
  text-align:center;
  color:inherit;
}

.bookmark .label{
  margin-left:8px;
  opacity:0;
  color:#fff; /* requested white text */
  white-space:nowrap;
  transition: opacity 180ms ease, transform 180ms ease;
  transform: translateX(-6px);
  font-size:14px;
}

.bookmark .label,
.bookmark .num{
  font-family: 'Press Start 2P', 'Courier New', monospace;
  letter-spacing: 0.8px;
}

.bookmark:hover{
  transform: translateX(28px);
  width:160px;
}

.bookmark:hover .label{
  opacity:1;
  transform: translateX(0);
}

@media (max-height:640px){
  .bookmarks{ top:20px; gap:8px; }
  .bookmark{ width:38px; height:34px; }
}

.description{
  font-size:16px;
}

h3{
  margin-top:0;
}

ul{
  padding-left:20px;
}

.nav{
  margin-top:8px;
  color:#eee;
}

button{
  background:#5a4632;
  color:white;
  border:none;
  padding:6px 14px;
  font-size:16px;
  cursor:pointer;
}

/* Drop image (inline next to "Drops:") */
.drop-img{
  width:44px;
  height:auto;
  vertical-align:middle;
  margin-left:8px;
  border:2px solid #5a4632;
  display:inline-block;
  cursor:pointer;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
  -ms-interpolation-mode: nearest-neighbor; /* IE */
}

/* Drop tooltip styled with pixel font */
.drop-tooltip{
  position: fixed;
  z-index: 9999;
  display: none; /* shown by JS */
  pointer-events: none; /* allow clicks through */
  background: rgba(0,0,0,0.92);
  color: #fff;
  border: 2px solid #5a4632;
  padding: 8px 10px;
  border-radius: 6px;
  font-family: Georgia, serif;
  font-size: 14px;
  line-height: 1;
  white-space: nowrap;
}

.drop-tooltip[aria-hidden="false"]{ display:block; }

/* Style for details rectangle image used instead of a heading */
.details-box{
  position:relative;
}
.details-box .details-rect{
  width:100%;
  height:auto;
  display:block;
  margin-bottom:8px;
}

/* Search UI */
.search-btn{
  position:absolute;
  right:18px;
  top:12px;
  width:44px;
  height:44px;
  border-radius:8px;
  background:#5a4632;
  color:#fff;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:20px;
  z-index:40;
}

.search-popup{
  position:absolute;
  right:12px;
  top:62px;
  width:380px;
  max-height:420px;
  background:#efe1b6;
  border:3px solid #5a4632;
  box-shadow:0 6px 18px rgba(0,0,0,0.3);
  padding:12px;
  box-sizing:border-box;
  z-index:40;
  display:none;
  flex-direction:column;
}

.search-popup[aria-hidden="false"]{
  display:flex;
}

.search-header{
  display:flex;
  gap:8px;
}

.search-input{
  flex:1;
  padding:10px 12px;
  border:2px solid #5a4632;
  font-size:15px;
  border-radius:6px;
}

.search-close{
  width:36px;
  padding:6px;
}

.search-results{
  margin:10px 0 0 0;
  padding:0;
  list-style:none;
  overflow:auto;
  max-height:320px;
}

.search-results li{
  padding:10px 12px;
  border-bottom:1px solid rgba(90,70,50,0.08);
  cursor:pointer;
  font-size:15px;
}

.search-results li:hover{
  background:rgba(90,70,50,0.06);
}

/* Ensure bookmarks don't overlap the interior content on small heights */
@media (max-height:640px){
  .bookmarks{ top:20px; gap:8px; }
  .bookmark{ width:38px; height:34px; }
}


h3{
  margin-top:0;
}

ul{
  padding-left:20px;
}

.nav{
  margin-top:8px;
  color:#eee;
}

button{
  background:#5a4632;
  color:white;
  border:none;
  padding:6px 14px;
  font-size:16px;
  cursor:pointer;
}

.drop-img{
  width:44px;              
  height:auto;
  vertical-align:middle;  
  margin-left:8px;
  border:2px solid #5a4632;
  display:inline-block;
  cursor:pointer;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
  -ms-interpolation-mode: nearest-neighbor; 
}

.drop-tooltip{
  position: fixed;
  z-index: 9999;
  display: none; 
  pointer-events: none; 
  background: rgba(0,0,0,0.92);
  color: #fff;
  border: 2px solid #5a4632;
  padding: 8px 10px;
  border-radius: 6px;
  font-family: Georgia, serif;
  font-size: 14px;
  line-height: 1;
  white-space: nowrap;
}

.drop-tooltip[aria-hidden="false"]{ display:block; }

.details-box{
  position:relative;
}
.details-box .details-rect{
  width:100%;
  height:auto;
  display:block;
  margin-bottom:8px;
}

/* Search UI */
.search-btn{
  position:absolute;
  right:18px;
  top:12px;
  width:44px;
  height:44px;
  border-radius:8px;
  background:#5a4632;
  color:#fff;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:20px;
  z-index:40;
}

.search-popup{
  position:absolute;
  right:12px;
  top:62px;
  width:380px;
  max-height:420px;
  background:#efe1b6;
  border:3px solid #5a4632;
  box-shadow:0 6px 18px rgba(0,0,0,0.3);
  padding:12px;
  box-sizing:border-box;
  z-index:40;
  display:none;
  flex-direction:column;
}

.search-popup[aria-hidden="false"]{
  display:flex;
}

.search-header{
  display:flex;
  gap:8px;
}

.search-input{
  flex:1;
  padding:10px 12px;
  border:2px solid #5a4632;
  font-size:15px;
  border-radius:6px;
}

.search-close{
  width:36px;
  padding:6px;
}

.search-results{
  margin:10px 0 0 0;
  padding:0;
  list-style:none;
  overflow:auto;
  max-height:320px;
}

.search-results li{
  padding:10px 12px;
  border-bottom:1px solid rgba(90,70,50,0.08);
  cursor:pointer;
  font-size:15px;
}

.search-results li:hover{
  background:rgba(90,70,50,0.06);
}
/* === Tip container === */
.tip{
  display: flex;
  align-items: flex-start;
  gap: 14x;
  margin-bottom: 30px;
}

/* === Avatar image === */
.tip-avatar{
  width: 120px;
  height: 120px;
  object-fit: cover;
  flex-shrink: 0;
}

/* === Speech bubble === */
.tip-box{
  position: relative;
  background: #fff;
  color: #000;
  padding: 6px 10px;
  border-radius: 8px;
  border: 2px solid #000;
  font-size: 16px;
  line-height: 1.2;
  max-width: 100%;
  box-sizing: border-box;

  margin-left: 15px; }


/* === Speech bubble tail (points to avatar) === */
.tip-box::before{
  content: "";
  position: absolute;
  left: -10px;
  top: 10px;
  border-width: 6px 10px 6px 0;
  border-style: solid;
  border-color: transparent #000 transparent transparent;
}

.tip-box::after{
  content: "";
  position: absolute;
  left: -7px;
  top: 11px;
  border-width: 5px 9px 5px 0;
  border-style: solid;
  border-color: transparent #fff transparent transparent;
}
.emote {
  vertical-align: middle;
}

#mark{
  position: fixed;
  bottom: -115px;
  right: -70px;
  scale: 0.42;
}

#go_back {
  position: fixed;
  scale: 0.5;
  bottom: 30px;
  right: 35px;
  z-index: 1000;
  transition: transform 0.2s ease;
}

#go_back img {
  width: 145px;
  vertical-align: middle;

}

#div5, #div5 * {
    text-decoration: none;
}

.drop-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
}

.drop-table th,
.drop-table td {
  border: 2px solid #5a4632;
  padding: 6px;
  text-align: center;
  font-size: 14px;
}

.drop-table th {
  background: #cdbf9a;
}

.drop-table img {
  width: 36px;
  image-rendering: pixelated;
}

/* Stats box */
.mob-stats {
  margin-top: 12px;
  border-top: 2px solid #5a4632;
  padding-top: 8px;
  font-size: 15px;
}