:root {
  --bg: #f6efe4;
  --panel: #fffaf2;
  --line: #e9dcc7;
  --text: #2b2620;
  --sub: #6b655d;
  --primary: #0d9488;
  --primary-deep: #0f766e;
  --accent: #f59e0b;
  --warning: #dc2626;
  --ok-bg: #dcfce7;
  --ok-text: #166534;
  --err-bg: #fee2e2;
  --err-text: #991b1b;
  --shadow: 0 12px 30px rgba(18, 21, 28, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Sarabun", "Prompt", sans-serif;
  background: linear-gradient(145deg, #f7e7c9 0%, #f3efe8 42%, #ebf5f3 100%);
}

.page-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 7% 18%, rgba(245, 158, 11, 0.16), transparent 28%),
    radial-gradient(circle at 89% 18%, rgba(13, 148, 136, 0.16), transparent 25%);
  z-index: 0;
}

.layout {
  position: relative;
  z-index: 1;
  width: min(1160px, calc(100% - 2rem));
  margin: 1.25rem auto 2rem;
  display: grid;
  gap: 1rem;
}

.hero {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 1rem;
  align-items: end;
}

.eyebrow {
  margin: 0 0 0.5rem;
  font: 600 0.8rem/1 "Prompt", sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary-deep);
}

h1 {
  margin: 0;
  font: 700 clamp(1.7rem, 3.1vw, 2.45rem) / 1.15 "Prompt", sans-serif;
}

.subtitle {
  margin: 0.65rem 0 0;
  max-width: 65ch;
  color: var(--sub);
}

.hero-actions {
  margin-top: 0.85rem;
}

.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.stat-card {
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.stat-card span {
  display: block;
  color: var(--sub);
  font-size: 0.88rem;
}

.stat-card strong {
  display: block;
  margin-top: 0.35rem;
  font: 700 1.45rem/1.1 "Prompt", sans-serif;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1rem;
  box-shadow: var(--shadow);
}

.panel h2 {
  margin: 0 0 0.8rem;
  font: 600 1.26rem/1.2 "Prompt", sans-serif;
}

.create-panel {
  background: linear-gradient(140deg, #fff8ee 0%, #f3fbf9 100%);
}

.grid-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

label {
  display: grid;
  gap: 0.35rem;
  color: var(--sub);
  font-size: 0.92rem;
}

label.wide {
  grid-column: 1 / -1;
}

input,
textarea {
  width: 100%;
  border: 1px solid #d8ccb8;
  border-radius: 10px;
  padding: 0.62rem 0.65rem;
  font: 400 0.98rem/1.4 "Sarabun", sans-serif;
  color: var(--text);
  background: #fffdf9;
}

input:focus,
textarea:focus {
  outline: 2px solid rgba(13, 148, 136, 0.22);
  border-color: var(--primary);
}

.btn {
  border: 0;
  border-radius: 12px;
  padding: 0.62rem 0.95rem;
  cursor: pointer;
  font: 600 0.95rem/1 "Prompt", sans-serif;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  width: fit-content;
  color: #fff;
  background: linear-gradient(140deg, var(--primary) 0%, var(--primary-deep) 100%);
}

.btn-accent {
  color: #fff;
  background: linear-gradient(140deg, #f59e0b 0%, #d97706 100%);
}

.btn-warning {
  margin-top: 0.55rem;
  color: #fff;
  background: linear-gradient(140deg, #ef4444 0%, #b91c1c 100%);
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: #0b3f3a;
  border: 1px solid rgba(13, 148, 136, 0.48);
  background: rgba(204, 251, 241, 0.5);
}

.flash-stack {
  display: grid;
  gap: 0.5rem;
}

.flash {
  margin: 0;
  border-radius: 12px;
  padding: 0.7rem 0.85rem;
  font-weight: 600;
}

.flash-success {
  background: var(--ok-bg);
  color: var(--ok-text);
}

.flash-error {
  background: var(--err-bg);
  color: var(--err-text);
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
}

.pill {
  border-radius: 999px;
  background: rgba(13, 148, 136, 0.1);
  color: var(--primary-deep);
  font: 600 0.85rem/1 "Prompt", sans-serif;
  padding: 0.35rem 0.65rem;
}

.item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 0.9rem;
}

.item-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.95rem;
  background: #fffdfa;
}

.item-card header {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: flex-start;
}

.item-card h3,
.closed-card h3 {
  margin: 0;
  font: 600 1.03rem/1.2 "Prompt", sans-serif;
}

.status-open {
  flex-shrink: 0;
  font: 600 0.78rem/1 "Prompt", sans-serif;
  color: #0f766e;
  background: #ccfbf1;
  border-radius: 999px;
  padding: 0.32rem 0.5rem;
}

.status-closed {
  flex-shrink: 0;
  font: 600 0.78rem/1 "Prompt", sans-serif;
  color: #9a3412;
  background: #ffedd5;
  border-radius: 999px;
  padding: 0.32rem 0.5rem;
}

.status-queued {
  flex-shrink: 0;
  font: 600 0.78rem/1 "Prompt", sans-serif;
  color: #4338ca;
  background: #e0e7ff;
  border-radius: 999px;
  padding: 0.32rem 0.5rem;
}

.desc {
  margin: 0.6rem 0;
  color: var(--sub);
}

.price-box {
  border-radius: 12px;
  background: #fef3c7;
  border: 1px solid #fcd34d;
  padding: 0.7rem;
}

.price-box p {
  margin: 0.2rem 0;
}

.highlight {
  color: #b45309;
  font-size: 1.05rem;
}

.meta {
  margin: 0.65rem 0;
  font-size: 0.86rem;
  color: var(--sub);
}

.bid-form {
  display: grid;
  gap: 0.55rem;
}

details {
  margin-top: 0.8rem;
}

summary {
  cursor: pointer;
  color: #1d4ed8;
  font-weight: 600;
}

.history {
  margin: 0.6rem 0 0;
  padding-left: 1rem;
  display: grid;
  gap: 0.42rem;
}

.empty,
.empty-inline {
  color: var(--sub);
}

.closed-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.8rem;
}

.closed-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fffdfa;
  padding: 0.8rem;
}

.closed-card p {
  margin: 0.45rem 0;
}

.winner {
  margin: 0.55rem 0 0;
  color: #065f46;
  font-weight: 600;
}

.winner.no-bid {
  color: #9a3412;
}

.board-body {
  position: relative;
  min-height: 100vh;
  background: linear-gradient(140deg, #7f1d1d 0%, #b91c1c 34%, #ef4444 100%);
}

.board-layout {
  position: relative;
  z-index: 1;
  width: min(1300px, calc(100% - 1.5rem));
  margin: 1rem auto 2rem;
  display: grid;
  gap: 1rem;
}

.board-body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(circle at 15% 20%, rgba(255, 255, 255, 0.14), transparent 33%);
}

.display-title-only {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 1rem;
}

.display-title-only h1 {
  margin: 0;
  color: #fff7f7;
  text-shadow: 0 3px 22px rgba(27, 4, 4, 0.56);
  font: 700 clamp(1.7rem, 5.5vw, 4.9rem) / 1.3 "Prompt", sans-serif;
}

.display-title-only h1 span {
  color: #fee2e2;
}

.display-title-header {
  min-height: auto;
  padding: 0.5rem 1rem;
}

.display-title-header h1 {
  font-size: clamp(1.45rem, 4vw, 3.15rem);
  text-align: left;
}

.display-title-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.title-event-icon {
  height: calc(clamp(1.45rem, 4vw, 3.15rem) * 3 * 1.25);
  width: auto;
  border-radius: 14px;
  border: 2px solid #fecaca;
  box-shadow: 0 8px 20px rgba(52, 10, 10, 0.28);
  background: rgba(255, 245, 245, 0.92);
}

.board-hero {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-end;
}

.board-actions {
  display: grid;
  gap: 0.55rem;
  justify-items: end;
}

.event-title {
  margin: 0.55rem 0 0;
  color: #4b3a14;
  font: 700 clamp(1.05rem, 2.2vw, 1.6rem) / 1.35 "Prompt", sans-serif;
}

.event-title span {
  color: #92400e;
}

.board-updated {
  margin: 0;
  color: var(--sub);
  font-size: 0.92rem;
}

.board-highlight {
  border: 1px solid #fecaca;
  border-radius: 20px;
  background: linear-gradient(140deg, rgba(255, 244, 244, 0.94) 0%, rgba(255, 236, 236, 0.9) 100%);
  box-shadow: var(--shadow);
  padding: 1.25rem 1rem;
  text-align: center;
}

.board-highlight-label {
  margin: 0;
  color: #92400e;
  font: 600 0.85rem/1 "Prompt", sans-serif;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.board-highlight-title {
  margin: 0.5rem auto 0;
  max-width: 34ch;
  font: 700 clamp(1.5rem, 3vw, 2.4rem) / 1.15 "Prompt", sans-serif;
  color: #3f3110;
}

.board-highlight-price {
  margin: 0.7rem 0 0;
  font: 700 clamp(2.4rem, 7vw, 5.5rem) / 0.92 "Prompt", sans-serif;
  color: #b45309;
}

.board-highlight-price span {
  font: 600 clamp(0.95rem, 1.5vw, 1.3rem) / 1 "Prompt", sans-serif;
  color: #7c2d12;
}

.board-highlight-meta {
  margin: 0.65rem 0 0;
  color: #5b4c35;
  font-size: 0.95rem;
}

.current-item-block {
  text-align: center;
}

.current-item-block .board-highlight-title {
  font-size: clamp(1.9rem, 4.2vw, 3.35rem);
}

.current-item-block .board-highlight-price {
  font-size: clamp(3rem, 8vw, 6.2rem);
}

.current-item-block .board-highlight-meta {
  font-size: clamp(1.15rem, 2.2vw, 1.65rem);
  font-weight: 600;
}

.board-panel {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 244, 244, 0.94);
  box-shadow: var(--shadow);
  padding: 1rem;
}

.board-table-wrap {
  overflow-x: auto;
}

.board-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 900px;
}

.board-table th,
.board-table td {
  text-align: left;
  padding: 0.78rem 0.68rem;
  border-bottom: 1px solid #ece0cd;
}

.board-table th {
  font: 600 0.95rem/1.2 "Prompt", sans-serif;
  color: #3f0f0f;
  background: #ffe4e6;
  position: sticky;
  top: 0;
  z-index: 2;
}

.board-table td {
  background: #fff8f8;
}

.board-row-open td {
  background: #fff5f5;
}

.board-row-queued td {
  background: #fff1f2;
}

.board-row-closed td {
  background: #ffe4e6;
}

.board-rank {
  font: 700 1.1rem/1 "Prompt", sans-serif;
  color: #475569;
  width: 52px;
}

.board-product {
  font: 600 1rem/1.25 "Prompt", sans-serif;
}

.board-price {
  min-width: 170px;
}

.board-price-value {
  display: block;
  font: 700 clamp(1.4rem, 3.2vw, 2.2rem) / 0.95 "Prompt", sans-serif;
  color: #991b1b;
  letter-spacing: 0.01em;
}

.board-price small {
  display: block;
  margin-top: 0.2rem;
  color: #7c2d12;
  font: 600 0.74rem/1 "Prompt", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

@media (max-width: 980px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .board-hero {
    flex-direction: column;
    align-items: flex-start;
  }

  .board-actions {
    justify-items: start;
  }
}

@media (max-width: 760px) {
  .layout {
    width: min(100%, calc(100% - 1rem));
  }

  .stats,
  .grid-form {
    grid-template-columns: 1fr;
  }

  .btn-primary {
    width: 100%;
  }

  .board-layout {
    width: min(100%, calc(100% - 1rem));
  }

  .display-title-row {
    flex-direction: column;
    gap: 0.65rem;
  }

  .display-title-header h1 {
    text-align: center;
  }
}
