/* Main theme (inspired layout, original assets replaced) */
@font-face{
  font-family: "Cinzelish";
  src: local("Cinzel"), local("Cinzel Decorative");
}
:root{
  --bg:#1b1b1b;
  --panel:#222;
  --text:#f4f4f4;
  --muted:#cfcfcf;
  --accent:#d32f2f;
  --shadow: 0 18px 40px rgba(0,0,0,.45);
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  color:var(--text);
  background: radial-gradient(1200px 600px at 50% -10%, rgba(255,255,255,.06), transparent 70%),
              linear-gradient(180deg, #111, var(--bg));
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

a{color:inherit}
header{
  text-align:center;
  padding: 42px 18px 10px;
}
.mainLogo{
  width:min(520px, 92vw);
  height:auto;
  display:block;
  margin: 0 auto 10px;
  filter: drop-shadow(0 12px 18px rgba(0,0,0,.55));
}
header h1{
  margin: 8px 0 0;
  font-size: clamp(40px, 6vw, 84px);
  letter-spacing: 2px;
  font-family: "Cinzelish", "Georgia", serif;
  text-transform: uppercase;
  text-shadow: 0 6px 18px rgba(0,0,0,.65);
}

main{
  max-width: 1100px;
  margin: 0 auto;
  padding: 12px 18px 26px;
  text-align:center;
}
main h2{
  margin: 12px 0 26px;
  font-size: clamp(18px, 2.2vw, 34px);
  font-family: "Cinzelish", "Georgia", serif;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 1px;
}

ul{
  list-style:none;
  padding:0;
  margin: 0 auto;
  display:grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 22px;
  align-items: stretch;
  justify-items: stretch;
}
@media (max-width: 1100px){
  ul{grid-template-columns: repeat(2, minmax(160px, 1fr)); max-width: 820px}
}
@media (max-width: 700px){
  ul{grid-template-columns: 1fr; gap: 18px; max-width: 520px}
}

li a{
  text-decoration:none;
  display:flex;
  flex-direction:column;
  justify-content:space-between;
  height: 100%;
  min-height: 320px;
  padding: 18px 12px;
  border-radius: 22px;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.06);
  box-shadow: var(--shadow);
  transition: transform .12s ease, background .12s ease, border-color .12s ease;
}round .12s ease, border-color .12s ease;
}
li a:hover{
  transform: translateY(-4px);
  background: rgba(255,255,255,.06);
  border-color: rgba(211,47,47,.35);
}

figure{
  margin:0;
  height:100%;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap: 12px;
}
figure img{
  width: clamp(120px, 14vw, 170px);
  height:auto;
  user-select:none;
  -webkit-user-drag:none;
  filter: drop-shadow(0 12px 20px rgba(0,0,0,.55));
}
figcaption{
  min-height: 64px;
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 0 8px;
  text-align:center;
  margin-top: 0;
  font-size: clamp(18px, 1.9vw, 26px);
  line-height: 1.05;
  font-family: "Cinzelish", "Georgia", serif;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-shadow: 0 6px 18px rgba(0,0,0,.65);
}

#link_to_items{
  text-align:center;
  margin: 10px 0 0;
  padding: 0 18px;
  font-family: "Cinzelish", "Georgia", serif;
  text-transform: uppercase;
  letter-spacing: 1px;
}
#link_to_items a{ color: #fff; text-decoration: underline; }

footer{
  margin-top: 26px;
  padding: 14px 18px 30px;
  text-align:center;
  color: rgba(255,255,255,.55);
  max-width: 1100px;
  margin-left:auto;
  margin-right:auto;
}
footer .legal{
  font-size: 11px;
  letter-spacing: .3px;
  line-height: 1.55;
  text-transform: none;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}
footer .legal a{ text-decoration: underline; }

/* Inner pages */
.page-wrap{
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 18px 50px;
}
.back{
  display:inline-flex;
  align-items:center;
  gap:10px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.18);
  text-decoration:none;
}
.card{
  margin-top: 16px;
  padding: 16px 16px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.03);
  box-shadow: var(--shadow);
}
.row{display:flex; gap:12px; flex-wrap:wrap; align-items:center}
label{color: var(--muted); font-size: 13px}
select,input,textarea{
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.18);
  color: var(--text);
  outline:none;
}
textarea{width:100%; min-height: 140px; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;}
.btn{
  cursor:pointer;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.06);
  color: var(--text);
  font-weight: 700;
}
.btn.primary{border-color: rgba(211,47,47,.45); background: rgba(211,47,47,.18)}
.out{
  white-space: pre-wrap;
  padding: 14px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(0,0,0,.18);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  line-height: 1.5;
}
.smallnote{color: var(--muted); font-size: 12px; line-height: 1.5}
hr.sep{border:none; height:1px; background: rgba(255,255,255,.08); margin: 14px 0}
.table{
  width:100%;
  border-collapse: collapse;
  overflow:hidden;
  border-radius: 14px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.14);
}
.table th,.table td{padding:10px 10px; border-bottom:1px solid rgba(255,255,255,.06); font-size:13px; text-align:left}
.table th{color:var(--muted); font-weight:800}
.table tr:hover td{background: rgba(211,47,47,.08)}
.pill{display:inline-block; font-size:12px; padding:3px 8px; border-radius:999px; border:1px solid rgba(255,255,255,.10); color:var(--muted)}
dialog{
  border:1px solid rgba(255,255,255,.14);
  background: linear-gradient(180deg, rgba(30,30,30,.97), rgba(15,15,15,.93));
  color: var(--text);
  border-radius: 16px;
  padding: 0;
  box-shadow: 0 20px 50px rgba(0,0,0,.45);
  max-width: 860px;
  width: min(860px, calc(100vw - 28px));
}
dialog::backdrop{background: rgba(0,0,0,.55)}
.modal-head{
  padding:14px 16px;
  border-bottom:1px solid rgba(255,255,255,.06);
  display:flex; align-items:center; justify-content:space-between; gap:10px;
}
.modal-body{padding:16px}


/* Botteghe output */
.shopOut{
  background: rgba(0,0,0,.22);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 18px;
  padding: 16px 16px 10px;
}
.shopHeader{
  display:flex;
  flex-wrap:wrap;
  gap: 10px 14px;
  align-items:baseline;
  justify-content:space-between;
  margin-bottom: 10px;
}
.shopHeader h3{
  margin:0;
  font-family: "Cinzelish","Georgia",serif;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.shopMeta{
  color: rgba(255,255,255,.75);
  font-size: 13px;
}
.shopSection{
  margin-top: 12px;
}
.shopSectionTitle{
  font-weight: 900;
  letter-spacing: .3px;
  color: rgba(255,255,255,.92);
  margin: 0 0 8px;
}
.shopList{
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 14px;
}
@media (max-width: 760px){
  .shopList{grid-template-columns: 1fr;}
}
.shopItem{
  display:flex;
  justify-content:space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.05);
}
.shopItem .name{font-weight:700}
.shopItem .price{white-space:nowrap; color: rgba(255,255,255,.78)}
.shopPill{
  display:inline-flex;
  align-items:center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.06);
  font-size: 12px;
  color: rgba(255,255,255,.78);
}


/* ---- Botteghe: output più grafico ---- */
.shopOut{
  background: rgba(0,0,0,.20);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 18px;
  padding: 16px;
}

.shopHeader{
  display:flex;
  flex-wrap:wrap;
  gap: 10px 14px;
  align-items:center;
  justify-content:space-between;
  margin-bottom: 12px;
}

.shopHeader h3{
  margin:0;
  font-family: "Cinzelish","Georgia",serif;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 26px;
}

.shopMeta{
  color: rgba(255,255,255,.78);
  font-size: 13px;
}

.shopPills{
  display:flex;
  flex-wrap:wrap;
  gap: 8px;
  justify-content:flex-end;
}

.shopPill{
  display:inline-flex;
  align-items:center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.06);
  font-size: 12px;
  color: rgba(255,255,255,.78);
}

.shopSection{
  margin-top: 14px;
}

.shopSectionTitle{
  font-weight: 900;
  letter-spacing: .4px;
  color: rgba(255,255,255,.92);
  margin: 0 0 10px;
  text-transform: uppercase;
  font-size: 13px;
  opacity: .95;
}

.shopGrid{
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
}
@media (max-width: 760px){
  .shopGrid{grid-template-columns: 1fr;}
}

.shopItem{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.06);
}

.shopItemLeft{
  display:flex;
  align-items:center;
  gap: 10px;
  min-width: 0;
}

.shopIcon{
  width: 34px;
  height: 34px;
  border-radius: 12px;
  display:grid;
  place-items:center;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.06);
  filter: drop-shadow(0 10px 16px rgba(0,0,0,.35));
  flex: 0 0 auto;
  font-size: 18px;
}

.shopName{
  font-weight: 800;
  overflow:hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shopSub{
  color: rgba(255,255,255,.70);
  font-size: 12px;
  margin-top: 2px;
  overflow:hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shopPrice{
  white-space: nowrap;
  color: rgba(255,255,255,.85);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.shopHint{
  margin-top: 10px;
  color: rgba(255,255,255,.70);
  font-size: 12px;
  line-height: 1.45;
}

/* Lista oggetti: icone */
.itemsTable td.iconCell, .itemsTable th.iconCell{
  width: 44px;
  text-align:center;
}
.itemsEmoji{
  width: 30px;
  height: 30px;
  border-radius: 12px;
  display:inline-grid;
  place-items:center;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.06);
}


/* Dark select options (better dropdown visibility) */
select, option {
  background-color: rgba(15, 16, 20, 0.98);
  color: rgba(255,255,255,0.92);
}
select:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(190,30,35,0.25);
}


/* BardShop branding (auto-added) */
.logoMark{display:flex;align-items:center;justify-content:center;}
.logoMark img{max-width: 560px; height:auto;}


/* --- Home card icon animations (ALFA) --- */
@media (prefers-reduced-motion: reduce) {
  #shop, #sword, #chest, #single { animation: none !important; }
}

#shop, #sword, #chest, #single {
  will-change: transform, filter;
  transform: translateZ(0);
}

/* idle motion */
#chest  { animation: chestBob 2.6s ease-in-out infinite; }
#shop   { animation: shopWobble 3.0s ease-in-out infinite; transform-origin: 50% 65%; }
#sword  { animation: swordSway 2.8s ease-in-out infinite; transform-origin: 50% 70%; }
#single { animation: bagShake 3.2s ease-in-out infinite; transform-origin: 50% 75%; }

/* hover: a bit more energy */
a.card:hover #chest  { animation-duration: 1.7s; }
a.card:hover #shop   { animation-duration: 2.2s; }
a.card:hover #sword  { animation-duration: 1.9s; }
a.card:hover #single { animation-duration: 2.4s; }

a.card:hover #shop,
a.card:hover #sword,
a.card:hover #chest,
a.card:hover #single {
  filter: drop-shadow(0 10px 18px rgba(0,0,0,.55));
}

@keyframes chestBob {
  0%, 100% { transform: translateY(0) scale(1); }
  50%      { transform: translateY(-8px) scale(1.02); }
}

@keyframes shopWobble {
  0%, 100% { transform: rotate(0deg) translateY(0); }
  25%      { transform: rotate(-2.2deg) translateY(-3px); }
  50%      { transform: rotate(0deg) translateY(0); }
  75%      { transform: rotate(2.2deg) translateY(-3px); }
}

@keyframes swordSway {
  0%, 100% { transform: rotate(0deg) translateY(0); }
  50%      { transform: rotate(-3.5deg) translateY(-6px); }
}

@keyframes bagShake {
  0%, 100% { transform: rotate(0deg) translateY(0); }
  20%      { transform: rotate(-2.2deg) translateY(-4px); }
  40%      { transform: rotate(2.2deg) translateY(-4px); }
  60%      { transform: rotate(-1.4deg) translateY(-2px); }
  80%      { transform: rotate(1.4deg) translateY(-2px); }
}


/* Home icon frame: same style for all tiles */
.icon-frame{
  width: 200px;
  height: 200px;
  border-radius: 34px;
  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(255,255,255,0.06);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.03), 0 18px 45px rgba(0,0,0,0.45);
  display:flex;
  align-items:center;
  justify-content:center;
  margin: 0 auto 18px;
  backdrop-filter: blur(6px);
}

.home-icon-img{
  width: 132px;
  height: 132px;
  object-fit: contain;
  filter: drop-shadow(0 14px 18px rgba(0,0,0,0.55));
  transform-origin: 50% 50%;
}


/* Home icon animations */
.animate-shop{ animation: shopWiggle 4.2s ease-in-out infinite; }
.animate-sword{ animation: swordFloat 4.6s ease-in-out infinite; }
.animate-chest{ animation: chestPop 3.6s ease-in-out infinite; }
.animate-coin{ animation: coinBounce 3.2s ease-in-out infinite; }

a:hover .home-icon-img,
a:focus .home-icon-img{
  transform: translateY(-2px) scale(1.03);
}
a:hover .animate-chest,
a:focus .animate-chest{
  animation: chestPop 1.1s ease-in-out infinite;
}
