* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'VT323', monospace;
}

body {
  background-color: #2b1d15;

  background-image:
    linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)),
    url('https://raw.githubusercontent.com/InventivetalentDev/minecraft-assets/1.19.3/assets/minecraft/textures/block/dirt.png');

  background-size: 128px 128px;
  background-repeat: repeat;

  image-rendering: pixelated;

  box-shadow: inset 0 0 250px rgba(0, 0, 0, 0.9);

  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: clamp(10px, 3vw, 20px);
  color: #fff;
}

.side-controls {
  position: fixed;
  top: clamp(10px, 2vw, 20px);
  right: clamp(10px, 2vw, 20px);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: clamp(5px, 1.5vw, 10px);
  width: clamp(120px, 25vw, 180px);
}

.container {
  background-color: #c6c6c6;
  border: clamp(2px, 0.5vw, 4px) solid #000;
  box-shadow: inset 4px 4px 0px #ffffff, inset -4px -4px 0px #555555;
  padding: clamp(15px, 4vw, 30px);
  max-width: 800px;
  width: 100%;
  position: relative;
  color: #3f3f3f;
}

h1 {
  text-align: center;
  color: #3f3f3f;
  text-shadow: 2px 2px 0 rgba(255, 255, 255, 0.4);
  margin-bottom: clamp(15px, 4vw, 30px);
  font-size: clamp(28px, 6vw, 48px);
  letter-spacing: clamp(1px, 0.3vw, 2px);
  font-weight: normal;
}

.setup-area.hidden {
  display: none;
}

.item-list {
  margin-bottom: clamp(10px, 3vw, 20px);
  max-height: clamp(200px, 40vh, 300px);
  overflow-y: auto;
  padding-right: clamp(5px, 1.5vw, 10px);
  scrollbar-width: thin;
  scrollbar-color: #555 #000;
}

.item-row {
  display: flex;
  gap: clamp(5px, 1.5vw, 10px);
  margin-bottom: clamp(5px, 1.5vw, 10px);
  align-items: center;
  flex-wrap: wrap;
}

.settings-row {
  background: rgba(0, 0, 0, 0.05);
  padding: clamp(10px, 2.5vw, 15px);
  border: 2px dashed #888;
  margin-bottom: clamp(10px, 3vw, 20px);
  display: flex;
  flex-direction: column;
  gap: clamp(3px, 1vw, 5px);
}

.settings-row label {
  font-size: clamp(16px, 3vw, 20px);
  color: #555;
}

input[type="text"],
input[type="number"],
select {
  padding: clamp(8px, 2vw, 12px);
  background: #000;
  border: 2px solid #a0a0a0;
  border-top-color: #555;
  border-left-color: #555;
  border-bottom-color: #fff;
  border-right-color: #fff;
  color: #fff;
  font-size: clamp(16px, 3.5vw, 22px);
  outline: none;
}

.item-row input[type="text"] {
  flex: 1;
  min-width: 0;
}

.settings-row input,
.settings-row select {
  width: 100%;
}

input:focus {
  background: #1a1a1a;
  border: 2px solid #fff;
}

.btn {
  padding: clamp(8px, 2vw, 10px) clamp(15px, 3vw, 20px);
  background: #7e7e7e;
  cursor: pointer;
  font-size: clamp(18px, 3.5vw, 24px);
  color: #fff;
  text-shadow: 2px 2px 0 #000;
  border: 2px solid #000;
  box-shadow: inset 2px 2px 0 rgba(255, 255, 255, 0.5), inset -2px -2px 0 rgba(0, 0, 0, 0.5);
  position: relative;
  text-transform: uppercase;
  text-align: center;
  white-space: nowrap;
  min-width: 0;
}

.btn:hover {
  background: #8e8e8e;
  color: #ffffa0;
}

.btn:active {
  background: #5e5e5e;
  box-shadow: inset 2px 2px 0 rgba(0, 0, 0, 0.5), inset -2px -2px 0 rgba(255, 255, 255, 0.2);
  transform: translateY(2px);
}

.btn-remove {
  background: #fb3e3e;
  width: clamp(40px, 8vw, 50px);
  flex-shrink: 0;
  padding: clamp(8px, 2vw, 10px);
}

.btn-hide {
  background: #888;
  width: clamp(60px, 12vw, 70px);
  flex-shrink: 0;
  padding: clamp(8px, 2vw, 10px);
  font-size: clamp(14px, 2.5vw, 18px);
}

.btn-img {
  background: #888;
  width: clamp(60px, 12vw, 70px);
  flex-shrink: 0;
  padding: clamp(8px, 2vw, 10px);
  font-size: clamp(14px, 2.5vw, 18px);
}

.btn-add {
  width: 100%;
  margin-top: clamp(5px, 1.5vw, 10px);
}

.btn-start,
.btn-restart {
  width: 100%;
  padding: clamp(12px, 2.5vw, 15px);
  font-size: clamp(20px, 4vw, 28px);
  margin-top: clamp(10px, 3vw, 20px);
}

.training-area {
  display: none;
  text-align: center;
}

.training-area.active {
  display: block;
}

.stats {
  display: flex;
  justify-content: space-around;
  margin-bottom: clamp(10px, 3vw, 20px);
  padding: clamp(8px, 2vw, 10px);
  background: #000;
  border: 2px solid #555;
  border-bottom: 2px solid #fff;
  border-right: 2px solid #fff;
  flex-wrap: wrap;
  gap: clamp(5px, 2vw, 10px);
}

.stat-label {
  color: #aaa;
  font-size: clamp(14px, 2.5vw, 18px);
}

.stat-value {
  color: #55ff55;
  font-size: clamp(20px, 4vw, 28px);
  text-shadow: 2px 2px 0 #000;
}

.item-display {
  background: rgba(0, 0, 0, 0.5);
  border: 2px solid #3f3f3f;
  padding: clamp(20px, 5vw, 40px);
  margin-bottom: clamp(15px, 4vw, 30px);
  font-size: clamp(32px, 8vw, 64px);
  color: #ffff55;
  text-shadow: 3px 3px 0 #3f3f00;
  min-height: clamp(100px, 20vh, 140px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.8);
  position: relative;
  overflow: hidden;
  word-wrap: break-word;
  text-align: center;
}

.item-image {
  max-width: 100%;
  max-height: 300px;
  object-fit: contain;
  display: block;
}

.timer-bar-container {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: clamp(6px, 1.5vw, 8px);
  background: rgba(255, 255, 255, 0.1);
}

.timer-bar {
  width: 100%;
  height: 100%;
  background: #55ff55;
  transition: width 0.1s linear;
}

.input-area input {
  width: 100%;
  padding: clamp(10px, 2.5vw, 15px);
  text-align: center;
  font-size: clamp(20px, 4.5vw, 32px);
}

.input-area input.hidden-text {
  color: transparent !important;
  text-shadow: none !important;
  caret-color: transparent !important;
  background: #000 !important;
}

.feedback {
  min-height: clamp(30px, 5vh, 40px);
  font-size: clamp(18px, 4vw, 28px);
  margin-bottom: clamp(10px, 3vw, 20px);
  text-shadow: 2px 2px 0 #000;
}

.feedback.correct {
  color: #55ff55;
}

.feedback.incorrect {
  color: #ff5555;
}

.results {
  display: none;
  text-align: center;
}

.results.active {
  display: block;
}

.results h2 {
  color: #3f3f3f;
  text-shadow: 2px 2px 0 rgba(255, 255, 255, 0.4);
  margin-bottom: clamp(15px, 4vw, 30px);
  font-size: clamp(28px, 6vw, 42px);
}

.result-stat {
  background: rgba(0, 0, 0, 0.1);
  border-bottom: 2px solid #999;
  padding: clamp(10px, 2.5vw, 15px);
  margin-bottom: clamp(5px, 1.5vw, 10px);
  font-size: clamp(18px, 4vw, 28px);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: clamp(5px, 1vw, 10px);
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  z-index: 1000;
  display: none;
  justify-content: center;
  align-items: center;
  padding: clamp(15px, 5vw, 40px);
}

.modal.active {
  display: flex;
}

.modal-content {
  background: #c6c6c6;
  border: clamp(2px, 0.5vw, 4px) solid #000;
  box-shadow: inset 4px 4px 0px #ffffff, inset -4px -4px 0px #555555;
  width: 100%;
  max-width: 900px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  padding: clamp(15px, 4vw, 30px);
  position: relative;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: clamp(10px, 3vw, 20px);
  flex-wrap: wrap;
  gap: clamp(5px, 2vw, 10px);
}

.modal-body {
  overflow-y: auto;
  flex-grow: 1;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: clamp(14px, 3vw, 22px);
  display: block;
  overflow-x: auto;
}

.history-table thead,
.history-table tbody,
.history-table tr {
  display: table;
  width: 100%;
  table-layout: fixed;
}

.history-table th {
  background: #3f3f3f;
  color: #ffff55;
  padding: clamp(6px, 1.5vw, 10px);
  text-align: left;
}

.history-table td {
  padding: clamp(6px, 1.5vw, 10px);
  border-bottom: 2px solid #888;
  color: #222;
  word-wrap: break-word;
}

.chart-container {
  background: #000;
  padding: clamp(10px, 3vw, 20px);
  border: clamp(2px, 0.5vw, 4px) solid #555;
  height: clamp(250px, 50vh, 400px);
  position: relative;
}

.btn-danger {
  background: #fb3e3e;
}

.btn-close {
  width: auto;
  padding: clamp(5px, 1vw, 5px) clamp(10px, 2vw, 15px);
}

.difficulty-btn {
  width: 100%;
  background: #4a4a4a;
  margin-top: clamp(5px, 1.5vw, 10px);
  border-color: #222;
}

.diff-1 {
  color: #55ff55;
}

.diff-2 {
  color: #ffffff;
}

.diff-3 {
  color: #ffff55;
}

.diff-4 {
  color: #ffaa00;
}

.diff-5 {
  color: #ff5555;
}

.diff-6 {
  color: #ff55ff;
}

.filter-row {
  margin-bottom: clamp(10px, 2.5vw, 15px);
  display: flex;
  align-items: center;
  gap: clamp(5px, 1.5vw, 10px);
  flex-wrap: wrap;
}

.filter-row label {
  font-size: clamp(16px, 3.5vw, 22px);
  color: #333;
}

.info-table {
  width: 100%;
  border-collapse: collapse;
  font-size: clamp(14px, 2.5vw, 18px);
  color: #222;
  overflow-x: auto;
  display: block;
}

.info-table thead,
.info-table tbody,
.info-table tr {
  display: table;
  width: 100%;
  table-layout: fixed;
}

.info-table th {
  background: #333;
  color: #fff;
  padding: clamp(5px, 1.5vw, 8px);
  text-align: left;
}

.info-table td {
  padding: clamp(5px, 1.5vw, 8px);
  border: 1px solid #999;
  word-wrap: break-word;
}

@media (max-width: 480px) {
  body {
    padding: 10px;
  }

  .side-controls {
    position: static;
    width: 100%;
    margin-bottom: 15px;
    flex-direction: row;
    justify-content: space-between;
  }

  .container {
    padding: 15px;
  }

  .item-row {
    flex-direction: column;
    align-items: stretch;
  }

  .btn-remove {
    width: 100%;
  }

  .stats {
    flex-direction: column;
    align-items: stretch;
  }

  .result-stat {
    flex-direction: column;
    align-items: flex-start;
  }

  .modal {
    padding: 10px;
  }

  .modal-header {
    flex-direction: column;
    align-items: stretch;
  }

  .history-table,
  .info-table {
    font-size: 12px;
  }

  .history-table th,
  .history-table td,
  .info-table th,
  .info-table td {
    padding: 4px;
  }
}

@media (min-width: 481px) and (max-width: 768px) {
  .side-controls {
    width: 150px;
    top: 15px;
    right: 15px;
  }

  .container {
    padding: 20px;
  }

  .stats {
    gap: 8px;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .container {
    max-width: 700px;
  }
}

@media (min-width: 1025px) {
  .container {
    max-width: 800px;
  }
}

.img-preview-container {
  position: relative;
  width: clamp(40px, 8vw, 50px);
  height: clamp(40px, 8vw, 50px);
  flex-shrink: 0;
}



.item-thumbnail:hover {
  border-color: #fff;
}

.remove-img-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #ff5555;
  color: #fff;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  text-align: center;
  line-height: 16px;
  font-size: 12px;
  cursor: pointer;
  border: 1px solid #fff;
  font-weight: bold;
  display: none;
}

.img-preview-container:hover .remove-img-badge {
  display: block;
}

.btn-img {
  background: #444;
  color: #fff;
  border: 2px dashed #888;
  font-size: 20px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  width: clamp(40px, 8vw, 50px);
  height: clamp(40px, 8vw, 50px);
}

.btn-img:hover {
  background: #555;
  color: #55ff55;
  border-color: #55ff55;
}

.remove-img-badge {
  display: block;
}

.item-thumbnail {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #55ff55;
  font-weight: bold;
  background: #444;
  /* Changed from default/black to match btn-img */
  border: 2px solid #55ff55;
  /* Solid green to indicate set */
  font-size: 20px;
}