/* ==========================================================================
   WordGrid.css — Word Grid Challenge (Deutsch Edition)
   ========================================================================== */

:root {
  --GridBg: var(--Graphite);
}

.WordGridPage {
  display: grid;
  place-items: center;
}

.App {
  width: min(100%, 1000px);
  min-height: min(100vh, 760px);
  padding: 24px clamp(16px, 5vw, 48px);
  background: var(--Page);
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: 0 10px 40px rgba(0,0,0,0.06);
}
.AppHeader {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.BrandHeader {
  flex: 1 1 520px;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.TitleGroup {
  flex: 1 1 280px;
  min-width: 0;
}
.TitleGroup h1 {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: clamp(20px, 2.6vw, 27px);
  line-height: 1.2;
  letter-spacing: -.7px;
  font-weight: 780;
}
.TitleIcon { color: var(--MintInk); font-size: .9em; }
.TitleGroup p {
  margin: 5px 0 0;
  color: var(--Muted);
  font-size: 13px;
}
.HeaderActions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.TimerPill {
  font-variant-numeric: tabular-nums;
  background: #ececec;
  color: var(--InkSoft);
  padding: 7px 12px;
  border-radius: var(--RadiusPill);
  font-size: 13px;
  font-weight: 700;
}

.MainContent {
  flex: 1;
  display: grid;
  grid-template-columns: 260px 1fr;
  align-items: center;
  gap: 28px;
  padding: 18px 0 10px;
}
.BrandPanel {
  background: var(--White);
  border: 1px solid #e2ece7;
  border-radius: 22px;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.04);
}
.BrandPanelLogo {
  width: 100%;
  max-width: 220px;
  height: auto;
  display: block;
}
.BrandTagline {
  margin: 12px 0 0;
  font-size: 12.5px;
  color: #687872;
  line-height: 1.45;
}
.BrandDivider {
  width: 48px;
  height: 3px;
  border-radius: var(--RadiusPill);
  background: var(--Mint);
  margin: 14px 0;
}
.BrandTip {
  font-size: 11.5px;
  color: var(--MintInk);
  background: #eef8f4;
  border: 1px solid #d2ede2;
  border-radius: 12px;
  padding: 9px 11px;
  font-weight: 600;
  line-height: 1.4;
}
.GameArea {
  display: grid;
  place-items: center;
}
.Game {
  width: min(100%, 440px);
  position: relative;
}
.Board {
  width: 100%;
  padding: 12px;
  border: 1px solid #9b9b9b;
  border-radius: 19px;
  background: #e5e5e5;
  box-shadow: 0 3px 0 #c7c7c7, 0 15px 28px #0000000b;
  position: relative;
}
.Grid {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: var(--GridBg);
  touch-action: none;
  user-select: none;
  position: relative;
}
.Cell {
  aspect-ratio: 1;
  min-width: 0;
  border: 0;
  border-radius: 4px;
  display: grid;
  place-items: center;
  padding: 0;
  background: var(--Mint);
  color: #fff;
  font-weight: 800;
  font-size: clamp(13px, 2.5vw, 21px);
  line-height: 1;
  cursor: pointer;
  user-select: none;
  position: relative;
  overflow: hidden;
  transition: background .12s, transform .12s, box-shadow .12s, color .12s;
}
.Cell:hover { background: var(--MintLight); }
.Cell:focus-visible { outline: 3px solid #367d68; outline-offset: 1px; z-index: 2; }
.Cell.IsSelected {
  background: var(--Rose);
  color: var(--RoseInk);
  transform: scale(.93);
  box-shadow: inset 0 0 0 2px #d9999c;
}
.Cell.IsFound {
  background: var(--MintDark);
  color: #ffffff;
  box-shadow: inset 0 0 0 2px var(--MintDeep);
}
.Cell.IsFound.IsSelected {
  background: var(--Rose);
  color: var(--RoseInk);
}

/* Word-row completed animation */
.Cell.RowCompleteAnim {
  animation: WordWavePop 0.78s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  z-index: 3;
}
.Cell.RowCompleteAnim::after {
  content: "";
  position: absolute;
  inset: -20%;
  background: linear-gradient(
    115deg,
    rgba(255,255,255,0) 20%,
    rgba(255,255,255,0.85) 50%,
    rgba(255,255,255,0) 80%
  );
  transform: translateX(-120%) rotate(15deg);
  animation: ShimmerSweep 0.7s ease-out forwards;
  animation-delay: inherit;
  pointer-events: none;
}
@keyframes WordWavePop {
  0% {
    transform: scale(0.9);
    background: var(--Rose);
    color: var(--RoseInk);
  }
  40% {
    transform: translateY(-7px) scale(1.14) rotate(-3deg);
    background: #ffe066;
    color: #215742;
    box-shadow: 0 8px 18px rgba(44, 142, 106, 0.45), inset 0 0 0 2px #ffffff;
  }
  72% {
    transform: translateY(2px) scale(0.97) rotate(1deg);
    background: #5cd6ab;
    color: #fff;
  }
  100% {
    transform: translateY(0) scale(1) rotate(0);
    background: var(--MintDark);
    color: #fff;
    box-shadow: inset 0 0 0 2px var(--MintDeep);
  }
}
@keyframes ShimmerSweep {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(120%); }
}

/* Wrong selection shake */
.Cell.ShakeWrong {
  animation: WrongShake 0.35s ease;
}
@keyframes WrongShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); background: #e9a3a7; }
  75% { transform: translateX(4px); background: #e9a3a7; }
}

/* Floating word-completed banner */
.WordBanner {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(0.7);
  background: linear-gradient(135deg, #2b7a5e, #48b28c);
  color: #fff;
  padding: 9px 18px;
  border-radius: var(--RadiusPill);
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.4px;
  white-space: nowrap;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28), 0 0 0 3px rgba(255,255,255,0.85);
  pointer-events: none;
  z-index: 10;
  opacity: 0;
  animation: FloatBanner 1.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.WordBanner small {
  font-weight: 600;
  opacity: 0.9;
  margin-left: 6px;
  font-size: 12.5px;
}
@keyframes FloatBanner {
  0% { opacity: 0; transform: translate(-50%, -20%) scale(0.6); }
  22% { opacity: 1; transform: translate(-50%, -50%) scale(1.06); }
  40% { opacity: 1; transform: translate(-50%, -55%) scale(1); }
  80% { opacity: 1; transform: translate(-50%, -75%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -105%) scale(0.92); }
}

/* Sparkle particles */
.Sparkle {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 9;
  animation: SparkleFly 0.75s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes SparkleFly {
  0% { opacity: 1; transform: translate(0, 0) scale(1); }
  100% { opacity: 0; transform: translate(var(--Dx), var(--Dy)) scale(0.2); }
}

.Status {
  min-height: 32px;
  margin: 14px 2px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #666;
  font-size: 13px;
}
.StatusLeft {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.ClearBtn {
  border: 0;
  background: #e9d6d7;
  color: #6e3b3d;
  border-radius: var(--RadiusPill);
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  display: none;
}
.ClearBtn.IsVisible { display: inline-block; }
.Count {
  color: #3f8069;
  font-weight: 780;
  white-space: nowrap;
}

.Words {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  justify-content: center;
  margin-top: 12px;
}
.WordChip {
  border-radius: var(--RadiusPill);
  background: var(--MintWash);
  color: #2f7058;
  padding: 6px 11px;
  font-size: 12px;
  font-weight: 780;
  letter-spacing: .3px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--MintLine);
  transition: transform .25s ease, background .25s ease, color .25s ease;
}
.WordChip .Meaning {
  font-weight: 600;
  color: #5b8e7b;
  font-size: 11px;
}
.WordChip.IsFoundChip {
  background: var(--MintInk);
  color: #fff;
  border-color: #2c735a;
  animation: ChipCelebrate 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}
.WordChip.IsFoundChip .Meaning {
  color: #d6f5e8;
}
@keyframes ChipCelebrate {
  0% { transform: scale(1); }
  45% { transform: scale(1.15); background: var(--Gold); color: #265946; }
  100% { transform: scale(1); }
}

/* Victory modal */
.ModalBackdrop {
  position: fixed;
  inset: 0;
  background: rgba(32, 38, 36, 0.62);
  backdrop-filter: blur(5px);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity .28s ease;
}
.ModalBackdrop.IsOpen {
  opacity: 1;
  pointer-events: auto;
}
.ModalCard {
  width: min(100%, 420px);
  background: #ffffff;
  border-radius: 22px;
  padding: 26px 24px 22px;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.22), 0 0 0 1px #dcebe4;
  text-align: center;
  transform: translateY(18px) scale(0.95);
  transition: transform .32s cubic-bezier(0.22, 1, 0.36, 1);
}
.ModalBackdrop.IsOpen .ModalCard {
  transform: translateY(0) scale(1);
}
.TrophyBadge {
  width: 60px;
  height: 60px;
  margin: 0 auto 12px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--Mint), var(--MintInk));
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 30px;
  box-shadow: 0 8px 20px rgba(59, 140, 112, 0.35);
}
.ModalCard h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  color: #25332e;
  letter-spacing: -0.5px;
}
.ModalSubtitle {
  margin: 6px 0 16px;
  color: #6b7873;
  font-size: 13.5px;
}
.StatsRow {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.StatBox {
  background: #f3faf7;
  border: 1px solid #d5eee3;
  border-radius: 13px;
  padding: 10px;
}
.StatLabel {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #67887c;
  font-weight: 700;
}
.StatValue {
  font-size: 19px;
  font-weight: 800;
  color: #27634d;
  margin-top: 2px;
}
.VocabRecap {
  text-align: left;
  background: #f8f9f9;
  border: 1px solid #e6ece9;
  border-radius: 13px;
  padding: 10px 12px;
  margin-bottom: 18px;
  max-height: 155px;
  overflow-y: auto;
}
.VocabRecapTitle {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #778580;
  margin-bottom: 7px;
}
.VocabItem {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  padding: 4px 0;
  border-bottom: 1px dashed #e5ece9;
}
.VocabItem:last-child { border-bottom: 0; }
.VocabItem strong { color: #2b6e55; }
.VocabItem span { color: #6c7874; }
.ModalActions {
  display: flex;
  gap: 10px;
  justify-content: center;
}
.ModalActions .Btn {
  flex: 1;
  justify-content: center;
  padding: 11px 16px;
  font-size: 13.5px;
}

@media (max-width: 780px) {
  .MainContent {
    grid-template-columns: 1fr;
    gap: 18px;
  }
  .BrandPanel {
    padding: 14px 16px;
    flex-direction: row;
    justify-content: space-between;
    text-align: left;
    gap: 14px;
  }
  .BrandPanelLogo {
    max-width: 155px;
  }
  .BrandDivider {
    display: none;
  }
  .BrandTagline {
    margin: 0;
  }
}
@media (max-width: 520px) {
  .BrandPanel {
    flex-direction: column;
    text-align: center;
  }
}
@media (max-width: 460px) {
  .App { padding: 18px 14px; }
  .Board { padding: 8px; border-radius: 15px; }
  .Grid { gap: 3px; padding: 3px; }
  .Cell { font-size: clamp(12px, 4.2vw, 17px); }
}
