:root {
  --primary-color: rgba(106, 13, 173, 0.9);
  --secondary-color: rgba(138, 43, 226, 0.9);
  --background-color: #f4f4f4;
  --text-color: #333;
  --error-color: #ff4444;
  --shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
  --gradient: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
}

[data-theme="dark"] {
  --primary-color: rgba(75, 0, 130, 0.9);
  --secondary-color: rgba(106, 13, 173, 0.9);
  --background-color: #1e1e1e;
  --text-color: #ffffff;
  --error-color: #ff6666;
  --gradient: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
}

[data-theme="dark"] h1,
[data-theme="dark"] label {
  color: #ffffff;
}

/* ======= Layout ======= */
body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--background-color);
  color: var(--text-color);
  margin: 0;
  padding: 2rem;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  transition: background-color 0.4s ease, color 0.4s ease;
}

.container {
  background: rgba(255, 255, 255, 0.15);
  padding: 2.8rem 2rem;
  border-radius: 22px;
  box-shadow: var(--shadow);
  max-width: 540px;
  width: 100%;
  text-align: center;
  backdrop-filter: blur(14px);
  transition: background 0.4s ease, color 0.4s ease;
  margin: auto;
}

[data-theme="dark"] .container {
  background: rgba(255, 255, 255, 0.08);
}

h1 {
  color: var(--primary-color);
  margin-bottom: 2rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

/* ======= Fish Grid ======= */
.fish-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  column-gap: 2rem;
  row-gap: 2rem;
  justify-items: center;
  margin-top: 1.8rem;
  padding: 0 0.5rem;
}

.fish-card {
  background: var(--gradient);
  color: white;
  padding: 1.5rem 1rem;
  border-radius: 16px;
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
  width: 100%;
  max-width: 200px;
  text-align: center;
}

.fish-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.25);
}

.fish-card i {
  font-size: 1.9rem;
  margin-bottom: 0.7rem;
  display: block;
}

.fish-card span {
  font-size: 1.1rem;
  font-weight: 600;
  display: inline-block;
}

/* ======= Forms and Inputs ======= */
.hidden {
  display: none;
}

.input-group {
  margin-bottom: 1.3rem;
  text-align: left;
}

label {
  display: block;
  margin-bottom: 0.4rem;
  font-weight: 600;
  color: var(--primary-color);
}

.hint {
  display: block;
  font-size: 0.8rem;
  opacity: 0.8;
  margin-top: 0.2rem;
}

input {
  width: 100%;
  padding: 0.6rem;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 1rem;
  box-shadow: var(--shadow);
  background-color: rgba(255, 255, 255, 0.3);
  color: var(--text-color);
  transition: all 0.3s ease;
}

input:focus {
  outline: none;
  border: 1px solid var(--secondary-color);
  background-color: rgba(255, 255, 255, 0.5);
}

button {
  width: 100%;
  padding: 0.9rem;
  background: var(--gradient);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.3s ease, transform 0.2s ease;
  box-shadow: var(--shadow);
  margin-top: 0.8rem;
}

button:hover {
  background: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
  transform: translateY(-1px);
}

/* ======= Result ======= */
.result-container {
  margin-top: 1.8rem;
  padding: 1.2rem;
  background-color: rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  color: var(--text-color);
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
  text-align: left;
}

.back-button {
  margin-top: 1.2rem;
  background: var(--secondary-color);
}

/* Error text */
.error {
  color: var(--error-color);
  font-weight: 600;
  margin: 0.3rem 0;
}

/* ======= Theme Toggle ======= */
.theme-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  cursor: pointer;
  color: var(--primary-color);
  font-size: 1.6rem;
  transition: color 0.3s ease;
  z-index: 10;
}

.theme-toggle:hover {
  color: var(--secondary-color);
}

/* ======= Animation ======= */
.fade {
  animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ======= Responsive Design ======= */
@media (max-width: 600px) {
  body {
    padding: 1rem;
  }

  .container {
    padding: 1.8rem 1.2rem;
    max-width: 95%;
  }

  h1 {
    font-size: 1.5rem;
  }

  .fish-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    column-gap: 1.4rem;
    row-gap: 1.4rem;
  }

  .fish-card {
    padding: 1.2rem 0.8rem;
    max-width: 180px;
  }
}
