/* The page is just a dark ocean backdrop with the game canvas centered in it. */

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: radial-gradient(circle at 50% 20%, #0b4a6f 0%, #04263f 55%, #01121f 100%);
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  /* Keep clear of a phone's notch and home bar. These are 0 on a computer. */
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  /* Stops the page from scrolling or zooming when you tap fast on a phone. */
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

canvas {
  display: block;
  border-radius: 14px;
  box-shadow: 0 0 60px rgba(60, 200, 255, 0.25), 0 20px 50px rgba(0, 0, 0, 0.6);
  cursor: pointer;
}

/* ----- The fish designer ------------------------------------------------ */

/* The hidden attribute should always win, even over display: flex below. */
[hidden] {
  display: none !important;
}

/* A dark sheet over the whole page, with the card in the middle. */
.designer {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  overflow-y: auto;
  background: rgba(1, 18, 31, 0.86);
  /* The game turns these off for the page. Controls need them back on. */
  touch-action: auto;
}

.designer-card {
  width: 100%;
  max-width: 380px;
  margin: auto;
  padding: 16px;
  border: 2px solid rgba(120, 220, 255, 0.5);
  border-radius: 18px;
  background: #04263f;
  color: #ffffff;
  font-family: system-ui, sans-serif;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
}

.designer-card h2 {
  margin: 0 0 10px;
  color: #ffe66d;
  font-size: 22px;
  text-align: center;
}

#designer-preview {
  width: 100%;
  height: auto;
  margin-bottom: 10px;
  border-radius: 12px;
  box-shadow: none;
  cursor: default;
}

/* One control per row: its name on the left, the control on the right. */
.designer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 38px;
  font-size: 15px;
}

.designer-row span {
  flex: 0 0 42%;
  color: #d9f4ff;
}

.designer-row input,
.designer-row select {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 16px; /* smaller than this and phones zoom in when you tap */
  font-family: inherit;
}

.designer-row input[type="text"],
.designer-row select {
  padding: 6px 8px;
  border: 1px solid rgba(120, 220, 255, 0.5);
  border-radius: 8px;
  background: #06304f;
  color: #ffffff;
  -webkit-user-select: text;
  user-select: text;
}

.designer-row input[type="color"] {
  height: 32px;
  padding: 0;
  border: 1px solid rgba(120, 220, 255, 0.5);
  border-radius: 8px;
  background: none;
}

.designer-row input[type="range"] {
  accent-color: #ffe66d;
}

.designer-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.designer-card button {
  flex: 1 1 auto;
  padding: 10px 12px;
  border: 2px solid rgba(120, 220, 255, 0.6);
  border-radius: 999px;
  background: rgba(4, 30, 50, 0.7);
  color: #ffffff;
  font: bold 15px system-ui, sans-serif;
  cursor: pointer;
}

.designer-card button.primary {
  flex-basis: 100%;
  border-color: #ffffff;
  background: #ffe66d;
  color: #04263f;
}

#design-code-box p {
  margin: 14px 0 8px;
  color: #d9f4ff;
  font-size: 13px;
  line-height: 1.4;
}

#design-code {
  display: block;
  width: 100%;
  margin-bottom: 8px;
  padding: 8px;
  border: 1px solid rgba(120, 220, 255, 0.5);
  border-radius: 8px;
  background: #01121f;
  color: #b9f5e6;
  font: 12px ui-monospace, Menlo, Consolas, monospace;
  white-space: pre;
  resize: vertical;
  -webkit-user-select: text;
  user-select: text;
}

/* ----- The Reef Pass screen (it reuses the designer's card and buttons) --- */

#extras-card h3 {
  margin: 18px 0 8px;
  color: #ffe66d;
  font-size: 16px;
}

#extras-card p {
  margin: 0 0 8px;
  color: #d9f4ff;
  font-size: 14px;
  line-height: 1.4;
}

.extras-dim {
  color: #9fc6d8 !important;
  font-size: 13px !important;
}

.extras-list {
  max-height: 190px;
  overflow-y: auto;
  border: 1px solid rgba(120, 220, 255, 0.3);
  border-radius: 10px;
}

.extras-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  font-size: 14px;
}

.extras-row + .extras-row {
  border-top: 1px solid rgba(120, 220, 255, 0.15);
}

.extras-row span:first-child {
  flex: 1 1 auto;
}

.extras-row button {
  flex: 0 0 auto !important;
  padding: 5px 14px !important;
}

/* Four numbers side by side. */
.extras-facts {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  text-align: center;
}

.extras-fact strong {
  display: block;
  color: #ffffff;
  font-size: 22px;
}

.extras-fact span {
  color: #9fc6d8;
  font-size: 11px;
}

/* The bar chart: a row of boxes standing on the same baseline. */
.extras-chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 60px;
  margin: 12px 0 6px;
}

.extras-bar {
  flex: 1 1 0;
  border-radius: 3px 3px 0 0;
  background: #ffe66d;
}

.extras-bar-empty {
  background: rgba(120, 220, 255, 0.25);
}

/* ----- The Past Reefs calendar and the paywall ---------------------------- */

.extras-gap {
  margin-top: 16px !important;
}

.extras-center {
  text-align: center;
}

.calendar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 10px 0 8px;
  font-size: 17px;
}

#extras-card .calendar-step {
  flex: 0 0 auto;
  width: 40px;
  padding: 4px 0;
}

#extras-card .calendar-step:disabled {
  opacity: 0.3;
  cursor: default;
}

/* Seven equal columns, one per day of the week. */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.calendar-weekday {
  padding-bottom: 2px;
  color: #9fc6d8;
  font-size: 12px;
  font-weight: bold;
  text-align: center;
}

#extras-card .calendar-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 2px 0;
  border: 1px solid rgba(120, 220, 255, 0.35);
  border-radius: 9px;
  background: rgba(6, 48, 79, 0.9);
  font-weight: normal;
}

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

/* Your best haul, small, under the date. Empty if you never finished it. */
.calendar-best {
  min-height: 13px;
  color: #ffe66d;
  font-size: 11px;
  font-weight: bold;
}

/* Past days you have not unlocked look a little dimmer. */
#extras-card .calendar-locked {
  border-style: dashed;
  color: #c9dbe5;
}

#extras-card .calendar-played {
  border-color: rgba(255, 230, 109, 0.6);
}

#extras-card .calendar-today {
  border: 2px solid #ffffff;
  background: #ffe66d;
  color: #04263f;
}

#extras-card .calendar-today .calendar-best {
  color: #04263f;
}

#extras-card .calendar-future {
  opacity: 0.3;
  cursor: default;
}

#extras-card .paywall-day {
  margin-top: -2px;
  color: #ffffff;
  font-size: 18px;
  font-weight: bold;
  text-align: center;
}

.paywall-perks {
  margin: 0 0 6px;
  padding-left: 20px;
  color: #ffffff;
  font-size: 15px;
  line-height: 1.6;
}

#extras-card button:disabled.primary {
  opacity: 0.55;
  cursor: default;
}

/* ----- Challenge a friend (it reuses the designer's card and buttons) ----- */
.duel-blurb {
  margin: 8px 0 12px;
  color: #d9f4ff;
  font-size: 15px;
  line-height: 1.4;
}

.duel-blurb b {
  color: #ffe66d;
}

#duel-status:empty {
  display: none;
}

/* ----- Your badges (it reuses the designer's card and buttons) ----------- */
.badge-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 4px 0;
}

.badge-row canvas {
  width: 48px;
  height: 60px;
  flex: 0 0 auto;
}

.badge-row b {
  display: block;
  color: #ffe66d;
  font-size: 16px;
}

.badge-row span {
  color: #d9f4ff;
  font-size: 14px;
}

.account-news:empty {
  display: none;
}

.account-news {
  color: #ffb347;
}

/* Apple asks for its button to be black or white with its logo. */
.designer-card button.apple {
  background: #000000;
  color: #ffffff;
  border-color: #000000;
}
