.flashcard { box-sizing: border-box; max-width: calc(100vw - 32px); }
.flashcard-set {
    grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
}
.flashcard-set-wrapper { width:100%; display:flex; justify-content:center; }
.flashcard:focus-visible { outline:2px solid #ffcc70; }

@font-face {
    font-family: Fira Code;
    src: url(../assets/fonts/FiraCode-Light.woff2) format("woff2");
    font-weight: 300;
    font-style: normal;
}

@font-face {
    font-family: Fira Code;
    src: url(../assets/fonts/FiraCode-Regular.woff2) format("woff2");
    font-weight: 400;
    font-style: normal;
}

@font-face {
    font-family: Fira Code;
    src: url(../assets/fonts/FiraCode-Medium.woff2) format("woff2");
    font-weight: 500;
    font-style: normal;
}

@font-face {
    font-family: Fira Code;
    src: url(../assets/fonts/FiraCode-SemiBold.woff2) format("woff2");
    font-weight: 600;
    font-style: normal;
}

@font-face {
    font-family: Fira Code;
    src: url(../assets/fonts/FiraCode-Bold.woff2) format("woff2");
    font-weight: 700;
    font-style: normal;
}

* {
  -webkit-user-select: none; 
  -moz-user-select: none;    
  -ms-user-select: none;     
  user-select: none;         
}

body {
    margin: 0;
    padding: 0;
    font-family: Fira Code, monospace;
    -webkit-font-smoothing: antialiased;
    font-size: 1.2rem;
    background-color: #1e1e1e;
    color: #f5f5f5;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-bottom: 50px;
}

h2 {
    margin-top: 40px;
    color: #ffcc70;
    border-bottom: 1px solid #444;
    padding-bottom: 5px;
}

h1 {
  margin-top: 20px;
  color: whitesmoke;
  padding-bottom: 5px;
}

.font-bold {
    font-weight: 700;
}
.font-semibold {
    font-weight: 600;
}
.font-medium {
    font-weight: 500;
}
.font-regular {
    font-weight: 400;
}
.font-light {
    font-weight: 300;
}

.flashcard-set {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  column-gap: 55px;
  row-gap: 15px;
  width: 90%;
  max-width: 1200px;
  margin-bottom: 40px;
  justify-items: center;
}

.flashcard {
    flex: 0 0 auto;
    scroll-snap-align: start;
    width: 350px;
    height: 200px;
    padding: 15px;
    border: 1px solid #333;
    border-radius: 12px;
    background: #2a2a2a;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    font-size: 1em;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.flashcard:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.6);
}

.card-inner {
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
    position: relative;
}

.flashcard.flipped .card-inner {
    transform: rotateY(180deg);
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0; left: 0;
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 10px;
    box-sizing: border-box;
}

.card-front {
    background-color: #2a2a2a;
    color: #f5f5f5;
}

.card-back {
    font-size: 1rem;
    line-height: 1.4;
    background-color: #393e46;
    color: #d2f1ff;
    transform: rotateY(180deg);
}

button {
    background-color: #3b3b3b;
    color: #fff;
    border: none;
    padding: 10px 20px;
    margin-bottom: 30px;
    font-family: inherit;
    -webkit-font-smoothing: antialiased;
    font-size: 1rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.3s;
}

button:hover {
    background-color: #505050;
}

::-webkit-scrollbar {
    height: 10px;
}
::-webkit-scrollbar-track {
    background: #1e1e1e;
}
::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 5px;
}
::-webkit-scrollbar-thumb:hover {
    background: #888;
}

.katex {
   display: inline-block;
   vertical-align: baseline;
   }

.flashcard-content {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-align: center;
}

.math-expression {
  margin: 0.5em 0;
}

.label {
  margin: 0.5em 0;
}

@media (max-width: 830px) {
  .flashcard-set {
    grid-template-columns: 1fr;
  }
}

#flashcards-set-master {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}