* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: system-ui, sans-serif;
}

:root {
  --bg-main: #fdf6f0;
  --bg-sidebar: #f8e8ee;
  --bg-card: #fefaf4;
  --accent-pink: #f6a6b2;
  --accent-green: #b8e0d2;
  --accent-purple: #d5c6f5;
  --text-main: #5a4a4a;
  --text-light: #ffffff;
  --border-soft: #f2dcdc;  
  --progress-circle-bg: #eeeeee;
  --progress-circle-color: #b8e0d2;
  --bg-dots: rgb(251, 186, 197);
}

body.dark-mode{
  --bg-main: #14141c;
  --text-light: #f7f2f8;
  --accent-pink: #ff8fb1;
  --accent-green: #59d4b5;
  --accent-purple: #b4a1fd;
  --text-main: #f5f3f7;
  --bg-sidebar: #1c1c26;
  --bg-card: #27232f;
  --border-soft: #322f3d;
  --progress-circle-bg: #1f1f2c;
  --progress-circle-color: #59d4b5;
  --bg-dots: #514c66; 
}

body,
html {
  height: 100%;
  transition: background-color 0.3s ease, color 0.3s ease;
}

h2 {
  color: var(--text-main);
}
p{
  color: var(--text-main);
}

.container {
  display: flex;
  height: 100vh;
}

.sidebar {
  width: 220px;
  background-color: var(--bg-sidebar);
  color: var(--text-main);
  padding: 1.5rem;
  overflow-y: auto;
  border-right: 2px solid var(--border-soft);
}

.sidebar h1 {
  font-size: 1.4rem;
  margin-bottom: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #c06c84;
}

.sidebar .category {
  margin-top: 1.2rem;
  margin-bottom: 0.5rem;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #94a3b8;
}

.sidebar ul {
  list-style: none;
  margin-top: 0.5px;
  margin-bottom: 0.5px;
}

.sidebar li {
  margin-bottom: 0.5rem;
}

.sidebar a {
  color: var(--text-main);
  text-decoration: none;
  display: block;
  border-radius: 8px;
  transition:
    background 0.2s ease,
    color 0.2s ease,
    transform 0.1s ease;
  position: relative;
}

.sidebar a:hover {
  background-color: var(--accent-green);
  color: #3d5a5a;
}

.sidebar span.active {
  background-color: var(--accent-pink);
  color: white;
  border-radius: 8px;
  display: block;
}

#darkMode {
  margin-top: 1.2rem;
}

.main-view {
  flex: 1;
  padding: 2rem;
  background-color: var(--bg-main);
  background-image: radial-gradient(var(--bg-dots) 1px, transparent 1px);
  background-size: 25px 25px;
  overflow-y: auto;
}

textarea {
  width: 100%;
  min-height: 150px;
  margin-top: 1rem;
  padding: 0.9rem;
  font-family: monospace;
  resize: vertical;
  border-radius: 12px;
  border: 1px solid #cbd5e1;
  background-color: #ffffff;
  color: #0f172a;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.buttons {
  margin: 1rem 0;
  display: flex;
  gap: 0.5rem;
}

button {
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  background-color: var(--accent-pink);
  color: white;
  font-size: 0.95rem;
  transition: all 0.25s ease;
  box-shadow: 0 4px 10px rgba(246, 166, 178, 0.4);
}

button:hover {
  background-color: #f2859b;
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(31, 28, 30, 0.15);
}

button:active {
  transform: translateY(1px);
  box-shadow: 0 2px 6px rgba(31, 28, 30, 0.15);
}

.coin-flip {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.coin-wrapper {
  perspective: 800px;
  margin: 1rem 0;
}

.coin {
  width: 200px;
  height: 200px;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 1s cubic-bezier(.22,1.2,.36,1);
  border-radius: 50%;
  margin: 1rem 0;
  box-shadow: 0 10px 25px rgba(246, 166, 178, 0.25), 0 0 35px rgba(246, 166, 178, 0.15);
}

.coin-side {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--bg-card), var(--bg-main));
  box-shadow: inset 0 0 0 3px var(--accent-pink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: bold;
  backface-visibility: hidden;
  color: var(--text-main);
}

.coin-side.heads {
  transform: rotateY(0deg);
  background: var(--bg-card);
}

.coin-side.tails {
  transform: rotateY(180deg);
  background: var(--bg-card);
  box-shadow: inset 0 0 0 3px var(--accent-purple);
}

.coin-flip #flipBtn {
  font-size: 1rem;
  box-shadow: 0 6px 15px rgba(246, 166, 178, 0.35);
}

.coin-flip #flipBtn:hover {
  background-color: #f2859b;
  transform: translateY(-2px);
}

.coin-flip #flipBtn:active {
  transform: translateY(1px);
}

.coin-flip h2 {
  font-size: 2rem;
}
.coin-flip h2,
.coin-flip p {
  text-align: center;
}

@keyframes bounce {
  0% {transform: scale(1);}
  50% {transform: scale(1.08);}
  100% {transform: scale(1);}
}

.coin-wrapper.landed {
  animation: bounce 0.3s ease;
}

.card-wrapper {
  perspective: 1000px;
  width: 400px;
  height: 250px;
  margin: 2rem auto;
}

.flashcard {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.6s ease;
  cursor: pointer;
  will-change: transform;
}
.flashcard.flipped {
  transform: rotateY(180deg);
}

.flashcard.slide-left {
  animation: slideLeft 0.35s ease;
}
.flashcard.slide-right {
    animation: slideRight 0.35s ease;
}

body.dark-mode .deck-grid {
    color: #eee;

}

@keyframes slideLeft {
  0% {transform: translateX(0); opacity: 1;}
  50% {transform: translateX(-100%); opacity: 0;}
  51% {transform: translateX(100%); opacity: 0;}
  100% {transform: translateX(0); opacity: 1;}
}
@keyframes slideRight {
  0% {transform: translateX(0); opacity: 1;}
  50% {transform: translateX(100%); opacity: 0;}
  51% {transform: translateX(-100%); opacity: 0;}
  100% {transform: translateX(0); opacity: 1;}
}

.card-side {
  position: absolute;
  inset: 0;
  border-radius: 20px;
  background: var(--bg-card);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  text-align: center;
  font-size: 1.2rem;
  backface-visibility: hidden;
}

.card-front {
  background: linear-gradient(135deg,var(--bg-card), var(--bg-main));
}

.card-back {
  background: var(--accent-purple);
  color: #4a4a4a;
  transform: rotateY(180deg);
}

.modal-content {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 300px;
    color: var(--text-main);
}

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.hidden {
    display: none !important;
}

.deck-grid{
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.deck-widget {
    position: relative;
    background: linear-gradient(135deg,var(--bg-card), var(--bg-main));
    border-radius: 18px;
    padding: 22px 20px;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
    border: 1px solid var(--border-soft);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.deck-widget:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 25px rgba(246,166,178,0.25);
}

.delete-deck {
    border: 2px solid #ff8a8a;
    background: transparent;
    color: #ff8a8a;
    font-size: 14px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.delete-deck:hover {
  background: #ff8a8a;
  color: white;
}

#deckEmptyMessage {
    margin-top: 20px;
    color: #888;
    font-style: italic;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 30px;
    margin-top: 20px;
}

.card-container{
    display: flex;
    flex-direction: column;
    align-items: center;
}
.card-widget {
    width: 200px;
    height: 200px;
    background: var(--bg-card);
    padding: 15px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    text-align: center;
    font-size: 18px;
    font-weight: 500;
    justify-content: center;
    word-break: break-word;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

body.dark-mode .card-widget {
    color: #eee;
}

.card-widget:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

.deck-btns {
  display: flex;
  justify-content: center;
  gap: 11px;
  margin-top: 9px;
}

.deck-name{
  font-weight: 560;
  margin-bottom: 4px;
  font-size: 1.15rem;
  color: var(--text-main);
  margin-bottom: 13px;
}

.study-deck {
  background: var(--accent-green);
  color: #2b3d33;
  box-shadow: 0 4px 11px rgba(0,0,0,0.1);
}

.study-deck:hover {
  background: #a9cbbf;
}

.card-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    gap: 10px;
}
.card-actions button {
    font-size: 12px;
    padding: 4px 8px;
}

.card-controls{
    justify-content: center;
    align-items: center;
    display: flex;
    gap: 20px;
}

.divider {
  flex: none;
  width: 0;
  height: 2px;
  margin: 16px auto 28px;
  animation: drawDivider 0.5s ease-out forwards;
  opacity: 0.5;
  background-color: var(--accent-pink);
}
@keyframes drawDivider {
  to {
    width: 60%;
  }
}

.timer{
  text-align: center;
  margin-top: 80px;
}

.time-input{
  display: flex;
  justify-content: center;
  padding: 10px;
  gap: 10px;
  font-size: 1.5rem;
  text-align: center;
  margin: 20px 0;
  align-items: center;
}
.time-input input{
  width: 70px;
  padding: 10px;
  text-align: center;
  font-size: 1.5rem;
}
.display{
  font-size: 3rem;
  margin: 30px 0;
  letter-spacing: 3px;
  font-weight: bold;
  color: var(--text-main);
  transition: color 0.25s ease;
}

.time-buttons{
  display: flex;
  justify-content: center;
  gap: 20px;
}

#timeCircle{
display: none;
}

.time-area{
  align-items: center;
  gap: 9px;
  background: var(--accent-green);
  padding: 8px 12px;
  border-radius: 7px;
  display: flex;
}

.time-area span{
  font-weight: bold;
  font-size: 1.5rem;
  width: 41px;
  text-align: center;
}
.progress{
  position: relative;
  width: 220px;
  margin: 30px auto;
}

.timeArrow {
  background: none;
  padding: 6px;
  cursor: pointer;
  font-size: 1.5rem;
  border: none;
  box-shadow: none;
}
.progress svg{
  display: block;
}
#progressCirc{
  stroke: var(--progress-circle-color);
  stroke-dasharray: 628;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1s linear;
}
.progress .display{
  position: absolute;
  top: 38%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.8rem;
  font-weight: bold;
  letter-spacing: 3px;
}

.timeArrow:hover {
  transform: translateY(-2px);
  background: #5c9b8c;
}

#exitStudyModeBtn{
  display: none;
}

.pomodoro {
  text-align: center;
  margin-top: 30px;
  border-radius: 18px;
  background: linear-gradient(135deg,var(--bg-card),var(--bg-main));
  padding: 40px 30px;
  max-width: 440px;
  margin-left: auto;
  margin-right: auto;
  border: 1px solid var(--border-soft);
  box-shadow: 0 10px 25px rgba(0,0,0,0.06);
}

#pomodoroTimer {
  font-size: 4rem;
  font-weight: bold;
  letter-spacing: 4px;
  margin: 25px 0;
  color: var(--text-main);
}
.pomodoroBtns{
  display: flex;
  justify-content: center;
  gap:12px;
  margin-bottom: 20px;
}
.pomodoroBtns button{
  min-width: 90px;
}
.pomodoroMode{
  display: flex;
  justify-content: center;
  gap:13px;
}
.pomodoroMode button{
  box-shadow: 0 4px 10px rgba(213, 198, 245, 0.4);
  background: var(--accent-purple);
}
.pomodoroMode button:hover{
  background: #bfaef0;
}
.pomodoroMode button:active{
  color: #2b3d33;
  background: var(--accent-green);
  box-shadow: 0 5px 13px rgba(0,0,0,0.15);
}
@keyframes pulsePomodoro{
  0%{transform:scale(1)}
  50%{transform: scale(1.06)}
  100%{transform: scale(1)}
}
.timer-end{
  animation:pulsePomodoro 0.5s ease 3;
}

.queenie{
  position: fixed;
  bottom: 40px;
  right: 60px;
  display: flex;
  align-items: flex-end;
  flex-direction: row;
  gap: 12px;
  z-index: 1000;
}
#queenie_sprite{
  width: 300px;
  flex-shrink: 0;
}
.textbox{
  position: relative;
  transform: translateY(-70px);
  background: var(--border-soft);
  border: 2px solid #a4877d;
  border-radius: 10px;
  max-width: 260px;
  padding: 12px 16px 22px 16px;
  font-size: 0.9rem;
  opacity: 0;
  transform: translateY(10px);
  animation: popIn 0.4s forwards;
  cursor: pointer;
}

.textbox::after{
  content: "▼";
  position: absolute;
  bottom: 6px;
  right: 10px;
  font-size: 0.7rem;
  opacity: 0.7;
  color: var(--accent-pink);
  animation: arrowBounce 0.6s infinite;
}

.textbox.no-arrow::after{
  display:none;
}
@keyframes arrowBounce {
  0%, 100%{transform: translateY(0);}
  50%{transform: translateY(3px);}
}
.dark-mode .textbox{
  border-color: #6a5463;
}

@keyframes popIn {
  from{
    opacity:0;
    transform: translateY(10px);
  }
  to{
    opacity:1;
    transform: translateY(0);
  }
}

.timer-done {
  color: #b85e5e;
  animation: flash 1s infinite;
}
@keyframes flash{
  0%{opacity:1;}
  50%{opacity:0.4;}
  100%{opacity:1;}
}


.editor-preview{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 20px;
}

#inputHtml{
  width:100%;
  height: 400px;
  padding: 12px;
  font-family: monospace;
  resize: vertical;
}
#previewFrame{
  width: 100%;
  height: 400px;
  border: 1px solid var(--accent-green);
  background: white;
}

#previewTextBtn{
  margin-top: 21px;
}

#qrInput{
  padding: 11px 20px;
  font-size:16px;
  width: 300px;
  margin-top: 20px;
}

.qrCode-container{
  display: flex;
  gap: 50px;
  margin-top: 20px;
  align-items: flex-start;
}

.qrCode-info{
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.qrCode-display{
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 300px;
  justify-content: center;
  border: 2px dashed var(--accent-green);
  border-radius: 11px;
  background-color: var(--bg-card);
  padding: 19px;
}

.qrCode-widget-label{
  color: var(--text-main);
  font-style: italic;
  text-align: center;
  margin-bottom: 15px;
}

#qrCode{
  margin-top: 28px;
  max-width: 100%;
  max-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

#downloadQrBtn{
  cursor: pointer;
  padding: 10px 20px;
}

.qrCode-right{
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.qrCode-info input[type="color"]{
  width: 60x;
  height: 35px;
  cursor: pointer;
  border: none;
  margin-bottom: 10px;
}

.qrCode-info label{
  color: var(--text-main);
}

.banner-generator{
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.banner-info{
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 300px;
}

.banner-display{
  margin-top: 20px;
  width: 100%;
  height: 250px;
  border-radius: 18px;
  background: var(--accent-green);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  max-width: 800px;
  padding: 21px;
  color: #2b3d33;
  transition: all 0.3s ease;
}

.banner-info input[type="text"]{
  padding: 10px;
  border: 1px solid var(--border-soft);
  border-radius: 9px;
}

.banner-display h1{
  margin-bottom: 10px;
  font-size: 47px;
}

.banner-display p{
  font-size: 19px;
}

.banner-info label{
  color: var(--text-main);
  margin-top: 20px;
}