/* =========================================================
   FONT SETUP
   ========================================================= */
@font-face {
  font-family: 'VI Hai Duong';
  src: url('../fonts/VI-Hai-Duong-Normal.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

/* =========================================================
   GLOBAL BASE STYLES
   ========================================================= */
body {
  margin: 0;
  padding: 40px 20px;

  font-family: Verdana, Geneva, sans-serif;
  color: #2c2c2c;

  cursor: url('../background/cursor.png') 0 0, auto;

  background: url('../background/gpqBG.png') no-repeat center center fixed;
  background-size: cover;
}

/* Keep custom cursor on interactive elements; number inputs get the text cursor */
button {
  cursor: url('../background/cursor.png') 0 0, auto;
}

input[type="number"] {
  cursor: text;
}

/* =========================================================
   APP CONTAINER
   ========================================================= */
#app {
  max-width: 720px;
  margin: 0 auto;

  padding: 30px;

  background: linear-gradient(to bottom right, rgba(226,245,235,0.96), rgba(170,214,190,0.96));

  border: 3px solid #b8860b;
  border-radius: 16px;

  box-shadow: 0 8px 20px rgba(0,0,0,0.35);
}

main {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* =========================================================
   TITLE
   ========================================================= */
.title-container {
  width: fit-content;
  margin: 0 auto 24px;

  background: #d3ead9;
  padding: 12px 24px;

  border: 2px solid #c9a227;
  border-radius: 12px;

  box-shadow: 0 6px 15px rgba(0,0,0,0.25);

  text-align: center;
}

h1 {
  font-family: 'VI Hai Duong', sans-serif;
  font-size: 2.6rem;
  color: #1f5c42;
  margin: 0;
}

h2 {
  font-family: 'VI Hai Duong', sans-serif;
  color: #1f5c42;
  margin: 0 0 14px;
  font-size: 1.5rem;
}

/* =========================================================
   PANELS
   ========================================================= */
.panel {
  background: linear-gradient(to bottom, #eafaf1, #bfe2cd);
  border: 2px solid #c9a227;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

/* =========================================================
   PEG / OFFERING DISPLAY
   ========================================================= */
.peg-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.peg {
  background: #f3fbf6;
  border: 2px solid #c9a227;
  border-radius: 10px;

  padding: 10px;
  text-align: center;

  box-shadow:
    0 0 0 2px #ffffff inset,
    0 2px 6px rgba(0,0,0,0.18);

  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.peg:hover {
  transform: scale(1.03);
  box-shadow:
    0 0 0 2px #ffffff inset,
    0 4px 10px rgba(0,0,0,0.25);
}

.peg-image {
  width: 56px;
  height: 56px;
  object-fit: contain;
  margin: 4px auto;
  display: block;
}

.peg-item {
  font-weight: bold;
  color: #1f5c42;
  font-size: 0.9rem;
}

/* =========================================================
   SOLVED BANNER
   ========================================================= */
#solved-banner {
  background: linear-gradient(to bottom, #f8f0d8, #e9d9a8);
  border: 2px solid #c9a227;
  border-radius: 10px;

  padding: 12px 16px;
  margin-bottom: 16px;

  color: #5c4415;
  font-weight: bold;
  text-align: center;

  box-shadow:
    0 4px 10px rgba(0,0,0,0.2),
    0 0 8px rgba(215, 175, 90, 0.4);
}

/* =========================================================
   FORM / INPUTS
   ========================================================= */
.field-group {
  margin-bottom: 14px;
}

label {
  display: block;
  margin-bottom: 6px;
  font-weight: bold;
  color: #1f5c42;
}

/* =========================================================
   NUMBER CONTROL (input + up/down stepper)
   ========================================================= */
.number-control {
  display: flex;
  align-items: center;
  gap: 8px;
}

.number-control input[type="number"] {
  width: 180px;
  flex: 0 0 auto;
}

.stepper {
  display: flex;
  flex-direction: row;
  gap: 6px;
}

.stepper-btn {
  width: 44px;
  height: 44px;

  padding: 0;
  margin: 0;

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

  font-size: 1.1rem;
  line-height: 1;

  border: 2px solid #c9a227;
  border-radius: 8px;
  background: #d3ead9;
  color: #1f5c42;

  box-shadow: 0 0 0 2px #fff inset, 0 2px 4px rgba(0,0,0,0.15);
}

.stepper-btn:hover {
  background: #bfe2cd;
}

input[type="number"] {
  width: 100%;
  box-sizing: border-box;

  padding: 10px 12px;
  font-size: 1rem;

  border: 2px solid #c9a227;
  border-radius: 8px;

  background: #fbfff9;
  color: #2c2c2c;

  outline: none;
  text-align: center;

  -moz-appearance: textfield;
}

/* remove native number spinners (replaced by our own stepper) */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* =========================================================
   BUTTONS
   ========================================================= */
button {
  padding: 10px 16px;

  background: #cdeedd;
  border: 2px solid #c9a227;
  border-radius: 8px;

  font-size: 0.95rem;
  font-weight: bold;
  color: #1f5c42;

  box-shadow: 0 0 0 2px #fff inset, 0 2px 4px rgba(0,0,0,0.15);

  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

button:hover {
  transform: scale(1.03);
  box-shadow: 0 0 0 2px #fff inset, 0 3px 6px rgba(0,0,0,0.22);
}

button:active {
  transform: scale(0.98);
}

#feedback-form button[type="submit"] {
  width: 100%;
  margin-top: 4px;
  background: #1f7a4c;
  color: #fbfff9;
  border-color: #b8860b;
}

/* Shuffle: a small, low-key side option — not meant to draw attention */
#shuffle-button {
  display: block;
  margin: 0 0 16px;
  padding: 4px 10px;

  font-size: 0.75rem;
  font-weight: normal;
  color: #4a7a63;

  background: transparent;
  border: 1px dashed #a9c9b6;
  border-radius: 6px;

  box-shadow: none;
}

#shuffle-button:hover {
  background: rgba(191, 226, 205, 0.4);
  transform: none;
  box-shadow: none;
}

/* Reset: the primary "start over" action — should stand out */
#reset-button {
  padding: 12px 22px;

  font-size: 1.05rem;
  font-weight: bold;
  color: #4a2e00;

  background: linear-gradient(to bottom, #f3d878, #d9a441);
  border: 2px solid #8a6100;
  border-radius: 10px;

  box-shadow:
    0 0 0 2px #fff inset,
    0 4px 10px rgba(0,0,0,0.25),
    0 0 10px rgba(217, 164, 65, 0.5);
}

#reset-button:hover {
  transform: scale(1.05);
  box-shadow:
    0 0 0 2px #fff inset,
    0 5px 12px rgba(0,0,0,0.3),
    0 0 14px rgba(217, 164, 65, 0.65);
}

/* =========================================================
   ERROR MESSAGE
   ========================================================= */
.error {
  margin-top: 14px;

  color: #7a1f1f;
  font-weight: bold;

  padding: 10px 14px;
  border-radius: 8px;

  background: rgba(122, 31, 31, 0.08);
  border: 1px solid rgba(122, 31, 31, 0.3);

  box-shadow: 0 0 6px rgba(122, 31, 31, 0.15);
}

/* =========================================================
   HISTORY PANEL
   ========================================================= */
.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.history-header h2 {
  margin: 0;
}

#history-table {
  width: 100%;
  border-collapse: collapse;
  background: #fbfff9;
  border-radius: 8px;
  overflow: hidden;
}

#history-table th,
#history-table td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid #cdeedd;
}

#history-table th {
  background: #1f7a4c;
  color: #fbfff9;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

#history-table tbody tr:nth-child(even) {
  background: #eafaf1;
}

#history-table tbody tr:hover {
  background: #d3ead9;
}

.edit-btn,
.save-edit-btn,
.cancel-edit-btn {
  padding: 4px 10px;
  font-size: 0.8rem;
}

.edit-correct,
.edit-incorrect {
  width: 50px;
  padding: 4px;
  text-align: center;
  border: 2px solid #c9a227;
  border-radius: 6px;
}

/* =========================================================
   UTILITY
   ========================================================= */
.hidden {
  display: none;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 600px) {
  #app {
    padding: 18px;
  }

  h1 {
    font-size: 2rem;
  }

  .peg-row {
    grid-template-columns: repeat(2, 1fr);
  }
}
