/* =========================
   FONTS
========================= */

@font-face {
  font-family: "Minecraft UI";
  src: url("./assets/fonts/minecraft-ui.ttf") format("truetype");
}

@font-face {
  font-family: "Minecraft Title";
  src: url("./assets/fonts/minecraft-title.ttf") format("truetype");
}
font-family: "Minecraft UI", Arial, sans-serif;
font-family: "Minecraft Title", Arial, sans-serif;

/* =========================
   ROOT VARIABLES
========================= */

:root {
  --page: #120d09;
  --panel: #8b5831;
  --panel-light: #d29a59;
  --panel-dark: #321b0d;
  --text: #fffbe6;
  --muted: #f0d39f;

  --button: #5b3922;
  --button-hover: #6f4528;

  --grid-line: #15100c;
  --grid-heavy: #050403;

  --tile-back: #392719;
  --tile-frame: #b77a42;
  --tile-frame-dark: #3d2415;

  --marked: rgba(85, 255, 85, 0.42);
  --shadow: rgba(0, 0, 0, 0.45);

  color-scheme: dark;
  font-family: "Minecraft UI", Arial, sans-serif;
}

/* =========================
   BASE
========================= */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--text);
  font-family: "Minecraft UI", Arial, sans-serif;
  text-shadow: 2px 2px 0 #16100b;
}

/* =========================
   TITLE FONT (IMPORTANT)
========================= */

h1 {
  font-family: "Minecraft Title", "Minecraft UI", sans-serif;
  color: #ffff55;
  font-size: clamp(1.6rem, 3vw, 3rem);
  margin: 0;
  text-shadow: 3px 3px 0 #3f3f15;
}

/* =========================
   APP LAYOUT
========================= */

.app {
  width: min(1560px, calc(100vw - 24px));
  margin: 0 auto;
  padding: 18px 0 28px;
}

/* =========================
   BOARD TILE TEXT FIX
   (THIS FIXES YOUR MAIN ISSUE)
========================= */

.item-name,
.fallback-name {
  position: relative;
  z-index: 2;

  width: 100%;
  max-width: 100%;

  padding: 1px 2px;

  font-size: 0.55rem; /* FIXED BASE */
  line-height: 1;

  text-align: center;

  overflow: hidden;
  text-overflow: ellipsis;

  word-break: break-word;

  background: rgba(0, 0, 0, 0.45);
  color: #fff;

  display: flex;
  align-items: center;
  justify-content: center;

  /* CRITICAL FIX */
  min-height: 0;
}
/* fallback specifically smaller */
.fallback-name {
  font-weight: 900;
  font-size: clamp(0.35rem, calc(9vw / var(--size)), 0.65rem);
}

/* =========================
   TILE IMAGE AREA FIX
========================= */

.item-art {
  position: relative;
  z-index: 1;

  display: grid;
  place-items: center;

  width: 80%;
  height: 80%;

  min-height: 0;
}

/* =========================
   HIDE NAMES MODE FIX
========================= */

.hide-names .item-name {
  display: none;
}

/* ensures image recentres properly */
.hide-names .item-art {
  align-self: center;
}

/* =========================
   BOARD SAFETY (prevents overflow feel)
========================= */

.board-wrap {
  aspect-ratio: 1 / 1;
  width: min(100%, calc(100vh - 120px));
}

/* =========================
   OPTIONAL: make buttons consistent font
========================= */

button,
select,
input {
  font-family: "Minecraft UI", Arial, sans-serif;
}