* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at top, #5c3d2e 0%, #2b1810 70%),
    repeating-linear-gradient(
      90deg,
      rgba(255, 248, 239, 0.03) 0 2px,
      transparent 2px 28px
    );
  font-family: 'Press Start 2P', monospace;
  color: #fff8ef;
  padding: 40px 16px 24px;
}

#app {
  width: min(1080px, 100%);
  position: relative;
}

#home-link {
  position: absolute;
  top: -28px;
  left: 0;
  font-size: 7px;
  color: #e9c46a;
  text-decoration: none;
  z-index: 2;
}

#home-link:hover {
  color: #fff;
}

#fullscreen-btn {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 110;
  border: 2px solid #e9c46a;
  border-radius: 4px;
  background: rgba(43, 24, 16, 0.9);
  color: #fff8ef;
  padding: 7px 9px;
  font: 6px 'Press Start 2P', monospace;
  cursor: pointer;
}

#fullscreen-btn:hover {
  background: #e07a5f;
  color: #2b1810;
}

body:has(.room-badge) #fullscreen-btn {
  top: 78px;
}

.hidden {
  display: none !important;
}

.kicker {
  font-size: 7px;
  letter-spacing: 3px;
  color: #e9c46a;
  margin-bottom: 12px;
}

h1 {
  font-size: 18px;
  line-height: 1.5;
  margin-bottom: 12px;
  text-shadow: 3px 3px 0 #000;
}

.lede,
.submit-lede {
  font-size: 7px;
  line-height: 1.8;
  color: #d4b896;
  margin-bottom: 24px;
  max-width: 640px;
}

.picker-header {
  text-align: center;
  margin-bottom: 8px;
}

.picker-header .lede {
  margin-left: auto;
  margin-right: auto;
}

#page-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}

.page-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 12px 10px 14px;
  background: #fff8ef;
  border: 4px solid #000;
  border-radius: 8px;
  box-shadow: 4px 4px 0 #000;
  cursor: pointer;
  color: #2b1810;
  font-family: inherit;
  text-align: center;
}

.page-card:hover,
.page-card:focus-visible {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 #000;
}

.page-card canvas {
  width: 100%;
  height: 110px;
  background: #fff;
  border: 2px solid #d4b896;
  border-radius: 4px;
}

.page-card h3 {
  font-size: 8px;
  line-height: 1.5;
}

.page-card.submit {
  background: linear-gradient(180deg, #ffb703, #fb8500);
  color: #2b1810;
}

.page-card.submit .submit-plus {
  font-size: 36px;
  line-height: 110px;
  height: 110px;
  width: 100%;
  border: 2px dashed #2b1810;
  border-radius: 4px;
}

.page-card .card-actions {
  display: flex;
  gap: 6px;
}

.page-card .tiny {
  font-size: 7px;
  padding: 6px 8px;
  border: 2px solid #2b1810;
  background: #fff8ef;
  color: #2b1810;
  font-family: inherit;
  cursor: pointer;
}

.color-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.color-bar h2 {
  font-size: 10px;
  flex: 1;
  min-width: 80px;
}

.color-bar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

button {
  font-family: inherit;
  font-size: 7px;
  color: #fff8ef;
  background: #5c3a28;
  border: 3px solid #e07a5f;
  border-radius: 4px;
  padding: 8px 10px;
  cursor: pointer;
}

button:hover,
button.active,
button.primary:hover {
  background: #e07a5f;
  color: #2b1810;
}

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

button.primary {
  background: #2a9d8f;
  border-color: #e9c46a;
  width: 100%;
}

.studio,
.submit-studio {
  display: grid;
  grid-template-columns: 168px 1fr;
  gap: 14px;
  align-items: start;
}

.toolbox {
  background: #2b1810;
  border: 4px solid #e07a5f;
  border-radius: 8px;
  padding: 12px 10px;
}

.box-label {
  font-size: 6px;
  color: #e9c46a;
  margin: 8px 0 8px;
}

.toolbox .box-label:first-child {
  margin-top: 0;
}

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

.tool-btn,
.size-btn {
  flex: 1;
  min-width: 0;
  padding: 8px 0;
  font-size: 14px;
  line-height: 1;
}

.size-btn {
  font-size: 7px;
}

#palette {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.swatch {
  width: 100%;
  aspect-ratio: 1;
  border: 3px solid #000;
  border-radius: 4px;
  cursor: pointer;
  padding: 0;
}

.swatch.active {
  outline: 3px solid #fff8ef;
  outline-offset: 1px;
}

.paper-wrap {
  min-width: 0;
}

.paper {
  position: relative;
  background: #fff;
  border: 4px solid #000;
  border-radius: 6px;
  box-shadow: 6px 6px 0 #000;
  overflow: hidden;
}

.paper canvas {
  display: block;
  width: 100%;
  height: auto;
  touch-action: none;
  cursor: crosshair;
}

#outline-canvas,
#fill-canvas {
  position: relative;
}

#fill-canvas {
  display: block;
}

#outline-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.submit-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.tab-btn {
  min-width: 110px;
}

.submit-studio {
  grid-template-columns: 1fr 240px;
}

.submit-draw-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.submit-side {
  background: #2b1810;
  border: 4px solid #e07a5f;
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#preview-canvas {
  width: 100%;
  height: auto;
  background: #fff;
  border: 2px solid #d4b896;
  border-radius: 4px;
}

.name-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 6px;
  color: #e9c46a;
}

.name-field input,
.upload-btn {
  font-family: inherit;
  font-size: 8px;
  padding: 8px;
  border: 3px solid #e07a5f;
  border-radius: 4px;
  background: #fff8ef;
  color: #2b1810;
}

.upload-btn {
  display: inline-block;
  cursor: pointer;
  text-align: center;
}

.upload-btn input {
  display: none;
}

.status {
  font-size: 6px;
  line-height: 1.7;
  color: #d4b896;
  min-height: 20px;
}

@media (max-width: 820px) {
  .studio,
  .submit-studio {
    grid-template-columns: 1fr;
  }

  .toolbox {
    order: 2;
  }
}
