/* Global layout en styling */

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

body {
  background: black;
  color: white;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

#app {
  display: grid;
  grid-template-areas:
    "controls controls controls"
    "equation equation equation"
    "challenge main right"
    "challenge bottom right";
  grid-template-rows: 45px 45px 1fr 110px;
  grid-template-columns: 200px 1fr 100px;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  max-height: 100vh;
}

#challenge-panel {
  grid-area: challenge;
  background: #1a1a1a;
  border-right: 2px solid #333;
  width: 200px;
  min-width: 200px;
  padding: 15px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
}

#controls {
  grid-area: controls;
  padding: 8px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #1a1a1a;
  height: 45px;
  min-height: 45px;
}

#equation-panel {
  grid-area: equation;
  padding: 6px 10px;
  background: #1a1a1a;
  border-bottom: 2px solid #333;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  overflow: hidden;
  height: 45px;
  min-height: 45px;
}

#equation-panel label {
  color: #FFD700;
  font-size: 12px;
  font-weight: bold;
  white-space: nowrap;
}

#equation-input {
  flex: 1;
  min-width: 150px;
  padding: 6px 10px;
  background: #2a2a2a;
  border: 2px solid #555;
  border-radius: 5px;
  color: white;
  font-size: 12px;
  font-family: 'Courier New', monospace;
}

#btn-apply-equation,
#btn-clear-equation {
  padding: 6px 12px;
  font-size: 14px;
}

#equation-input:focus {
  outline: none;
  border-color: #FFD700;
}

#equation-input::placeholder {
  color: #666;
}

#controls h1 {
  font-size: 16px;
  color: #FFD700;
}

#grid-container {
  grid-area: main;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  overflow: hidden;
  min-height: 0;
}

#bottom-toolbar {
  grid-area: bottom;
  background: #1a1a1a;
  border-top: 2px solid #333;
  height: 110px;
  min-height: 110px;
  overflow: visible;
}

#right-toolbar {
  grid-area: right;
  background: #1a1a1a;
  border-left: 2px solid #333;
  overflow-y: auto;
}

/* Control buttons */
.control-btn {
  background: #2a2a2a;
  border: 2px solid #555;
  color: white;
  padding: 6px 12px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s ease;
}

.control-btn:hover {
  background: #3a3a3a;
  border-color: #777;
}

.control-btn:active {
  transform: scale(0.95);
}

/* Wissen button extra groot */
#btn-clear {
  padding: 12px 24px;
  font-size: 20px;
  font-weight: bold;
  border-width: 3px;
}

#btn-clear:hover {
  background: #ff4444;
  border-color: #ff6666;
}

/* Challenge Mode Styling */
.challenge-btn {
  background: linear-gradient(135deg, #ff6b6b, #4ecdc4);
  border: none;
  color: white;
  padding: 12px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  font-weight: bold;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(255, 107, 107, 0.3);
}

.challenge-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
}

.challenge-btn:active {
  transform: translateY(0);
}

.challenge-btn.secondary {
  background: linear-gradient(135deg, #667eea, #764ba2);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.challenge-btn.secondary:hover {
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

#target-number {
  background: #2a2a2a;
  border: 3px solid #FFD700;
  border-radius: 12px;
  width: 120px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  font-weight: bold;
  color: #FFD700;
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
}

#target-image {
  width: 100px;
  height: 100px;
  object-fit: contain;
  border-radius: 8px;
  border: 2px solid #555;
  background: #2a2a2a;
}

#challenge-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
}

/* Toolbar buttons */
#numberblock-selector {
  display: flex;
  gap: 8px;
  padding: 10px;
  overflow-x: auto;
  overflow-y: hidden;
}

.numberblock-btn {
  flex-shrink: 0;
  width: 90px;
  height: 90px;
  border: 2px solid #555;
  border-radius: 8px;
  background: #2a2a2a;
  cursor: pointer;
  padding: 5px;
  transition: all 0.2s ease;
}

.numberblock-btn img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.numberblock-btn.selected {
  border-color: #FFD700;
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.numberblock-btn:hover {
  transform: scale(1.05);
  border-color: #777;
}

#size-selector {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  overflow-y: auto;
}

.size-btn {
  flex-shrink: 0;
  width: 70px;
  height: 70px;
  border: 2px solid #555;
  border-radius: 8px;
  background: #2a2a2a;
  cursor: pointer;
  padding: 5px;
  transition: all 0.2s ease;
}

.size-btn img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.size-btn.selected {
  border-color: #FFD700;
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.size-btn:hover {
  transform: scale(1.05);
  border-color: #777;
}

.size-fallback {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: white;
}

.size-number {
  font-size: 20px;
  font-weight: bold;
}

.size-dimensions {
  font-size: 12px;
  color: #888;
}
