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

body {
  min-height: 100vh;
}

.game-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

h1 {
  font-size: 2.2rem;
}

.back-button:hover {
  transform: scale(1.05);
}

.factory-layout {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

@media (min-width: 768px) {
  .factory-layout {
    flex-direction: row;
    align-items: flex-start;
  }
}

.factory-stage {
  flex: 1;
  background: linear-gradient(180deg, #1e1e1e 0%, #2a1f2e 100%);
  border-radius: 16px;
  padding: 1.25rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  text-align: center;
  min-width: 0;
}

.client-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.client-label {
  color: var(--teal-muted, #99f6e4);
  font-size: 0.95rem;
}

.client-picker {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.client-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  font-size: 1.4rem;
  background: #2a2a2a;
  transition: transform 0.2s, border-color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.client-btn:hover {
  transform: scale(1.1);
}

.client-btn.active {
  border-color: #2dd4bf;
  box-shadow: 0 0 12px rgba(45, 212, 191, 0.5);
}

.order-bubble {
  background: rgba(45, 212, 191, 0.15);
  border: 2px solid rgba(45, 212, 191, 0.35);
  border-radius: 14px;
  padding: 0.6rem 1rem;
  margin: 0 auto 0.75rem;
  max-width: 300px;
  font-size: 0.9rem;
  color: #99f6e4;
}

#sticker-design {
  touch-action: none;
}

.sticker-draggable {
  cursor: grab;
  user-select: none;
}

.sticker-draggable.is-dragging {
  cursor: grabbing;
}

.sticker-wrap {
  padding: 0.5rem;
}

#sticker-svg {
  width: 100%;
  max-width: 320px;
  height: auto;
  display: block;
  margin: 0 auto;
  filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.4));
}

.client-name-row {
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}

.client-name-label {
  font-size: 0.85rem;
  color: var(--teal-muted, #99f6e4);
}

.client-name-input {
  width: min(100%, 260px);
  padding: 0.55rem 1rem;
  border: 2px solid rgba(45, 212, 191, 0.45);
  border-radius: 50px;
  background-color: rgba(0, 0, 0, 0.35);
  color: #99f6e4 !important;
  font-size: 1.2rem;
  font-family: inherit;
  text-align: center;
}

.client-name-input:focus {
  outline: none;
  border-color: #2dd4bf;
  box-shadow: 0 0 12px rgba(45, 212, 191, 0.4);
}

.hint-text {
  font-size: 0.85rem;
  color: #888;
  margin-top: 0.35rem;
}

.controls-panel {
  flex: 1;
  background-color: #1e1e1e;
  border-radius: 16px;
  padding: 1.25rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  max-height: 85vh;
  overflow-y: auto;
}

.control-section {
  margin-bottom: 1.25rem;
}

.control-section h2 {
  font-size: 1.1rem;
  margin-bottom: 0.6rem;
}

.control-section h2 + h2 {
  margin-top: 1rem;
}

.tool-tabs {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.tool-tab {
  flex: 1;
  min-width: 72px;
  padding: 0.5rem 0.35rem;
  border: 2px solid #444;
  border-radius: 10px;
  background: #2a2a2a;
  color: #ccc;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.8rem;
  transition: background 0.2s, border-color 0.2s;
}

.tool-tab.active {
  background: var(--teal-btn-bg, linear-gradient(180deg, #99f6e4 0%, #2dd4bf 50%, #14b8a6 100%));
  border-color: #2dd4bf;
  color: #0f2928;
}

.tool-panel.hidden {
  display: none;
}

.shape-grid,
.deco-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.45rem;
}

.shape-btn,
.deco-btn,
.border-btn {
  padding: 0.55rem 0.4rem;
  border: 2px solid #444;
  border-radius: 10px;
  background: #2a2a2a;
  color: #ccc;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  transition: background 0.2s, border-color 0.2s;
}

.shape-btn:hover,
.deco-btn:hover,
.border-btn:hover {
  border-color: #2dd4bf;
}

.shape-btn.active,
.border-btn.active {
  border-color: #2dd4bf;
  background: #1a3a38;
  color: #99f6e4;
}

.preset-colors {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.45rem;
  margin-bottom: 0.75rem;
}

.color-btn {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  transition: transform 0.15s;
}

.color-btn.active {
  border-color: #fff;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.4);
}

.custom-color-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: #aaa;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.custom-color-label input[type="color"] {
  width: 48px;
  height: 32px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.text-size-grid {
  margin-bottom: 0.65rem;
}

.text-size-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.text-size-row input[type="range"] {
  flex: 1;
  accent-color: #2dd4bf;
}

#text-size-value {
  min-width: 1.75rem;
  text-align: center;
  color: #99f6e4;
  font-size: 0.95rem;
}

.text-size-btn.active {
  border-color: #2dd4bf;
  background: #1a3a38;
  color: #99f6e4;
}

#sticker-text-input {
  width: 100%;
  padding: 0.65rem 1rem;
  border: 2px solid #444;
  border-radius: 10px;
  background: #2a2a2a;
  color: #fff;
  font-size: 1rem;
  font-family: inherit;
}

#sticker-text-input:focus {
  outline: none;
  border-color: #2dd4bf;
}

.deco-hint {
  font-size: 0.8rem;
  color: #777;
  margin-top: 0.5rem;
}

.action-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.action-btn {
  padding: 0.7rem 1rem;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95rem;
  transition: transform 0.2s;
  background: #333;
  color: #eee;
}

.action-btn:hover {
  transform: scale(1.03);
}

.action-btn.primary {
  background: var(--teal-btn-bg, linear-gradient(180deg, #99f6e4 0%, #2dd4bf 50%, #14b8a6 100%));
  color: #0f2928;
  font-weight: bold;
}

.action-btn.save-picture {
  background: linear-gradient(180deg, #99f6e4 0%, #2dd4bf 50%, #14b8a6 100%);
  color: #0f2928;
  font-weight: bold;
}

.action-btn.small {
  padding: 0.5rem 0.85rem;
  font-size: 0.85rem;
  width: 100%;
  margin-top: 0.35rem;
}

.reveal-card .action-btn {
  width: 100%;
  margin-bottom: 0.5rem;
}

.reveal-card .action-btn:last-child {
  margin-bottom: 0;
}

.reveal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}

.reveal-overlay.hidden {
  display: none;
}

.reveal-card {
  background: linear-gradient(180deg, #1e1e1e 0%, #2a1f2e 100%);
  border: 3px solid #2dd4bf;
  border-radius: 20px;
  padding: 2rem;
  text-align: center;
  max-width: 340px;
  box-shadow: 0 0 40px rgba(45, 212, 191, 0.35);
  animation: pop-in 0.4s ease;
}

@keyframes pop-in {
  from {
    transform: scale(0.85);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.reveal-emoji {
  font-size: 3rem;
  margin-bottom: 0.5rem;
}

.reveal-title {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.reveal-msg {
  color: #99f6e4;
  margin-bottom: 1.25rem;
  font-size: 1.05rem;
}
