:root{
  --km-dark:#3f455f;
  --km-main:#4b526f;
  --km-soft:#949bb7;

  --km-bg:#eef0f7;
  --km-panel:#f7f8fc;
  --km-border:rgba(75,82,111,.14);

  --km-muted:rgba(63,69,95,.62);
}


/* BASIS */

*{
  box-sizing:border-box;
}

html,
body{
  margin:0;
  min-height:100%;
}

body{
  font-family:'Jura',sans-serif;
  color:var(--km-dark);

  background:
    linear-gradient(
      rgba(62,65,71,.47),
      rgba(62,65,71,.47)
    ),
    url("https://api.krakkemat.be/media/algemeen/krakkemat-achtergrond.jpg")
    center center / cover fixed no-repeat;

  background-color:#3e4147;
}


button,
input,
select{
  font:inherit;
}


/* VOLLEDIGE DATABASE */

.km-db{
  width:min(1600px,calc(100% - 48px));
  margin:0 auto;
  padding:28px 0 20px;
}


/* HEADER */

.km-db-header{
  min-height:108px;

  display:flex;
  align-items:center;
  justify-content:space-between;

  gap:32px;

  padding:18px 26px;

  border:1px solid rgba(255,255,255,.42);
  border-radius:22px;

  background:rgba(247,248,252,.62);

  box-shadow:
    0 14px 34px rgba(63,69,95,.09),
    inset 0 1px 0 rgba(255,255,255,.72);
}


.km-db-brand{
  display:flex;
  align-items:center;
  gap:18px;
}


.km-db-logo-link{
  display:block;
  flex:0 0 auto;
}


.km-db-logo{
  width:72px;
  height:72px;

  display:block;
  object-fit:contain;
}


.km-db-title h1{
  margin:0;

  font-size:32px;
  line-height:1;

  font-weight:700;
  letter-spacing:.12em;
}


.km-db-title p{
  margin:8px 0 0;

  font-size:15px;
  font-weight:500;

  color:var(--km-muted);
}


/* STATISTIEKEN */

.km-db-stats{
  display:flex;
  align-items:center;

  border-radius:16px;

  overflow:hidden;

  background:rgba(216,220,235,.48);

  border:1px solid var(--km-border);
}


.km-db-stat{
  min-width:92px;

  padding:12px 18px;

  text-align:center;

  border-left:1px solid var(--km-border);
}


.km-db-stat:first-child{
  border-left:none;
}


.km-db-stat strong{
  display:block;

  font-size:22px;
  line-height:1;

  font-weight:700;
}


.km-db-stat span{
  display:block;

  margin-top:5px;

  font-size:11px;
  font-weight:600;

  color:var(--km-muted);
}


.km-db-stat-main{
  min-width:112px;

  background:var(--km-main);
  color:white;
}


.km-db-stat-main span{
  color:rgba(255,255,255,.72);
}


/* FILTERBALK */

.km-db-filters{
  position:relative;

  display:grid;

  grid-template-columns:
    minmax(230px,1.8fr)
    minmax(150px,1fr)
    125px
    130px
    105px
    150px
    90px;

  gap:10px;

  margin-top:18px;

  padding:14px;

  border-radius:18px;

  background:rgba(247,248,252,.70);

  border:1px solid rgba(255,255,255,.48);

  box-shadow:
    0 10px 26px rgba(63,69,95,.07);
}


.km-db-filters select,
.km-db-filters input,
.km-filter-button,
.km-reset-button{
  width:100%;
  height:42px;

  border-radius:11px;

  border:1px solid var(--km-border);

  outline:none;

  background:#f3f5fa;

  color:var(--km-dark);

  padding:0 13px;

  font-size:13px;
  font-weight:600;
}


.km-db-filters select{
  cursor:pointer;
}


.km-db-filters select:focus,
.km-db-filters input:focus{
  border-color:rgba(75,82,111,.38);

  box-shadow:
    0 0 0 3px rgba(75,82,111,.07);
}


/* ZOEKEN */

.km-filter-search{
  position:relative;
}


.km-filter-search input{
  padding-left:38px;
}


.km-search-icon{
  position:absolute;

  left:14px;
  top:50%;

  transform:translateY(-52%);

  font-size:19px;

  color:var(--km-soft);

  pointer-events:none;
}


/* KNOPPEN */

.km-filter-button{
  cursor:pointer;
}


.km-reset-button{
  border:none;

  cursor:pointer;

  background:var(--km-main);
  color:white;

  transition:
    background .15s ease,
    transform .15s ease;
}


.km-reset-button:hover{
  background:var(--km-dark);
}


.km-filter-button:hover{
  background:#e8ebf4;
}


/* DATUMFILTER */

.km-date-filter-wrap{
  position:relative;
  min-width:0;
}

.km-date-filter-wrap > .km-filter-button{
  width:100%;
}

.km-date-fields{
  display:none;

  position:absolute;
  z-index:50;

  top:50px;
  left:50%;

  width:290px;

  transform:translateX(-50%);

  grid-template-columns:1fr 1fr;
  gap:10px;

  padding:12px;

  border:1px solid var(--km-border);
  border-radius:14px;

  background:#f7f8fc;

  box-shadow:
    0 14px 30px rgba(63,69,95,.18);
}

.km-date-fields.open{
  display:grid;
}

.km-date-field{
  min-width:0;
}

.km-date-field label{
  display:block;

  margin:0 0 5px 3px;

  font-size:10px;
  font-weight:700;

  color:var(--km-muted);
}

.km-date-field input{
  width:100%;
  height:38px;

  padding:0 8px;

  border:1px solid var(--km-border);
  border-radius:9px;

  background:#f3f5fa;
  color:var(--km-dark);

  font-size:11px;
}

.km-date-apply,
.km-date-clear{
  height:34px;

  border-radius:9px;

  font-size:11px;
  font-weight:700;

  cursor:pointer;
}

.km-date-apply{
  border:none;

  background:var(--km-main);
  color:white;
}

.km-date-clear{
  border:1px solid var(--km-border);

  background:#e6e9f1;
  color:var(--km-dark);
}

/* FILTERSTATUS */

.km-db-summary{
  min-height:42px;

  display:flex;
  align-items:center;
  justify-content:space-between;

  gap:20px;

  padding:0 8px;

  font-size:12px;
  font-weight:600;

  color:var(--km-muted);
}


#zichtbarePartijen{
  white-space:nowrap;
}


/* WERKRUIMTE */

.km-db-workspace{
  display:grid;

  grid-template-columns:
    minmax(500px,.9fr)
    minmax(640px,1.1fr);

  gap:18px;

  align-items:start;
}


/* PANELEN */

.km-db-list-panel,
.km-db-viewer-panel{
  overflow:hidden;

  border-radius:20px;

  background:rgba(247,248,252,.78);

  border:1px solid rgba(255,255,255,.55);

  box-shadow:
    0 16px 34px rgba(63,69,95,.09),
    inset 0 1px 0 rgba(255,255,255,.70);
}


.km-panel-heading{
  height:46px;

  display:flex;
  align-items:center;

  padding:0 20px;

  border-bottom:1px solid var(--km-border);

  font-size:12px;
  font-weight:700;
  letter-spacing:.12em;

  color:var(--km-muted);
}


/* PARTIJENLIJST */

.km-games-scroll{
  height:calc(100vh - 285px);
  min-height:560px;

  overflow-y:auto;
}


.km-games-list{
  width:100%;
}


/* COMPACTE PARTIJREGEL */

.km-game-row{
  position:relative;

  min-height:66px;

  padding:10px 16px 9px 19px;

  border-bottom:1px solid rgba(75,82,111,.10);

  cursor:pointer;

  transition:
    background .14s ease;
}


.km-game-row:last-child{
  border-bottom:none;
}


.km-game-row:hover{
  background:rgba(216,220,235,.42);
}


.km-game-row.active{
  background:rgba(199,204,223,.56);
}


.km-game-row.active::before{
  content:"";

  position:absolute;

  left:0;
  top:8px;
  bottom:8px;

  width:4px;

  border-radius:0 4px 4px 0;

  background:var(--km-main);
}


/* SPELERS + RESULTAAT */

.km-game-main{
  display:grid;

  grid-template-columns:minmax(0,1fr) 62px;

  gap:14px;

  align-items:center;
}


.km-game-players{
  min-width:0;

  display:grid;

  grid-template-columns:1fr 1fr;

  gap:16px;

  font-size:14px;
  font-weight:650;
}


.km-game-players span{
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}


.km-game-result{
  font-size:15px;
  font-weight:700;

  text-align:right;

  white-space:nowrap;

  color:var(--km-dark);
}


/* EVENT + DATUM */

.km-game-meta{
  display:flex;
  align-items:center;
  justify-content:space-between;

  gap:20px;

  margin-top:5px;

  font-size:11px;
  font-weight:500;

  color:var(--km-muted);
}


.km-game-meta span:first-child{
  min-width:0;

  overflow:hidden;
  white-space:nowrap;
  text-overflow:ellipsis;
}


.km-game-meta span:last-child{
  flex:0 0 auto;

  white-space:nowrap;
}


/* SCROLLBAR */

.km-games-scroll::-webkit-scrollbar{
  width:7px;
}


.km-games-scroll::-webkit-scrollbar-track{
  background:transparent;
}


.km-games-scroll::-webkit-scrollbar-thumb{
  background:rgba(75,82,111,.22);

  border-radius:999px;
}


/* VIEWER */

.km-db-viewer-panel{
  position:sticky;
  top:18px;
}


.km-viewer-placeholder{
  min-height:650px;

  display:flex;
  align-items:center;
  justify-content:center;
}


.km-viewer-empty{
  width:300px;

  text-align:center;

  color:var(--km-muted);
}


.km-viewer-empty-icon{
  margin-bottom:14px;

  font-size:48px;

  color:var(--km-soft);
}


.km-viewer-empty strong{
  display:block;

  font-size:18px;

  color:var(--km-dark);
}


.km-viewer-empty span{
  display:block;

  margin-top:8px;

  font-size:13px;
  line-height:1.5;
}


/* FOOTER */

.km-db-footer{
  padding:18px 8px 0;

  text-align:center;

  font-size:10px;
  font-weight:500;

  color:rgba(255,255,255,.68);

  text-shadow:
    0 1px 3px rgba(0,0,0,.45);
}


/* KLEINERE DESKTOPS */

@media(max-width:1200px){

  .km-db{
    width:calc(100% - 28px);
  }

  .km-db-filters{
    grid-template-columns:
      minmax(220px,1.5fr)
      minmax(140px,1fr)
      120px
      120px
      100px
      140px
      85px;
  }

  .km-db-workspace{
    grid-template-columns:
      minmax(460px,.9fr)
      minmax(540px,1.1fr);
  }

}

/* =========================
   GEÏNTEGREERDE PARTIJVIEWER
   ========================= */

.km-integrated-viewer{
  display:none;
  width:100%;
  padding:20px;
}

.km-integrated-viewer.active{
  display:block;
}


/* HEADER PARTIJ */

.km-viewer-game-head{
  display:grid;
  grid-template-columns:1fr auto 1fr;
  gap:18px;
  align-items:center;

  padding:4px 4px 14px;
}

.km-viewer-player-block{
  min-width:0;
}

.km-viewer-player-black{
  text-align:right;
}

.km-viewer-label{
  display:block;
  margin-bottom:4px;

  font-size:10px;
  font-weight:700;
  letter-spacing:.08em;
  text-transform:uppercase;

  color:var(--km-soft);
}

.km-viewer-player-block strong{
  display:block;

  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;

  font-size:16px;
  font-weight:700;

  color:var(--km-dark);
}

.km-viewer-score{
  min-width:64px;

  padding:8px 12px;

  border-radius:10px;

  text-align:center;

  font-size:15px;
  font-weight:700;

  background:#e2e5ef;

  border:1px solid var(--km-border);
}


/* META */

.km-viewer-meta{
  margin-bottom:16px;

  padding-bottom:14px;

  border-bottom:1px solid var(--km-border);

  font-size:11px;
  font-weight:600;

  color:var(--km-muted);
}


/* BORD + ZETTEN */

.km-viewer-content{
  display:grid;

  grid-template-columns:
    minmax(360px,1fr)
    minmax(220px,.66fr);

  gap:16px;

  align-items:start;
}


.km-board-panel{
  min-width:0;
}


.km-board-wrap{
  position:relative;

  width:100%;
  aspect-ratio:1/1;

  padding:12px;

  border-radius:14px;

  overflow:hidden;

  background:var(--km-dark);

  box-shadow:
    0 12px 26px rgba(63,69,95,.16);
}


.km-board{
  width:100%;
  height:100%;

  display:grid;

  grid-template-columns:
    repeat(8,1fr);

  grid-template-rows:
    repeat(8,1fr);

  overflow:hidden;

  border-radius:4px;
}


.km-square{
  display:flex;
  align-items:center;
  justify-content:center;
}


.km-light{
  background:#edf0fa;
}


.km-dark-square{
  background:#8f99ba;
}


.km-piece{
  width:86%;
  height:86%;

  object-fit:contain;

  pointer-events:none;

  filter:
    drop-shadow(
      0 2px 2px
      rgba(20,25,45,.26)
    );
}


/* COÖRDINATEN */

.km-board-ranks{
  position:absolute;

  left:3px;
  top:14px;
  bottom:14px;

  display:grid;

  grid-template-rows:
    repeat(8,1fr);

  align-items:center;
  justify-items:center;

  color:white;

  font-size:9px;
  font-weight:700;

  z-index:2;
}


.km-board-files{
  position:absolute;

  left:16px;
  right:8px;
  bottom:0;

  display:grid;

  grid-template-columns:
    repeat(8,1fr);

  text-align:center;

  color:white;

  font-size:9px;
  font-weight:700;

  z-index:2;
}


/* ZETTENPANEEL */

.km-moves-panel{
  height:100%;
  min-height:360px;

  overflow:hidden;

  border-radius:14px;

  background:#eef0f6;

  border:1px solid var(--km-border);
}


.km-moves{
  height:100%;
  max-height:440px;

  overflow-y:auto;

  padding:14px;

  font-size:12px;
  line-height:1.65;

  color:var(--km-dark);
}


.km-move-row{
  display:grid;

  grid-template-columns:
    28px 1fr 1fr;

  gap:6px;

  align-items:center;

  margin-bottom:3px;
}


.km-move-number{
  color:var(--km-soft);
  font-weight:700;
}


.km-move{
  border:none;

  border-radius:6px;

  background:transparent;

  text-align:left;

  padding:3px 6px;

  color:var(--km-dark);

  font:inherit;
  font-weight:650;

  cursor:pointer;
}


.km-move:hover{
  background:
    rgba(75,82,111,.08);
}


.km-move.active{
  background:
    rgba(75,82,111,.16);
}


.km-move-result{
  margin-top:12px;

  padding:9px 10px;

  border-radius:8px;

  text-align:center;

  font-weight:700;

  background:
    rgba(148,155,183,.18);
}


/* CONTROLES */

.km-viewer-controls{
  display:flex;

  justify-content:center;

  gap:8px;

  margin-top:16px;
}


.km-viewer-controls button{
  width:48px;
  height:38px;

  border-radius:9px;

  border:1px solid var(--km-border);

  background:#e3e6ef;

  color:var(--km-dark);

  font-size:16px;
  font-weight:700;

  cursor:pointer;

  transition:
    background .14s ease,
    transform .14s ease;
}


.km-viewer-controls button:hover{
  background:#d8dce8;
  transform:translateY(-1px);
}


/* VIEWER SCROLLBAR */

.km-moves::-webkit-scrollbar{
  width:6px;
}

.km-moves::-webkit-scrollbar-track{
  background:transparent;
}

.km-moves::-webkit-scrollbar-thumb{
  background:rgba(75,82,111,.20);
  border-radius:999px;
}

/* Hoofdpanelen */
.km-db-workspace{
  align-items:start;
}

.km-db-list-panel{
  display:flex;
  flex-direction:column;
  overflow:hidden;
}

.km-games-scroll{
  flex:1;
  height:auto;
  min-height:0;
  overflow-y:auto;
}

.km-db-viewer-panel{
  height:auto;
}


/* =========================
   MOBIELE PARTIJENDATABASE
   ========================= */

.km-mobile-back{
  display:none;
}

@media(max-width:820px){

  body{
    overflow-x:hidden;
  }
html,
body{
  background:
    linear-gradient(
      rgba(62,65,71,.47),
      rgba(62,65,71,.47)
    ),
    url("https://api.krakkemat.be/media/algemeen/krakkemat-achtergrond.jpg")
    center center / cover scroll no-repeat;

  background-color:#3e4147;
}

.km-db-header,
.km-db-filters,
.km-db-list-panel,
.km-db-viewer-panel{
  background:#f7f8fc;
}

  /* ALGEMEEN */

  .km-db{
    width:calc(100% - 16px);
    padding:12px 0 20px;
  }


  /* HEADER */

  .km-db-header{
    min-height:auto;
    padding:18px 16px;
    border-radius:18px;
  }

  .km-db-brand{
    width:100%;
    justify-content:center;
    gap:12px;
  }

  .km-db-logo{
    width:58px;
    height:58px;
  }

  .km-db-title h1{
    font-size:25px;
    letter-spacing:.10em;
  }

  .km-db-title p{
    margin-top:6px;
    font-size:13px;
  }

  .km-db-stats{
    display:none;
  }


  /* FILTERS */

  .km-db-filters{
    grid-template-columns:1fr 1fr;
    gap:8px;

    margin-top:12px;
    padding:10px;

    border-radius:16px;
  }

  .km-filter-search{
    grid-column:1 / -1;
  }

  .km-db-filters select,
  .km-db-filters input,
  .km-filter-button,
  .km-reset-button{
    min-width:0;
    height:42px;
    padding:0 10px;
    font-size:12px;
  }

  .km-filter-search input{
    padding-left:36px;
  }

.km-date-filter-wrap{
  position:static;
  min-width:0;
}

.km-date-fields{
  position:static;

  width:auto;

  margin-top:8px;
  padding:10px;

  transform:none;

  grid-template-columns:1fr 1fr;

  border-radius:12px;

  box-shadow:none;
}

.km-date-fields.open{
  display:grid;

  grid-column:1 / -1;
}

.km-date-filter-wrap:has(.km-date-fields.open){
  grid-column:1 / -1;
}

.km-date-filter-wrap:has(.km-date-fields.open)
> .km-filter-button{
  width:calc(50% - 4px);
}

.km-date-field input{
  height:40px;
  font-size:12px;
}


  /* FILTERSTATUS */

  .km-db-summary{
    min-height:40px;
    padding:0 6px;
    gap:8px;
    font-size:11px;
  }

  #zichtbarePartijen{
    text-align:right;
    white-space:normal;
  }


  /* WERKRUIMTE */

  .km-db-workspace{
    display:block;
    height:auto;
    min-height:0;
    overflow:visible;
  }


  /* PARTIJENLIJST */

  .km-db-list-panel{
    display:block;
    position:static;

    width:100%;
    height:auto;
    min-height:0;
    max-height:none;

    overflow:visible;

    border-radius:17px;
  }

  .km-panel-heading{
    height:40px;
    padding:0 14px;

    font-size:11px;
  }

  .km-games-scroll{
    display:block;
    position:static;

    flex:none;

    width:100%;
    height:auto;
    min-height:1px;
    max-height:none;

    overflow:visible;
  }

  #partijLijst,
  .km-games-list{
    display:block;
    position:static;

    width:100%;
    height:auto;
    min-height:1px;

    overflow:visible;
  }


  /* PARTIJREGELS */

  #partijLijst .km-game-row{
    display:block;
    position:relative;

    width:100%;
    height:auto;
    min-height:58px;

    padding:9px 12px;
  }

  .km-game-main{
    display:grid;
    grid-template-columns:minmax(0,1fr) 54px;
    gap:8px;
    align-items:center;
  }

  .km-game-players{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:10px;

    min-width:0;

    font-size:12px;
  }

  .km-game-result{
    font-size:13px;
  }

  .km-game-meta{
    gap:10px;
    margin-top:4px;

    font-size:10px;
  }


  /* VIEWER STANDAARD VERBORGEN */

  .km-db-viewer-panel{
    display:none;
    position:static;

    width:100%;
    height:auto;

    border-radius:17px;
  }


  /* =========================
     PARTIJ GEOPEND OP GSM
     ========================= */

  .km-db.mobile-viewer-open .km-db-filters,
  .km-db.mobile-viewer-open .km-db-summary,
  .km-db.mobile-viewer-open .km-db-list-panel{
    display:none;
  }

  .km-db.mobile-viewer-open .km-db-viewer-panel{
    display:block;

    width:100%;
    margin-top:12px;
  }

  .km-db.mobile-viewer-open .km-mobile-back{
    display:inline-flex;
    align-items:center;
    justify-content:center;

    min-height:36px;
    padding:0 12px;

    border:1px solid var(--km-border);
    border-radius:10px;

    background:#e3e6ef;
    color:var(--km-dark);

    font-size:11px;
    font-weight:700;

    cursor:pointer;
  }

  .km-viewer-heading{
    gap:12px;
  }


  /* GEÏNTEGREERDE VIEWER */

  .km-integrated-viewer{
    width:100%;
    padding:12px;
  }

  .km-db.mobile-viewer-open .km-integrated-viewer{
    width:100%;
  }


  /* SPELERS */

  .km-viewer-game-head{
    grid-template-columns:
      minmax(0,1fr)
      auto
      minmax(0,1fr);

    gap:7px;

    padding:2px 0 12px;
  }

  .km-viewer-player-block strong{
    font-size:13px;

    white-space:normal;
    overflow:visible;
    text-overflow:clip;
  }

  .km-viewer-label{
    font-size:9px;
  }

  .km-viewer-score{
    min-width:54px;
    padding:7px 8px;

    font-size:13px;
  }

  .km-viewer-meta{
    margin-bottom:12px;
    padding-bottom:11px;

    font-size:10px;
  }


  /* BORD + ZETTEN */

  .km-viewer-content{
    display:block;
  }

  .km-board-panel{
    width:100%;
  }

  .km-board-wrap{
    width:100%;
    max-width:100%;

    padding:10px;

    border-radius:12px;
  }

  .km-board-ranks{
    left:2px;
    top:12px;
    bottom:12px;
  }

  .km-board-files{
    left:14px;
    right:7px;
  }


  /* CONTROLES */

  .km-viewer-controls{
    gap:7px;
    margin-top:12px;
  }

  .km-viewer-controls button{
    width:46px;
    height:40px;
  }


  /* ZETTENLIJST */

  .km-moves-panel{
    width:100%;
    min-height:0;

    margin-top:14px;

    border-radius:12px;
  }

  .km-moves{
    height:auto;
    max-height:320px;

    padding:11px;

    font-size:12px;
  }

  .km-move-row{
    grid-template-columns:27px 1fr 1fr;
  }


  /* PLACEHOLDER */

  .km-viewer-placeholder{
    min-height:220px;
  }

  .km-viewer-empty{
    width:auto;
    padding:20px;
  }


  /* FOOTER */

  .km-db-footer{
    padding-top:14px;
  }

}



.km-db-header{
  background:
    linear-gradient(
      135deg,
      rgba(216,220,235,.97),
      rgba(199,204,223,.95)
    );
}

.km-db-filters,
.km-db-list-panel,
.km-db-viewer-panel{
  background:
    linear-gradient(
      145deg,
      rgba(238,240,247,.97),
      rgba(222,226,238,.95)
    );
}