/* What The Fish — style.css */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Caveat', cursive;
  background: #d6eaf8;
  touch-action: manipulation;
}

/* ── Hash badge (shown in subtitle) ──────────────────────── */

.hash-badge {
  display: inline-block;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  background: rgba(0,0,0,0.08);
  color: #555;
  border-radius: 6px;
  padding: 1px 7px;
  vertical-align: middle;
  font-family: monospace;
}

/* ── Pages ───────────────────────────────────────────────── */

/* create.html — scrolls normally */
#creator-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  padding: 1.2rem 1rem 2.5rem;
  gap: 0.4rem;
}

/* index.html — fixed full-screen, no scroll */
#aquarium-view {
  display: block;
  position: fixed;
  inset: 0;
  overflow: hidden;
}

/* ── Empty state (aquarium with no fish) ─────────────────── */

.empty-state {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.2rem;
  pointer-events: none;
}

.empty-title {
  font-family: 'Caveat', cursive;
  font-size: clamp(1.4rem, 5vw, 2rem);
  color: rgba(26, 82, 118, 0.7);
  text-align: center;
}

.empty-state .dive-btn {
  pointer-events: auto;
  text-decoration: none;
  display: inline-block;
}

/* ── Creator header ──────────────────────────────────────── */

.title {
  font-size: clamp(1.8rem, 6vw, 2.8rem);
  font-weight: 700;
  color: #1a5276;
  text-shadow: 2px 2px 0 #aed6f1;
  letter-spacing: 0.5px;
  line-height: 1.1;
}

.subtitle {
  font-size: clamp(1rem, 3.5vw, 1.2rem);
  color: #5d6d7e;
  margin-bottom: 0.8rem;
}

/* ── Creator layout ──────────────────────────────────────── */

.creator-layout {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
  max-width: 720px;
}

/* Preview panel */
.preview-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

#preview-canvas {
  background: linear-gradient(180deg, #daf1fb 0%, #b3def5 60%, #8fcde8 100%);
  border-radius: 20px;
  border: 2.5px solid #5dade2;
  box-shadow: 4px 4px 0 #2471a3;
  /* Responsive size — shrink on small screens */
  width: min(260px, 70vw);
  height: min(180px, 50vw);
}

.preview-label {
  font-size: 0.95rem;
  color: #7f8c8d;
}

/* Controls panel */
.controls-panel {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  min-width: 240px;
  flex: 1;
  max-width: 340px;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.control-group label {
  font-size: 1.1rem;
  font-weight: 600;
  color: #1a5276;
}

/* Inputs — 16px prevents iOS auto-zoom */
input[type="text"] {
  font-family: 'Caveat', cursive;
  font-size: 16px;
  padding: 0.5rem 0.8rem;
  border: 2.5px solid #5dade2;
  border-radius: 10px;
  background: white;
  outline: none;
  width: 100%;
  color: #1a1a1a;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input[type="text"]:focus {
  border-color: #1a5276;
  box-shadow: 0 0 0 3px rgba(93,173,226,0.2);
}

/* Color swatches */
.color-picker {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.color-swatch {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s;
  outline: none;
  box-shadow: 0 2px 6px rgba(0,0,0,0.18);
  /* min tap target */
  min-width: 44px;
  min-height: 44px;
}

.color-swatch:hover,
.color-swatch:focus-visible {
  transform: scale(1.2);
  box-shadow: 0 3px 10px rgba(0,0,0,0.28);
}

.color-swatch.active {
  border-color: #1a1a1a;
  transform: scale(1.2);
  box-shadow: 0 0 0 2px white, 0 0 0 4px #1a5276;
}

/* Option buttons */
.option-row {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.opt-btn {
  font-family: 'Caveat', cursive;
  font-size: 1rem;
  padding: 0.4rem 0.85rem;
  min-height: 40px;
  border: 2.5px solid #5dade2;
  border-radius: 8px;
  background: white;
  color: #1a5276;
  cursor: pointer;
  transition: background 0.1s, color 0.1s, transform 0.08s;
  user-select: none;
}

.opt-btn:active {
  transform: scale(0.96);
}

.opt-btn.active {
  background: #2471a3;
  color: white;
  border-color: #1a5276;
}

/* Compact fill buttons inside per-part rows */
.opt-btn--sm {
  font-size: 0.82rem;
  padding: 0.25rem 0.5rem;
  min-height: 32px;
}

/* Per-part colour section — hidden by default; JS sets display:flex to show */
#custom-section {
  display: none;
  flex-direction: column;
  gap: 0.6rem;
}

.part-section {
  border: 1.5px solid #c8e4f5;
  border-radius: 10px;
  padding: 0.55rem 0.65rem;
  background: rgba(255,255,255,0.55);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.part-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #2471a3;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Smaller swatches in per-part rows */
.part-section .color-swatch {
  min-width: 30px;
  min-height: 30px;
  width: 30px;
  height: 30px;
}

/* Sayings */
.label-hint {
  font-weight: 400;
  font-size: 0.85rem;
  color: #7f8c8d;
}

.sayings-list {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.saying-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.saying-num {
  font-size: 0.9rem;
  color: #aab8c2;
  font-weight: 700;
  width: 14px;
  flex-shrink: 0;
  text-align: right;
}

.saying-input {
  padding: 0.35rem 0.7rem;
  font-size: 15px;
}

/* Dive button */
.dive-btn {
  font-family: 'Caveat', cursive;
  font-size: 1.4rem;
  font-weight: 700;
  padding: 0.7rem 2rem;
  min-height: 52px;
  background: #1a5276;
  color: white;
  border: 3px solid #0d2b3e;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 4px 4px 0 #0d2b3e;
  transition: transform 0.1s, box-shadow 0.1s;
  margin-top: 0.2rem;
  width: 100%;
}

.dive-btn:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 #0d2b3e;
}

.dive-btn:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 #0d2b3e;
}

/* ── Aquarium ─────────────────────────────────────────────── */

#aquarium-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.aquarium-ui {
  position: absolute;
  bottom: max(1.2rem, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 0.75rem;
  z-index: 10;
  width: calc(100% - 2rem);
  max-width: 400px;
  justify-content: center;
}

.ui-btn {
  font-family: 'Caveat', cursive;
  font-size: 1.1rem;
  padding: 0.55rem 1.2rem;
  min-height: 48px;
  border-radius: 12px;
  cursor: pointer;
  border: 2px solid rgba(255,255,255,0.4);
  transition: transform 0.12s;
  user-select: none;
  flex: 1;
  text-align: center;
}

.ui-btn:active {
  transform: scale(0.96);
}

.back-btn {
  background: rgba(255,255,255,0.15);
  color: white;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  text-decoration: none;
}

.speak-btn {
  background: rgba(255,255,255,0.93);
  color: #1a5276;
  font-weight: 600;
  box-shadow: 3px 3px 0 rgba(0,0,0,0.2);
}

/* ── Modal ──────────────────────────────────────────────── */

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

.modal.hidden { display: none; }

.modal-box {
  background: white;
  border-radius: 18px;
  padding: 1.6rem;
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  border: 3px solid #1a5276;
  box-shadow: 6px 6px 0 #1a5276;
}

.modal-box h3 {
  font-size: 1.4rem;
  color: #1a5276;
}

.modal-btns {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

.modal-btns button {
  font-family: 'Caveat', cursive;
  font-size: 1.1rem;
  padding: 0.45rem 1rem;
  min-height: 44px;
  border-radius: 8px;
  cursor: pointer;
  border: 2.5px solid #5dade2;
}

#speak-cancel {
  background: white;
  color: #5d6d7e;
}

#speak-ok {
  background: #1a5276;
  color: white;
  border-color: #0d2b3e;
}

/* ── Mobile tweaks ────────────────────────────────────────── */

@media (max-width: 540px) {
  #creator-view.active {
    padding: 0.8rem 0.75rem 1.5rem;
    gap: 0.3rem;
  }

  .creator-layout {
    flex-direction: column;
    align-items: center;
    gap: 1rem;
  }

  .controls-panel {
    min-width: unset;
    width: 100%;
    max-width: 100%;
  }

  #preview-canvas {
    width: min(220px, 60vw);
    height: min(155px, 42vw);
  }

  .color-swatch {
    min-width: 36px;
    min-height: 36px;
  }
}

@media (max-width: 380px) {
  .title { font-size: 1.6rem; }
  .opt-btn { font-size: 0.9rem; padding: 0.35rem 0.7rem; }
}
