/** @format */

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=Crimson+Text:wght@400;600&display=swap");

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

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  background: linear-gradient(
    135deg,
    #2c1810 0%,
    #8b4513 25%,
    #d4af37 50%,
    #8b4513 75%,
    #2c1810 100%
  );
  background-size: 400% 400%;
  animation: gradientShift 8s ease infinite;
  min-height: 100vh;
  color: #2c2c2c;
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Ccircle cx='30' cy='30' r='2'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E")
    repeat;
  z-index: -1;
}

@keyframes gradientShift {
  0%,
  100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

header {
  text-align: center;
  margin-bottom: 40px;
  color: #ffffff;
  position: relative;
}

header h1 {
  font-family: "Crimson Text", serif;
  font-size: 3.2em;
  font-weight: 600;
  margin-bottom: 15px;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  letter-spacing: -1px;
  background: linear-gradient(135deg, #ffd700, #fff8dc, #daa520);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  font-size: 1.2em;
  opacity: 0.95;
  font-weight: 300;
  letter-spacing: 0.5px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

header::after {
  content: "☸";
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 2em;
  color: #ffd700;
  opacity: 0.7;
}

.mode-toggle {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 30px;
}

.mode-btn {
  padding: 14px 28px;
  border: 2px solid rgba(255, 215, 0, 0.3);
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff8dc;
  font-size: 1em;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  backdrop-filter: blur(15px);
  letter-spacing: 0.5px;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.mode-btn:hover {
  background: rgba(255, 215, 0, 0.2);
  border-color: rgba(255, 215, 0, 0.6);
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(255, 215, 0, 0.2);
}

.mode-btn.active {
  background: linear-gradient(135deg, #daa520, #ffd700);
  color: #2c1810;
  border-color: #ffd700;
  box-shadow: 0 6px 20px rgba(255, 215, 0, 0.4);
  font-weight: 600;
}

.canvas-container {
  display: flex;
  justify-content: center;
  margin-bottom: 30px;
  position: relative;
}

canvas {
  border: 3px solid rgba(255, 215, 0, 0.6);
  border-radius: 20px;
  background: #fffef7;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
  cursor: crosshair;
  position: relative;
}

canvas::before {
  content: "";
  position: absolute;
  top: -3px;
  left: -3px;
  right: -3px;
  bottom: -3px;
  background: linear-gradient(45deg, #daa520, #ffd700, #daa520);
  border-radius: 23px;
  z-index: -1;
  opacity: 0.6;
}

.controls-panel {
  background: rgba(255, 248, 220, 0.95);
  border: 2px solid rgba(218, 165, 32, 0.3);
  border-radius: 20px;
  padding: 30px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(15px);
  position: relative;
}

.controls-panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #daa520, #ffd700, #daa520);
  border-radius: 20px 20px 0 0;
}

.control-group h3 {
  margin-bottom: 24px;
  color: #8b4513;
  font-size: 1.4em;
  font-weight: 600;
  font-family: "Crimson Text", serif;
  text-align: center;
  position: relative;
  padding-bottom: 10px;
}

.control-group h3::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 2px;
  background: linear-gradient(90deg, transparent, #daa520, transparent);
}

.control-row {
  display: flex;
  align-items: center;
  margin-bottom: 15px;
  gap: 15px;
}

.control-row label {
  min-width: 120px;
  font-weight: 500;
}

input[type="range"] {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: #ddd;
  outline: none;
  -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, #daa520, #ffd700);
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
  border: 2px solid rgba(255, 255, 255, 0.9);
}

input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, #daa520, #ffd700);
  cursor: pointer;
  border: 2px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
}

input[type="color"] {
  width: 50px;
  height: 40px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9em;
  font-weight: 500;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn.primary {
  background: linear-gradient(135deg, #8b4513, #daa520, #8b4513);
  color: #fff8dc;
  box-shadow: 0 6px 20px rgba(218, 165, 32, 0.4);
  border: 2px solid rgba(255, 215, 0, 0.5);
  font-weight: 600;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.btn.primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(218, 165, 32, 0.6);
  background: linear-gradient(135deg, #daa520, #ffd700, #daa520);
  border-color: #ffd700;
}

.btn.secondary {
  background: rgba(255, 248, 220, 0.9);
  color: #8b4513;
  border: 2px solid #daa520;
  font-weight: 500;
}

.btn.secondary:hover {
  background: linear-gradient(135deg, #daa520, #ffd700);
  color: #2c1810;
  border-color: #ffd700;
  transform: translateY(-2px);
}

.color-palette {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.color-swatch {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 3px solid transparent;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.color-swatch:hover {
  transform: scale(1.15);
  border-color: #daa520;
  box-shadow: 0 4px 15px rgba(218, 165, 32, 0.4);
}

.color-swatch.selected {
  border-color: #ffd700;
  transform: scale(1.15);
  box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.3);
}

.action-buttons {
  text-align: center;
  margin-top: 25px;
  padding-top: 25px;
  border-top: 2px solid rgba(218, 165, 32, 0.3);
  position: relative;
}

.action-buttons::before {
  content: "☯";
  position: absolute;
  top: -15px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 248, 220, 0.95);
  color: #daa520;
  font-size: 1.5em;
  padding: 0 15px;
}

span {
  min-width: 30px;
  text-align: center;
  font-weight: bold;
  color: #8b4513;
  font-family: "Crimson Text", serif;
  font-size: 1.1em;
}

/* Mobile Optimization */
@media (max-width: 768px) {
  body {
    font-size: 14px;
  }

  .container {
    padding: 15px 10px;
    max-width: 100%;
  }

  header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
  }

  .subtitle {
    font-size: 1em;
    padding: 0 15px;
  }

  header::after {
    font-size: 1.5em;
    top: -15px;
  }

  /* Canvas mobile optimization */
  .canvas-container {
    margin-bottom: 20px;
    padding: 0 10px;
  }

  canvas {
    width: 100%;
    max-width: 350px;
    height: 350px;
    border-width: 2px;
    border-radius: 15px;
  }

  /* Mode toggle mobile */
  .mode-toggle {
    flex-direction: row;
    gap: 8px;
    margin-bottom: 20px;
    padding: 0 10px;
  }

  .mode-btn {
    flex: 1;
    padding: 12px 16px;
    font-size: 0.9em;
    border-radius: 20px;
  }

  /* Controls panel mobile */
  .controls-panel {
    padding: 20px 15px;
    margin: 0 5px;
    border-radius: 15px;
  }

  .control-group h3 {
    font-size: 1.2em;
    margin-bottom: 16px;
  }

  .control-row {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-bottom: 18px;
  }

  .control-row label {
    min-width: auto;
    font-size: 0.95em;
    font-weight: 600;
  }

  /* Input controls mobile */
  input[type="range"] {
    height: 8px;
    margin: 8px 0;
  }

  input[type="range"]::-webkit-slider-thumb {
    width: 28px;
    height: 28px;
  }

  input[type="range"]::-moz-range-thumb {
    width: 28px;
    height: 28px;
  }

  input[type="color"] {
    width: 60px;
    height: 50px;
    border-radius: 10px;
  }

  /* Button mobile optimization */
  .btn {
    padding: 14px 20px;
    font-size: 0.9em;
    border-radius: 10px;
    min-height: 48px;
    touch-action: manipulation;
  }

  .btn.secondary {
    margin: 5px;
  }

  /* Color palette mobile */
  .color-palette {
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
    padding: 10px;
  }

  .color-swatch {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    border-width: 2px;
  }

  /* Action buttons mobile */
  .action-buttons {
    margin-top: 20px;
    padding-top: 20px;
  }

  .action-buttons::before {
    font-size: 1.2em;
    top: -12px;
  }

  /* Value display mobile */
  span {
    font-size: 1.2em;
    min-width: 40px;
    background: rgba(255, 248, 220, 0.8);
    padding: 4px 8px;
    border-radius: 8px;
    border: 1px solid rgba(218, 165, 32, 0.3);
  }
}

/* Small mobile devices */
@media (max-width: 480px) {
  .container {
    padding: 10px 5px;
  }

  header h1 {
    font-size: 2.2em;
  }

  canvas {
    max-width: 300px;
    height: 300px;
  }

  .mode-toggle {
    flex-direction: column;
    gap: 10px;
  }

  .mode-btn {
    width: 100%;
    max-width: 250px;
    margin: 0 auto;
  }

  .controls-panel {
    margin: 0;
    border-radius: 12px;
  }

  .color-palette {
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
  }

  .color-swatch {
    width: 45px;
    height: 45px;
  }

  .control-row {
    gap: 12px;
  }
}

/* Landscape mobile optimization */
@media (max-width: 768px) and (orientation: landscape) {
  .container {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto 1fr;
    gap: 15px;
    height: 100vh;
    padding: 10px;
  }

  header {
    grid-column: 1 / -1;
    margin-bottom: 0;
  }

  header h1 {
    font-size: 2em;
    margin-bottom: 5px;
  }

  .mode-toggle {
    grid-column: 1 / -1;
    margin-bottom: 0;
  }

  .canvas-container {
    grid-column: 1;
    margin-bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  canvas {
    max-width: 280px;
    height: 280px;
  }

  .controls-panel {
    grid-column: 2;
    width: 280px;
    max-height: 400px;
    overflow-y: auto;
    padding: 15px;
  }

  .control-group h3 {
    font-size: 1.1em;
    margin-bottom: 12px;
  }

  .control-row {
    margin-bottom: 12px;
  }

  .color-palette {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
}
