:root {
  --bg: linear-gradient(180deg, #f8f2e9 0%, #f1ece2 45%, #efe3d3 100%);
  --panel: rgba(255, 252, 246, 0.88);
  --panel-strong: #fff9f1;
  --text: #2b241c;
  --muted: #72675c;
  --line: rgba(70, 46, 24, 0.14);
  --accent: #b95c35;
  --accent-dark: #8c3f1b;
  --accent-soft: rgba(185, 92, 53, 0.12);
  --danger: #a14833;
  --shadow: 0 18px 50px rgba(74, 49, 24, 0.12);
  --radius: 24px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Trebuchet MS", "Avenir Next", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.75), transparent 35%),
    radial-gradient(circle at bottom right, rgba(185, 92, 53, 0.12), transparent 28%),
    var(--bg);
}

button,
input,
select {
  font: inherit;
}

.shell {
  width: min(1120px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 32px 0 48px;
}

.shell-admin {
  width: min(1280px, calc(100vw - 32px));
}

.hero,
.panel,
.board-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  justify-content: space-between;
  padding: 28px;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent-dark);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

.hero-copy h1,
.panel-heading h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.hero-copy p,
.panel-heading p,
#boardMeta,
.status {
  color: var(--muted);
}

.hero-copy p,
.panel-heading p,
#boardMeta {
  margin: 10px 0 0;
  line-height: 1.5;
}

.admin-link,
.share-link {
  color: var(--accent-dark);
  text-decoration: none;
}

.admin-link {
  white-space: nowrap;
  padding: 12px 16px;
  border-radius: 999px;
  background: var(--accent-soft);
}

.board-panel,
.panel {
  padding: 24px;
}

.toolbar,
.button-row,
.inline-fields,
.admin-grid,
.share-box {
  display: flex;
  gap: 12px;
}

.toolbar {
  justify-content: flex-end;
  margin-bottom: 18px;
}

.admin-grid {
  align-items: flex-start;
}

.panel {
  flex: 1;
}

.panel-wide {
  flex: 1.4;
}

.stacked-form {
  display: grid;
  gap: 14px;
}

.inline-fields {
  flex-wrap: wrap;
}

.field {
  display: grid;
  gap: 8px;
  flex: 1;
}

.field span,
.share-label {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--muted);
}

input,
select,
button {
  border-radius: 16px;
  border: 1px solid var(--line);
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.88);
}

button {
  cursor: pointer;
  background: var(--accent);
  color: #fff7f1;
  border-color: transparent;
  transition: transform 120ms ease, background 120ms ease;
}

button:hover {
  transform: translateY(-1px);
  background: var(--accent-dark);
}

.ghost-button {
  background: transparent;
  color: var(--text);
  border-color: var(--line);
}

.danger-button {
  background: var(--danger);
}

.share-box {
  align-items: center;
  justify-content: space-between;
  margin-top: 20px;
  padding: 16px;
  border-radius: 20px;
  background: var(--panel-strong);
  border: 1px dashed var(--line);
}

.qr-image {
  width: 120px;
  height: 120px;
  padding: 8px;
  border-radius: 18px;
  background: white;
  border: 1px solid var(--line);
}

.board {
  display: grid;
  gap: 12px;
}

.square {
  display: grid;
  place-items: center;
  gap: 10px;
  min-height: 124px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 22px;
  color: var(--text);
  background: rgba(255, 250, 245, 0.95);
  text-align: center;
}

.square.filled {
  background: linear-gradient(180deg, rgba(136, 179, 123, 0.28), rgba(90, 137, 88, 0.44));
  border-color: rgba(82, 125, 78, 0.5);
}

.square.free {
  background: linear-gradient(180deg, rgba(255, 213, 145, 0.4), rgba(250, 177, 86, 0.55));
}

.square-media {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 20px;
  background: rgba(185, 92, 53, 0.08);
  overflow: hidden;
  font-size: 2rem;
}

.square-media img,
.item-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.square-label {
  font-size: 0.95rem;
  line-height: 1.3;
}

.items-list {
  display: grid;
  gap: 14px;
  margin-top: 20px;
}

.item-card {
  display: grid;
  grid-template-columns: 88px 1fr auto;
  gap: 14px;
  padding: 16px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  align-items: center;
}

.item-preview {
  width: 88px;
  height: 88px;
  display: grid;
  place-items: center;
  background: rgba(185, 92, 53, 0.08);
  border-radius: 18px;
  overflow: hidden;
}

.item-emoji {
  font-size: 2.1rem;
}

.item-image {
  display: none;
}

.item-title,
.item-meta {
  margin: 0;
}

.item-title {
  font-size: 1.05rem;
}

.item-meta {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.92rem;
}

.status {
  margin-top: 18px;
  min-height: 1.4em;
}

.status.error {
  color: var(--danger);
}

@media (max-width: 900px) {
  .hero,
  .admin-grid,
  .share-box,
  .item-card {
    grid-template-columns: 1fr;
    display: grid;
  }

  .button-row,
  .inline-fields {
    flex-direction: column;
  }

  .toolbar {
    justify-content: stretch;
  }

  .toolbar button,
  .button-row button {
    width: 100%;
  }
}

.board-footer {
  display: flex;
  justify-content: center;
  margin-top: 20px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(29, 18, 10, 0.52);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 20;
}

.modal {
  width: min(520px, 100%);
  border-radius: 24px;
  border: 1px solid var(--line);
  background: #fffaf3;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.18);
  padding: 24px;
}

.modal h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
}

.modal p {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.modal-actions {
  margin-top: 20px;
  justify-content: flex-end;
}

[hidden] {
  display: none !important;
}
