/* Krillion Dashboard: scrolling down the page is diving down through the ocean. */

.kr {
  --sun: #ffe066; --twilight: #4dd8ff; --midnight: #8f7bff; --abyss: #ff5fa2;
  --glass: rgba(255, 255, 255, .09); --glass-line: rgba(255, 255, 255, .18);
  position: relative; isolation: isolate; overflow: hidden;
  /* Wider than the rest of the site on big screens: break out of main's 1120px column. */
  width: min(1360px, calc(100vw - 24px));
  margin: 20px 0 8px calc(50% - min(680px, 50vw - 12px)); padding: clamp(18px, 4vw, 40px) clamp(14px, 3vw, 32px) 40px;
  border-radius: 26px; color: #eef8ff;
  background: linear-gradient(180deg,
    #63e3ff 0%, #23a4e6 9%, #0f63b8 22%, #0b3a86 40%, #0d1f5c 58%, #150b40 78%, #07040f 100%);
}
.kr a { color: #9fe9ff; }
.kr h2 { font: 400 clamp(1.15rem, 3.4vw, 1.45rem)/1.2 "Bungee", "Bricolage Grotesque", system-ui, sans-serif; margin-bottom: 12px; }
.kr-muted { color: rgba(238, 248, 255, .7); }

/* ---- Ambient life ---- */
.kr-bubbles, .kr-swarm { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.kr-bubbles i {
  position: absolute; bottom: -30px; left: calc(var(--i) * 6.2% + 1%);
  width: calc(6px + mod(var(--i) * 7, 5) * 4px); aspect-ratio: 1; border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, .55); background: radial-gradient(circle at 30% 30%, rgba(255,255,255,.7), rgba(255,255,255,.05) 60%);
  animation: kr-rise calc(9s + mod(var(--i) * 13, 7) * 1.4s) linear infinite;
  animation-delay: calc(var(--i) * -1.7s);
}
@keyframes kr-rise {
  from { transform: translate(0, 0); opacity: 0; }
  10% { opacity: .9; }
  50% { transform: translate(14px, -50vh); }
  to { transform: translate(-6px, -160vh); opacity: 0; }
}
.kr-krill {
  position: absolute; width: 54px; left: -80px; top: calc(14% + var(--i) * 22%);
  animation: kr-swim calc(26s + var(--i) * 9s) linear infinite, kr-wiggle .5s ease-in-out infinite alternate;
  animation-delay: calc(var(--i) * -8s), 0s;
  filter: drop-shadow(0 0 6px rgba(255, 122, 154, .45));
}
@keyframes kr-swim { from { translate: 0 0; } 50% { translate: 60vw 30px; } to { translate: 130vw -10px; } }
@keyframes kr-wiggle { from { rotate: -4deg; } to { rotate: 4deg; } }

/* ---- Title ---- */
.kr-hero { text-align: center; margin-bottom: 18px; }
.kr-kicker { text-transform: uppercase; letter-spacing: .18em; font-size: .78rem; font-weight: 700; color: #063a63; }
.kr-title {
  font: 400 clamp(2.6rem, 11vw, 5.6rem)/1 "Bungee", "Arial Black", sans-serif; margin: 6px 0 4px;
  display: flex; justify-content: center; flex-wrap: wrap;
}
.kr-title span {
  display: inline-block; color: #fff6b0;
  background: linear-gradient(180deg, #fff9c4 10%, #ffd23f 45%, #ff7a9a 95%); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 3px 0 #0b3a86) drop-shadow(0 6px 10px rgba(0, 0, 0, .25));
  animation: kr-wave 2.4s ease-in-out infinite; animation-delay: calc(var(--i) * .12s);
}
@keyframes kr-wave { 0%, 100% { transform: translateY(0) rotate(0); } 40% { transform: translateY(-10px) rotate(-3deg); } }
.kr-date { font-weight: 700; color: #063a63; }

/* ---- Cards ---- */
.kr-card {
  position: relative; margin: 16px auto; max-width: 1240px; padding: clamp(16px, 3vw, 24px);
  background: var(--glass); border: 1px solid var(--glass-line); border-radius: 22px;
  backdrop-filter: blur(10px) saturate(1.2); -webkit-backdrop-filter: blur(10px) saturate(1.2);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .18);
}
.kr.js .kr-reveal { opacity: 0; transform: translateY(26px) scale(.98); transition: opacity .6s ease, transform .6s cubic-bezier(.2, .9, .3, 1.2); }
.kr.js .kr-reveal.in { opacity: 1; transform: none; }

.kr-error { max-width: 1240px; margin: 0 auto; padding: 10px 16px; border-radius: 12px; background: #ff5f6d; color: #fff; font-weight: 700; }

.kr-splash {
  position: relative; max-width: 1240px; margin: 0 auto 8px; padding: 14px 18px; border-radius: 18px; text-align: center;
  background: linear-gradient(120deg, #ffe066, #ff7a9a, #8f7bff); color: #1a0b33; font-size: 1.05rem;
  box-shadow: 0 8px 24px rgba(255, 122, 154, .35); animation: kr-pop .6s cubic-bezier(.3, 1.6, .5, 1) both;
}
.kr-splash .kr-zone { color: #fff; }
.kr-pb { display: block; font-style: normal; font-weight: 800; margin-top: 4px; animation: kr-pulse 1s ease-in-out 3; }
@keyframes kr-pop { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes kr-pulse { 50% { transform: scale(1.12); } }

/* Bubble burst after logging a dive (made by krillion.js) */
.kr-burst { position: absolute; left: 50%; top: 50%; width: 0; height: 0; pointer-events: none; }
.kr-burst i {
  position: absolute; width: var(--s); height: var(--s); border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .9); background: rgba(255, 255, 255, .25);
  animation: kr-fly var(--t) cubic-bezier(.15, .7, .3, 1) forwards;
}
@keyframes kr-fly { to { transform: translate(var(--x), var(--y)) scale(.4); opacity: 0; } }

/* ---- Two cards side by side on wide screens ---- */
.kr-pair { max-width: 1240px; margin: 0 auto; }
@media (min-width: 980px) {
  .kr-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; margin: 16px auto; }
  .kr-pair > .kr-card { margin: 0; }
}

/* ---- Last week's champion ---- */
.kr-champ {
  position: relative; overflow: hidden; isolation: isolate; max-width: 1240px; margin: 18px auto;
  display: flex; align-items: center; gap: clamp(14px, 3vw, 28px); padding: clamp(16px, 3vw, 26px) clamp(18px, 4vw, 36px);
  border-radius: 24px; color: #2b1600;
  background: linear-gradient(115deg, #fff1a8 0%, #ffd23f 35%, #ffb02e 65%, #ffe58a 100%);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, .55) inset, 0 14px 36px rgba(255, 176, 46, .45);
}
.kr-champ::after {   /* a shine that sweeps across */
  content: ""; position: absolute; inset: -40% auto -40% -30%; width: 30%; z-index: -1;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .75), transparent);
  transform: skewX(-18deg); animation: kr-shine 4.5s ease-in-out infinite;
}
@keyframes kr-shine { 0%, 55% { left: -30%; } 100% { left: 130%; } }
.kr-champ-trophy { flex: none; font-size: clamp(3rem, 10vw, 5rem); line-height: 1; filter: drop-shadow(0 6px 0 rgba(122, 64, 0, .35)); animation: kr-trophy 2.4s ease-in-out infinite; }
@keyframes kr-trophy { 0%, 100% { transform: rotate(-8deg) translateY(0); } 50% { transform: rotate(8deg) translateY(-8px); } }
.kr-champ-kicker { font-size: .78rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: #7a4000; }
.kr .kr-champ-name { font: 400 clamp(1.8rem, 6vw, 3rem)/1.05 "Bungee", sans-serif; margin: 4px 0 8px; color: #2b1600; text-shadow: 0 2px 0 rgba(255, 255, 255, .6); }
.kr-champ-stats { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .95rem; }
.kr-champ-stats b { font-weight: 800; }
.kr-champ-sparkles { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.kr-champ-sparkles i {
  position: absolute; left: calc(var(--i) * 8.3% + 2%); top: calc(mod(var(--i) * 37, 90) * 1%);
  width: 10px; height: 10px; background: #fff; clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
  animation: kr-twinkle 2.2s ease-in-out infinite; animation-delay: calc(var(--i) * -.37s);
}
@keyframes kr-twinkle { 0%, 100% { transform: scale(0) rotate(0); opacity: 0; } 50% { transform: scale(1.4) rotate(90deg); opacity: 1; } }
@media (max-width: 560px) {
  .kr-champ { flex-direction: column; text-align: center; }
  .kr-champ-stats { justify-content: center; }
}

/* ---- Admin: scores for other people ---- */
.kr-admin { border-style: dashed; }
.kr-admin .kr-wide { grid-column: 1 / -1; }
.kr-admin select {
  width: 100%; padding: .6rem .8rem; border-radius: 12px; border: 1px solid var(--glass-line);
  background: rgba(0, 0, 0, .25); color: #fff; font-size: 1rem; color-scheme: dark;
}
.kr-admin-buttons { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 12px; }
.kr .kr-form .kr-danger { background: transparent; color: #ffb3c8; box-shadow: none; border: 1px solid rgba(255, 179, 200, .6); font-family: inherit; font-size: .9rem; }
.kr-admin-msg { margin: 8px 0; padding: 8px 12px; border-radius: 10px; background: rgba(62, 224, 143, .18); font-weight: 700; }
.kr-admin-msg.bad { background: rgba(255, 95, 109, .25); }

/* ---- Zones ---- */
.kr-zone { display: inline-block; padding: 1px 10px; border-radius: 99px; font-size: .82rem; font-weight: 800; color: #0a1030; }
.kr-zone.sun, .kr-bar i.sun, .kr-dot.sun { background: var(--sun); }
.kr-zone.twilight, .kr-bar i.twilight, .kr-dot.twilight { background: var(--twilight); }
.kr-zone.midnight, .kr-bar i.midnight, .kr-dot.midnight { background: var(--midnight); color: #fff; }
.kr-zone.abyss, .kr-bar i.abyss, .kr-dot.abyss { background: var(--abyss); color: #fff; }
.kr-zone.hadal, .kr-bar i.hadal, .kr-dot.hadal { background: linear-gradient(90deg, var(--abyss), #ffd23f); color: #1a0b33; }
.kr-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }

/* ---- Your dive today / log form ---- */
.kr-today-me { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 22px; }
.kr-depth { font: 400 clamp(2.6rem, 10vw, 4.2rem)/1 "Bungee", sans-serif; color: #fff; text-shadow: 0 4px 0 rgba(0, 0, 0, .25); }
.kr-depth small { font-size: .45em; margin-left: 4px; }
.kr-fix { margin-top: 14px; }
.kr-fix summary { cursor: pointer; color: #9fe9ff; font-weight: 600; }
.kr-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; margin-top: 12px; align-items: end; }
.kr-form label { display: flex; flex-direction: column; gap: 4px; margin: 0; font-size: .85rem; font-weight: 700; color: rgba(238, 248, 255, .85); }
.kr-form input[type=date], .kr-form input[type=number] {
  width: 100%; padding: .6rem .8rem; border-radius: 12px; border: 1px solid var(--glass-line);
  background: rgba(0, 0, 0, .25); color: #fff; font-size: 1.05rem; color-scheme: dark;
}
.kr-form input[type=range] { grid-column: 1 / -1; width: 100%; accent-color: #ffd23f; height: 28px; }
.kr-preview { grid-column: 1 / -1; min-height: 1.6em; font-weight: 700; }
.kr-form button {
  grid-column: 1 / -1; justify-self: start; padding: .75rem 1.6rem; border: none; border-radius: 99px;
  font: 400 1.05rem "Bungee", sans-serif; color: #1a0b33;
  background: linear-gradient(90deg, #ffe066, #ff7a9a); box-shadow: 0 6px 0 #a33a63, 0 10px 20px rgba(0, 0, 0, .25);
  transition: transform .1s, box-shadow .1s;
}
.kr-form button:hover { opacity: 1; filter: brightness(1.06); transform: translateY(-1px); }
.kr-form button:active { transform: translateY(5px); box-shadow: 0 1px 0 #a33a63; }

/* ---- Today's dives ---- */
.kr-bars { list-style: none; display: grid; gap: 8px; }
.kr-bars li {
  display: grid; grid-template-columns: 2.2em minmax(4.5em, 9em) 1fr auto; gap: 10px; align-items: center;
  padding: 6px 10px; border-radius: 12px; animation: kr-slide .5s ease both; animation-delay: calc(var(--d) * 70ms);
}
.kr-bars li.me { background: rgba(255, 224, 102, .14); outline: 1px solid rgba(255, 224, 102, .4); }
.kr-pos { text-align: center; font-weight: 800; }
.kr-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kr-bar { height: 14px; border-radius: 99px; background: rgba(255, 255, 255, .1); overflow: hidden; }
.kr-bar i { display: block; height: 100%; width: var(--w); border-radius: 99px; animation: kr-grow 1.1s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--d) * 70ms + .2s); }
.kr-val { font-variant-numeric: tabular-nums; font-weight: 700; font-size: .92rem; }
@keyframes kr-slide { from { opacity: 0; transform: translateX(-16px); } to { opacity: 1; transform: none; } }
@keyframes kr-grow { from { width: 0; } }
.kr-waiting { margin-top: 12px; color: rgba(238, 248, 255, .75); font-size: .92rem; }

/* ---- Leaderboard ---- */
.kr-tabs { display: flex; gap: 6px; padding: 4px; margin-bottom: 14px; border-radius: 99px; background: rgba(0, 0, 0, .25); width: fit-content; max-width: 100%; overflow-x: auto; }
.kr-tabs a { padding: 7px 16px; border-radius: 99px; color: #cfefff; text-decoration: none; font-weight: 700; white-space: nowrap; transition: background .2s, color .2s; }
.kr-tabs a.on { background: #ffe066; color: #1a0b33; }
.kr-period { display: flex; align-items: center; gap: 12px; }
.kr-period h2 { margin: 0; }
.kr-period a {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; text-decoration: none;
  font-size: 1.4rem; line-height: 1; color: #fff; background: rgba(255, 255, 255, .14);
}

.kr-podium { display: flex; justify-content: center; align-items: flex-end; gap: clamp(6px, 2vw, 16px); margin: 22px 0 14px; min-height: 230px; }
.kr-step { flex: 0 1 150px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; min-width: 0; }
.kr-medal { font-size: 2rem; animation: kr-bob 2.2s ease-in-out infinite; }
.kr-step.p1 .kr-medal { font-size: 2.6rem; }
.kr-pname { font-weight: 800; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kr-ptotal { font-size: .85rem; color: rgba(238, 248, 255, .85); }
.kr-block {
  width: 100%; margin-top: 6px; border-radius: 14px 14px 4px 4px; display: grid; place-items: start center; padding-top: 10px;
  font: 400 1.6rem "Bungee", sans-serif; color: rgba(26, 11, 51, .55);
  transform-origin: bottom; animation: kr-rise-up .9s cubic-bezier(.2, .9, .3, 1.15) both;
}
.kr-step.p1 .kr-block { height: 130px; background: linear-gradient(#fff3a6, #ffc93c); animation-delay: .25s; }
.kr-step.p2 .kr-block { height: 95px; background: linear-gradient(#f2f6ff, #b9c6dd); animation-delay: .1s; }
.kr-step.p3 .kr-block { height: 70px; background: linear-gradient(#ffd6b0, #e09a5f); animation-delay: .4s; }
.kr-step.me .kr-pname { color: #ffe066; }
@keyframes kr-rise-up { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes kr-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

.kr-table-wrap { overflow-x: auto; }
.kr-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.kr-table th, .kr-table td { padding: 8px 8px; border-bottom: 1px solid rgba(255, 255, 255, .1); text-align: left; white-space: nowrap; }
.kr-table th { color: rgba(238, 248, 255, .65); font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; }
.kr-table tr.me td { background: rgba(255, 224, 102, .12); }
.kr-table tbody tr { transition: background .2s; }
.kr-table tbody tr:hover td { background: rgba(255, 255, 255, .06); }

/* ---- Hall of fame ---- */
.kr-fame { max-width: 1240px; margin: 30px auto 10px; }
.kr-section-title { text-align: center; }
.kr-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.kr-tile {
  position: relative; padding: 16px; border-radius: 20px; background: var(--glass); border: 1px solid var(--glass-line);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); transition: transform .25s, background .25s;
}
.kr-tile:hover { transform: translateY(-4px) rotate(-.6deg); background: rgba(255, 255, 255, .14); }
.kr-tile h3 { padding-right: 2.2rem; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: rgba(238, 248, 255, .7); }
.kr-tile p { color: rgba(238, 248, 255, .85); font-size: .9rem; }
.kr-tile .kr-big { font: 400 1.5rem/1.2 "Bungee", sans-serif; color: #fff; margin: 4px 0; }
.kr-ico { position: absolute; top: 12px; right: 14px; font-size: 1.7rem; animation: kr-bob 3s ease-in-out infinite; }
.kr-tile:nth-child(2n) .kr-ico { animation-delay: -1.2s; }

/* ---- Your stats ---- */
.kr-chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(105px, 1fr)); gap: 10px; }
.kr-chips div { padding: 12px; border-radius: 16px; background: rgba(0, 0, 0, .22); text-align: center; }
.kr-chips b { display: block; font: 400 1.35rem "Bungee", sans-serif; color: #ffe066; }
.kr-chips span { font-size: .78rem; color: rgba(238, 248, 255, .75); }
.kr-chart-title { margin: 18px 0 6px; font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; color: rgba(238, 248, 255, .7); }
.kr-chart { width: 100%; height: clamp(110px, 24vw, 170px); display: block; }
.kr-chart rect { transform-box: fill-box; transform-origin: bottom; animation: kr-rise-up .8s cubic-bezier(.2, .9, .3, 1.1) both; animation-delay: calc(var(--d) * 25ms); }
.kr-chart rect:hover { filter: brightness(1.3); }
.kr-axis { stroke: rgba(255, 255, 255, .25); stroke-width: 1; }
.kr-miss { fill: rgba(255, 255, 255, .25); }

@media (max-width: 560px) {
  .kr-form { grid-template-columns: 1fr; }
  .kr-bars li { grid-template-columns: 1.8em minmax(3.8em, 6em) 1fr; }
  .kr-bars .kr-val { grid-column: 2 / -1; font-size: .8rem; margin-top: -6px; color: rgba(238, 248, 255, .75); }
  .kr-table th:nth-child(4), .kr-table td:nth-child(4), .kr-table th:nth-child(6), .kr-table td:nth-child(6) { display: none; }
  .kr-podium { min-height: 200px; }
  .kr-tabs { width: 100%; }
  .kr-tabs a { flex: 1; text-align: center; padding: 7px 8px; font-size: .9rem; }
}

@media (prefers-reduced-motion: reduce) {
  .kr *, .kr *::before, .kr *::after { animation: none !important; transition: none !important; }
  .kr.js .kr-reveal { opacity: 1; transform: none; }
  .kr-bubbles, .kr-swarm { display: none; }
}
