:root {
  --bg: #0f1724;
  --card: rgba(255, 255, 255, 0.06);
  --muted: rgba(255, 255, 255, 0.7);
  --accent: #6ee7b7;
  --radius: 10px;
  --shadow: 0 6px 18px rgba(2, 6, 23, 0.6);
  --glass: rgba(255, 255, 255, 0.03);
}

* {
  font-family: Arial, Helvetica, sans-serif;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%
}

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  background: linear-gradient(180deg, var(--bg), #071025);
  color: #fff;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  transition: background-color 400ms ease;
}

.container {
  width: 100%;
  max-width: 600px;

  background-color: rgba(225, 225, 225, .3);
  backdrop-filter: blur(10px);

  padding: 30px;

  box-shadow: 0 4px 10px rgba(0, 0, 0, .1);
  border-radius: 12px;
}

.header h1 {
  margin: 0 0 6px;
  font-size: 1.6rem;
  letter-spacing: -0.02em;
}

.subtitle {
  margin: 0;
  color: var(--muted)
}

.panel {
  display: flex;
  gap: 20px;
  margin-top: 18px;
  width: 100%;
  background: var(--card);
  padding: 18px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  align-items: center;
}

.swatch {
  width: 160px;
  height: 120px;
  border-radius: 10px;
  box-shadow: 0 8px 30px rgba(2, 6, 23, 0.6), inset 0 -6px 18px rgba(0, 0, 0, 0.15);
  flex: 0 0 160px;
  transition: background-color 350ms ease;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.controls {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.color-code {
  font-weight: 700;
  font-size: 1.25rem;
  padding: 8px 12px;
  background: var(--glass);
  border-radius: 8px;
  display: inline-block;
  width: max-content;
  min-width: 150px;
  text-align: center;
  transition: color 200ms ease, background-color 200ms ease;
}

button {
  width: 100%;
  max-width: 250px;
  background-color: #333;
  color: #fff;
  font-size: 1rem;
  font-weight: bold;
  border: none;
  border-radius: 8px;
  padding: 12px;
  margin: 5px;
  cursor: pointer;
  transition: all .3s;
}

button:hover {
  background-color: #555;
  transform: scale(1.05);
}

.buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap
}

.btn {
  background: transparent;
  color: var(--muted);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: transform .12s ease, background-color .12s ease, color .12s ease;
}

.btn:hover {
  transform: translateY(-3px)
}

.btn.primary {
  background: linear-gradient(90deg, #10b981, #06b6d4);
  color: #062026;
  border: none;
  font-weight: 600;
}

#history {
  margin-top: 20px;
  font-size: 1rem;
}

.history {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  /* ensure items wrap instead of overflowing */
  overflow: visible;
}

.history .item {
  display: inline-flex;
  min-width: 88px;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 10px;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: transform .12s ease;
  flex: 0 0 auto;
  /* ensure each history item participates in layout */
}

.history .item:hover {
  transform: translateY(-3px)
}

.footer {
  margin-top: 12px;
  color: rgba(255, 255, 255, 0.55)
}

@media(max-width:560px) {
  .panel {
    flex-direction: column;
    align-items: flex-start
  }

  .swatch {
    width: 100%;
    height: 120px
  }

  .buttons {
    width: 100%
  }
}