/* Rybářský souboj – do 10, v1.1, jednotná pravidla vzhledu. */
:root {
  --kind0: url("assets/kind0.png");
  --kind1: url("assets/kind1.png");
  --kind2: url("assets/kind2.png");
  --kind3: url("assets/kind3.png");
  --kind4: url("assets/kind4.png");
  --kind5: url("assets/kind5.png");
  --kind6: url("assets/kind6.png");
  --kind7: url("assets/kind7.png");
  --kind8: url("assets/kind8.png");
  --kind9: url("assets/kind9.png");
}

* {
  box-sizing: border-box;
}

html,body {
  margin: 0;
  min-height: 100%;
  font-family: system-ui,Arial,sans-serif;
  color: #213b42;
}

body {
  background: #00ADE6;
}

button,select {
  font: inherit;
}

button {
  cursor: pointer;
  touch-action: manipulation;
}

button:disabled {
  cursor: default;
}

button:focus-visible,select:focus-visible,input:focus-visible {
  outline: 4px solid #ffcf53;
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

main {
  max-width: 1600px;
  margin: auto;
  padding: 7px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

header {
  background: #FFF7E6;
  border: 1px solid #c3ad86;
  border-radius: 12px;
  padding: 5px 12px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
}

header a {
  display: flex;
  gap: 8px;
  align-items: center;
  text-decoration: none;
  color: inherit;
  justify-self: start;
}

header img {
  width: 44px;
  height: 44px;
  object-fit: contain;
}

header strong,header small {
  display: block;
}

header strong {
  font-size: 14px;
}

header small {
  font-size: 11px;
}

header h1 {
  margin: 0;
  font-size: clamp(22px,2.6vw,34px);
  text-align: center;
}

.btn {
  border: 1px solid #b6bda6;
  border-radius: 9px;
  background: #fffdf5;
  padding: 8px 12px;
  font-weight: 750;
  color: #25423c;
  min-height: 36px;
}

.primary {
  background: #216d52;
  color: #fff;
  border-color: #19543e;
}

.primary:disabled {
  opacity: .5;
}

.settings {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  background: #FFF7E6;
  border: 1px solid #d4bd97;
  border-radius: 12px;
  padding: 7px 10px;
}

#restart {
  margin-left: auto;
}

.settings label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 650;
}

.settings select {
  border: 1px solid #b7bfae;
  border-radius: 7px;
  background: #fff;
  color: #203f43;
  padding: 7px;
  font-size: 13px;
  max-width: 240px;
}

.settings input {
  width: 18px;
  height: 18px;
  accent-color: #216d52;
}

.status {
  background: #eaf7ed;
  border-radius: 8px;
  text-align: center;
  padding: 4px;
  font-size: 15px;
  font-weight: 750;
  min-height: 30px;
}

.arena {
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(0,1fr);
  gap: 9px;
  flex: 1;
  min-height: 0;
}

.team {
  position: relative;
  --accent: #24699a;
  --pale: #e8f6fc;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 3px solid var(--accent);
  border-radius: 16px;
  overflow: hidden;
  background: var(--pale);
  box-shadow: 0 3px 6px #25495d25;
}

.team.red {
  --accent: #b44739;
  --pale: #fff3e7;
}

.teamhead {
  background: linear-gradient(165deg,var(--accent),var(--accent));
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 12px;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: .01em;
}

.score {
  font-variant-numeric: tabular-nums;
  background: #fff2;
  border-radius: 20px;
  padding: 3px 12px;
}

.task {
  text-align: center;
  padding: 4px 8px;
  min-height: 73px;
  display: grid;
  place-items: center;
  background: linear-gradient(#fffbec,#fff7e500);
}

.example {
  font-size: clamp(40px,5.8vh,66px);
  line-height: 1.05;
  letter-spacing: .02em;
  font-weight: 850;
  color: #123746;
}

.pond {
  position: relative;
  flex: 1;
  min-height: 210px;
  isolation: isolate;
  margin: 0 5px;
  border-radius: 16px;
  overflow: hidden;
  background: #48b4c9 url("assets/pond.jpg") center/100% 100% no-repeat;
  box-shadow: inset 0 0 0 2px #2a788b42;
  border: 1px solid #478f9c;
}

.fish {
  position: absolute;
  width: 37%;
  height: 38%;
  min-height: 58px;
  max-height: 170px;
  padding: 0;
  border: 0;
  background: none;
  color: #243336;
  font-size: clamp(24px,3.25vw,44px);
  font-weight: 900;
  line-height: 1;
  filter: drop-shadow(0 3px 3px #114b5e55);
  transition: filter .13s ease;
  --fish-image: var(--kind5);
  --swim-time: 9s;
  --swim-delay: 0s;
  --travel: 15%;
  --lift: 3%;
  animation: swim var(--swim-time) var(--swim-delay) infinite ease-in-out;
  animation-play-state: paused;
  touch-action: none;
  z-index: 2;
  clip-path: ellipse(49% 47% at 50% 50%);
}

.fish span {
  display: inline-block;
  position: relative;
  z-index: 1;
  margin: 0;
  padding: .03em .16em;
  min-width: 1.15em;
  background: #fff5d6;
  border-radius: 50%;
  color: #142d44;
  line-height: 1.06;
  pointer-events: none;
}

.fish:not(:disabled):hover {
  filter: drop-shadow(0 0 4px #fff6ca) brightness(1.05);
}

.fish:nth-of-type(1) {
  left: 6%;
  top: 17%;
  --swim-time: 8s;
  --swim-delay: -2s;
  --travel: 12%;
}

.fish:nth-of-type(2) {
  right: 6%;
  top: 17%;
  --swim-time: 10s;
  --swim-delay: -6s;
  --travel: 12%;
}

.fish:nth-of-type(3) {
  left: 31.5%;
  top: 52%;
  --swim-time: 12s;
  --swim-delay: -3s;
  --travel: 28%;
  --lift: 2%;
}

.fish:disabled:not(.wrong) {
  opacity: .85;
}

.fish.wrong {
  opacity: .38;
  filter: grayscale(.65);
  text-decoration: line-through;
}

.fish.wrong::after {
  content: "×";
  position: absolute;
  right: 10%;
  top: 6%;
  font-size: 24px;
  color: #9b2119;
  background: #fff;
  border-radius: 50%;
  width: 26px;
  height: 26px;
}

.feedback {
  height: 29px;
  text-align: center;
  padding: 4px;
  font-weight: 750;
  font-size: 15px;
  color: #234e58;
}

.feedback.bad {
  color: #962d20;
}

.net {
  margin: 0 7px 7px;
  border: 4px solid #a27743;
  border-radius: 18px;
  background: repeating-linear-gradient(42deg,transparent 0 13px,#a47c4850 13px 15px,transparent 15px 20px),repeating-linear-gradient(-42deg,transparent 0 13px,#a47c4850 13px 15px,transparent 15px 20px),linear-gradient(#f7e9cb,#dfbe89);
  padding: 6px 8px;
  min-height: 104px;
  position: relative;
  box-shadow: 0 2px 0 #73512c33,inset 0 0 0 2px #fff4d4;
}

.nettitle {
  font-size: 13px;
  font-weight: 800;
  color: #654322;
  margin-bottom: 4px;
  display: flex;
  justify-content: space-between;
}

.slots {
  display: grid;
  grid-template-columns: repeat(10,minmax(0,1fr));
  gap: 4px;
  height: 68px;
  align-content: center;
  align-items: center;
}

.slot {
  display: block;
  border: 1px dashed #a47c4866;
  border-radius: 12px;
  height: 32px;
  background: #fff5dd9c;
}

.slot.caught {
  border-color: transparent;
  background: transparent center/contain no-repeat;
  animation: plop .28s ease-out;
  transform: scale(1.38);
}

@keyframes plop{from{transform:translateY(-9px) scale(.5);opacity:.2}to{transform:none;opacity:1}}

.flying-fish {
  position: absolute;
  z-index: 8;
  pointer-events: none;
  background: transparent center/contain no-repeat;
  filter: drop-shadow(0 2px 3px #123a4650);
}

.cast {
  position: absolute;
  inset: 0;
  pointer-events: none;
  width: 100%;
  height: 100%;
  z-index: 3;
}

.cast line {
  stroke: #f9fbec;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 1px 1px #44666c);
}

.cast circle {
  fill: none;
  stroke: #f7fbef;
  stroke-width: 2;
  animation: ripple .45s ease-out both;
  transform-box: fill-box;
  transform-origin: center;
}

@keyframes ripple{from{transform:scale(.3);opacity:1}to{transform:scale(2.6);opacity:0}}

.endmsg {
  position: absolute;
  inset: 20% 10%;
  display: grid;
  place-content: center;
  gap: 7px;
  text-align: center;
  background: #fff9e8ee;
  border: 2px solid var(--accent);
  border-radius: 18px;
  z-index: 5;
  font-weight: 800;
  font-size: clamp(18px,2.7vw,34px);
}

.endmsg small {
  font-size: 15px;
}

.foot {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #FFF7E6;
  border-radius: 9px;
  padding: 4px 8px;
  font-size: 12px;
}

.foot span {
  margin-right: auto;
}

.foot .btn {
  padding: 5px 8px;
  min-height: 30px;
  font-size: 12px;
}

dialog {
  border: 2px solid #7e9e9d;
  border-radius: 14px;
  max-width: min(690px,92vw);
  max-height: 85vh;
  overflow: auto;
  padding: 22px;
  background: #fffdf4;
}

dialog::backdrop {
  background: #14383e88;
}

dialog p {
  line-height: 1.5;
}

dialog h2 {
  margin-top: 0;
}

.win {
  color: #fff5bf;
}

@media(min-width:901px){html,body{height:100%}body{display:flex;flex-direction:column}main{flex:1;min-height:0;width:100%}.pond{min-height:0}.school-banner{flex:none;display:flow-root}}

@media(max-width:900px){.pond{height:260px;flex:none}}

@media(max-width:650px){header{grid-template-columns:1fr}header h1{grid-row:2}.arena{grid-template-columns:1fr}.pond{height:240px}.foot{flex-wrap:wrap}.fish{font-size:clamp(24px,6vw,36px)}}

@media(prefers-reduced-motion:reduce){*,*::after{animation:none!important;transition:none!important}}

.fish::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--fish-image) center/contain no-repeat;
  animation: turn-fish var(--swim-time) var(--swim-delay) infinite steps(1,end);
  animation-play-state: inherit;
  pointer-events: none;
}

@keyframes swim{0%,100%{transform:translate(calc(-1 * var(--travel)),0)}25%{transform:translate(0,calc(-1 * var(--lift)))}50%{transform:translate(var(--travel),0)}75%{transform:translate(0,var(--lift))}}

@keyframes turn-fish{0%{transform:scaleX(-1)}50%{transform:scaleX(1)}100%{transform:scaleX(-1)}}

#motion[aria-pressed="true"] {
  background: #e1f2e9;
  border-color: #56927d;
}

.fish:disabled:not(.wrong) span {
  opacity: .75;
}

.team:has(.endmsg:not([hidden])) .fish {
  opacity: .25;
}

.nettitle span {
  background: #fff5dc;
  padding: 1px 8px;
  border-radius: 12px;
}

.team.busy .fish:not(.wrong) {
  opacity: 1;
}

.team.busy .fish:not(.wrong) span {
  opacity: 1;
}

.fish.departed {
  visibility: hidden;
  pointer-events: none;
}

.fish.entering {
  animation-play-state: paused !important;
  pointer-events: auto;
  z-index: 1;
}

.fish.entering::before {
  animation: none !important;
  transform: scaleX(var(--entry-facing,1));
}

.slot.pending-catch {
  background-image: none !important;
  background-color: #fff5dd9c !important;
  border-color: #a47c4866 !important;
  animation: none !important;
  transform: none !important;
}

.fish[data-style="0"] {
  --fish-image: var(--kind0);
}

.slot.caught.type0 {
  background-image: var(--kind0);
}

.fish[data-style="1"] {
  --fish-image: var(--kind1);
}

.slot.caught.type1 {
  background-image: var(--kind1);
}

.fish[data-style="2"] {
  --fish-image: var(--kind2);
}

.slot.caught.type2 {
  background-image: var(--kind2);
}

.fish[data-style="3"] {
  --fish-image: var(--kind3);
}

.slot.caught.type3 {
  background-image: var(--kind3);
}

.fish[data-style="4"] {
  --fish-image: var(--kind4);
}

.slot.caught.type4 {
  background-image: var(--kind4);
}

.fish[data-style="5"] {
  --fish-image: var(--kind5);
}

.slot.caught.type5 {
  background-image: var(--kind5);
}

.fish[data-style="6"] {
  --fish-image: var(--kind6);
}

.slot.caught.type6 {
  background-image: var(--kind6);
}

.fish[data-style="7"] {
  --fish-image: var(--kind7);
}

.slot.caught.type7 {
  background-image: var(--kind7);
}

.fish[data-style="8"] {
  --fish-image: var(--kind8);
}

.slot.caught.type8 {
  background-image: var(--kind8);
}

.fish[data-style="9"] {
  --fish-image: var(--kind9);
}

.slot.caught.type9 {
  background-image: var(--kind9);
}

/* Movement continues independently of the catch lock. */
.motion-on .fish:not(:disabled) { animation-play-state: running; }
.motion-on .fish:not(:disabled):focus-visible { animation-play-state: paused; }
@media (hover:hover) and (pointer:fine) {
  .motion-on .fish:not(:disabled):hover { animation-play-state: paused; }
}
.motion-on .team:not(:has(.endmsg:not([hidden]))) .fish.wrong:not(.entering):not(.departed),
.motion-on .team.busy .fish:not(.entering):not(.departed) { animation-play-state: running; }
