@view-transition {
  navigation: auto;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Courier New", monospace;
  background: #fafafa;
  color: #1d1d1f;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
}

h1 {
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #1d1d1f;
}

.page-wrapper {
  display: inline-flex;
  flex-direction: column;
  gap: 2rem;
}

/* Top section */
#landing {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.landing-header {
  text-align: center;
}

.landing-header h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin: 0;
  font-family: "Courier New", monospace;
}

.logo-dot {
  color: #0071e3;
  font-size: 2.4rem;
  line-height: 1;
  vertical-align: -0.15em;
}

.landing-inner {
  display: inline-grid;
  grid-template-columns: 1fr;
}

.landing-body {
  display: flex;
  justify-content: space-between;
  min-width: 0;
}

.landing-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 210px;
  width: 210px;
}

.inner-landing-form-and-diff {
  display: flex;
  justify-content: space-between;
  /* flex-direction: column; */
  min-width: 210px;
  width: 210px;
}

.inner-landing-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 140px;
  width: 140px;
}

.player-section {
  display: flex;
}

.input-field {
  font-family: "Courier New", monospace;
  font-size: 0.9rem;
  padding: 0.6rem 0.8rem;
  border: 1px solid #868694;
  border-radius: 0;
  background: #fff;
  color: #1d1d1f;
  transition: all 0.15s;
  letter-spacing: 0.03em;
}

.input-field::placeholder {
  color: #a1a1a6;
}

.input-field:disabled {
  background: #f0f0f0;
  color: #a1a1a6;
  cursor: not-allowed;
}

.input-field:focus {
  outline: none;
  border-color: #0071e3;
  background: #f0f7ff;
}

.input-player {
  width: 140px;
}

.join-section {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
}

.difficulty-group {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  margin: 10px 0px 10px 0px;
}

.difficulty-one {
  display: flex;
  flex-direction: column;
  justify-content: end;
  margin: 10px 0px 10px 0px;
}

.radio-label {
  font-family: "Courier New", monospace;
  font-size: 0.78rem;
  font-weight: 600;
  color: #868694;
  cursor: pointer;
  text-transform: lowercase;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  letter-spacing: 0.03em;
}

.radio-label input[type="radio"] {
  accent-color: #0071e3;
  cursor: pointer;
}

.radio-label:has(input:checked) {
  color: #0071e3;
}

.level-text {
  font-family: "Courier New", monospace;
  font-size: 0.78rem;
  font-weight: 600;
  color: #0071e3;
  text-transform: lowercase;
  letter-spacing: 0.03em;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  width: 61px;
}

.difficulty-collapsed {
  font-family: "Courier New", monospace;
  font-size: 0.78rem;
  font-weight: 600;
  color: #0071e3;
  text-transform: lowercase;
  letter-spacing: 0.03em;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  width: 61px;
}

.difficulty-collapsed::before {
  content: "";
  width: 10px;
  height: 10px;
  background: #0071e3;
  flex-shrink: 0;
}

.difficulty-collapsed:empty {
  display: none;
}

.input-session {
  width: 100%;
}

button {
  font-family: "Courier New", monospace;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.6rem 0.8rem;
  border: 1px solid #d1d1d6;
  border-radius: 0;
  background: #fff;
  color: #1d1d1f;
  cursor: pointer;
  transition: all 0.15s;
  letter-spacing: 0.05em;
  text-transform: lowercase;
}

button:hover {
  border-color: #1d1d1f;
}

button:active {
  background: #f5f5f7;
}

.btn-create {
  border: 1px solid #0071e3;
  background: #0071e3;
  color: #fff;
  width: 100%;
  padding: 0.6rem 0.8rem;
  position: relative;
  overflow: hidden;
}

.invisible {
  visibility: hidden;
}

.btn-create:hover {
  border-color: #0055cc;
  background: #0055cc;
}

.btn-create.btn-matching::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.3) 50%,
    transparent 100%
  );
  animation: sweep 1.2s ease-in-out infinite;
}

@keyframes sweep {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}

.btn-create:not(.btn-matching):hover {
  border-color: #0055cc;
  background: #0055cc;
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.06);
  }
}

.btn-join {
  border: 1px solid #1d1d1f;
}

.btn-join:hover {
  background: #1d1d1f;
  color: #fff;
}

.link-join {
  display: inline-block;
  text-decoration: none;
  text-align: center;
  font-family: "Courier New", monospace;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.6rem 0.8rem;
  border: 1px solid #1d1d1f;
  border-radius: 0;
  background: #fff;
  color: #1d1d1f;
  cursor: pointer;
  letter-spacing: 0.05em;
  text-transform: lowercase;
  transition: all 0.15s;
}

.link-join:hover {
  background: #1d1d1f;
  color: #fff;
}

#failure {
  min-height: 2.2rem;
  font-size: 0.85rem;
  color: #ff3b30;
  display: flex;
  align-items: center;
}

#failure:not(:empty) {
  animation: fade-out 0.3s 2.7s forwards;
}

@keyframes fade-out {
  to {
    opacity: 0;
  }
}

/* Sudoku Board Styles */
#board {
  display: inline-block;
  position: relative;
  width: 100%;
  max-width: 492px;
  min-width: 280px; /* lowered a bit */
  aspect-ratio: 1 / 1;
  margin: 0 auto;
}

#board table {
  border-collapse: collapse;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  width: 100%;
  height: 100%;
  padding: 6px;
  box-sizing: border-box;
  table-layout: fixed;
  min-height: 0; /* Important */
}

#board td {
  width: auto;
  height: auto;
  min-height: 0; /* ← Critical */
  min-width: 0;
  aspect-ratio: 1 / 1;
  text-align: center;
  vertical-align: middle;
  font-size: clamp(1rem, 2.2rem, 4rem); /* lowered base size */
  line-height: 0.9; /* ← Very important */
  font-weight: 500;
  text-overflow: ellipsis;
  font-family: "DIN", monospace;
  border: 1px solid #868694;
  color: #0071e3;
  cursor: pointer;
  transition: background 0.1s;
  box-sizing: border-box;
  padding: 0;
  overflow: hidden; /* helps prevent content forcing size */
}

#board td[style*="--player-color"] {
  color: rgb(var(--player-color));
  background-color: rgba(var(--player-color), 0.25);
}

#board td[style*="--cursor-color"] {
  box-shadow: inset 0 0 0 3px rgb(var(--cursor-color));
}

#board td:focus {
  outline: inset #dba709;
  outline-offset: -0.15rem;
  background-color: color-mix(in srgb, #59d2ea, white 50%);
  /*border: .15rem solid #ffc107;*/
  /*border conflicts with the current implementation of the thicker outside borders, outline is a temporary fix*/
}

#board td.flash {
  animation: flash-red 0.4s ease-out;
}

#board td.hl {
  background-color: color-mix(in srgb, #59d2ea, white 60%);
}

/* Congratulations overlay */
.congrats-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  z-index: 10;
  pointer-events: auto;
}

.congrats-box {
  text-align: center;
  background: #fff;
  padding: 2.5rem 3rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}

.congrats-icon {
  font-size: 3rem;
  line-height: 1;
  margin-bottom: 0.75rem;
}

.congrats-title {
  font-family: "Courier New", monospace;
  font-size: 1.6rem;
  font-weight: 700;
  color: #1d1d1f;
  margin-bottom: 0.4rem;
}

.congrats-sub {
  font-family: "Courier New", monospace;
  font-size: 0.95rem;
  color: #868694;
}

.congrats-votes {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin: 1rem 0 1.2rem;
  padding: 0.75rem 1rem;
  background: #f5f5f7;
}

.congrats-vote-entry {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: "Courier New", monospace;
  font-size: 0.95rem;
}

.congrats-vote-name {
  flex: 1;
  text-align: left;
  color: #1d1d1f;
  font-weight: 600;
}

.congrats-voted {
  color: #24833b;
  font-weight: 700;
}

.congrats-waiting {
  color: #999;
}

.congrats-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  margin-top: 0.5rem;
}

.congrats-actions .btn-create {
  min-width: 110px;
}

.congrats-indicator {
  font-family: "Courier New", monospace;
  font-size: 0.78rem;
  color: #868694;
}

@keyframes flash-red {
  0%,
  100% {
    background: transparent;
  }
  50% {
    background: #ff3b30;
  }
}

#board tr:nth-child(3) td,
#board tr:nth-child(6) td {
  border-bottom: 2px solid #1d1d1f;
}

#board td:nth-child(3),
#board td:nth-child(6) {
  border-right: 2px solid #1d1d1f;
}

#board tr:first-child td {
  border-top: 2px solid #1d1d1f;
}

#board tr:last-child td {
  border-bottom: 2px solid #1d1d1f;
}

#board td:first-child {
  border-left: 2px solid #1d1d1f;
}

#board td:last-child {
  border-right: 2px solid #1d1d1f;
}

/* Numpad */
#numpad {
  display: flex;
  gap: 2px;
  margin-top: 12px;
  user-select: none;
  justify-content: space-between;
}

.np-btn {
  width: 100%;
  aspect-ratio: 1;
  font-size: 1.6rem;
  font-weight: 600;
  font-family: "DIN", monospace;
  padding: 0;
  border: 1px solid #868694;
  background: #fff;
  color: #0071e3;
  cursor: pointer;
  transition: background 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.np-btn:hover {
  background: #e8f0fe;
}

.np-btn:active {
  background: #d0e2fd;
}

/* Scoreboard */
#scoreboard {
  min-width: 150px;
  width: 150px;
  min-height: 2.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding-top: 0.2rem;
}

.sb-entry {
  display: flex;
  gap: 0.4rem;
  font-family: "Courier New", monospace;
  font-size: 0.85rem;
  justify-content: space-between;
  align-items: center;
}

.sb-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.sb-name {
  color: #1d1d1f;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sb-score {
  color: #0071e3;
  font-weight: 700;
}

.footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 0.3rem;
  font-size: 0.95rem;
  color: black;
}

/* General link styling in footer */
.footer a {
  color: black;
  text-decoration: none;
  transition: all 0.25s ease;
  position: relative;
}

/* Hover effect for normal links */
.footer-line1 a:hover {
  color: #000000;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Optional: Slight lift + color change */
.footer a:hover {
  transform: translateY(-1px);
}

/* ==================== Ko-fi Link Specific ==================== */

.ko-fi-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  gap: 0.15rem;
  font-weight: 500;
}
.ko-fi-link::after {
  content: "";
  display: inline-block;
  width: 1rem;
  height: 1rem;
  background: url("/static/kofi_symbol.png") no-repeat center;
  background-size: contain;
  flex-shrink: 0;

  /* Hover transition */
  transition:
    transform 0.3s ease,
    filter 0.3s ease;
}

.ko-fi-link:hover {
  color: #ff5e5b; /* Ko-fi's signature pink/red */
  text-decoration: underline;
  text-underline-offset: 3px;
}

.ko-fi-link:hover::after {
  transform: scale(1.25);
  filter: brightness(1.15) saturate(1.3);
}
.timer {
  font-family: "Courier New", monospace;
  font-size: 0.9rem;
  color: #000000;
  padding: 0.6rem 0;
}

.how-to-play-button {
  color: #0055cc;
  border-radius: 50%;
  font-size: 1.1rem;
}

.how-to-play {
  background: #1a1a1a;
  color: #f0f0f0;
  border: none;
  border-radius: 12px;
  padding: 0;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  margin: auto;
  height: fit-content;
  max-height: 92vh;
  overflow-y: auto;
}

.how-to-play::backdrop {
  background: rgba(0, 0, 0, 0.5);
}

/* Make it more responsive on small screens */
@media (max-width: 480px) {
  .how-to-play {
    max-width: 92vw; /* Prevents overflow on very small screens */
    border-radius: 10px;
    margin: 16px auto; /* Small margin from screen edges */
  }
}

@media (max-width: 360px) {
  .how-to-play {
    max-width: 94vw;
  }
}

/* Content padding that scales down nicely */
.how-to-play-content {
  padding: 32px 36px 4px;
  position: relative;
}

@media (max-width: 420px) {
  .how-to-play-content {
    padding: 28px 24px 32px; /* Reduced horizontal padding on smaller screens */
  }
}

@media (max-width: 340px) {
  .how-to-play-content {
    padding: 24px 20px 28px; /* Even tighter on very small phones */
  }
}

.dialog-content {
  padding: 24px 28px 32px;
  position: relative;
}

.close-btn {
  position: absolute;
  top: 16px;
  right: 20px;
  background: none;
  border: none;
  font-size: 24px;
  color: #888;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 50%;
  transition: color 0.2s;
}

.close-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

h2 {
  font-size: 28px;
  margin: 0 0 8px 0;
  text-align: center;
}

.subtitle {
  text-align: center;
  color: #aaa;
  margin-bottom: 24px;
  font-size: 15px;
  line-height: 1.4;
}

.sudoku-rules {
  text-align: left;
}

.sudoku-rules ul {
  padding-left: 20px;
  margin: 20px 0;
  line-height: 1.6;
}

.sudoku-rules li {
  margin-bottom: 8px;
  font-size: 15px;
}

.interface-examples-list {
  list-style-type: none;
}
.button-examples {
  border: 1px solid #0071e3;
  background: #0071e3;
  color: #fff;
  width: 33%;
  padding: 0.1rem 0.1rem;
  position: relative;
  overflow: hidden;
}
