/* assets/styles.css */

@supports (-moz-appearance: none) {

  /* Firefox'ta kartı ASLA rotate etme (mirror bug / ters yazı buradan geliyor) */
  #card,
  #card.flipped {
    transform: none !important;
  }

  #card { transform-style: flat !important; }

  .face { transform: none !important; backface-visibility: hidden; }

  .face.back { opacity: 0; pointer-events: none; }

  #card.flipped .face.front { opacity: 0; pointer-events: none; }
  #card.flipped .face.back  { opacity: 1; pointer-events: auto; }

  #card-container { perspective: none !important; }
}

:root{
  --bg0:#0b0f14;
  --txt:#e6edf3;
  --muted: rgba(230,237,243,0.55);
  --border: rgba(255,255,255,0.10);
  --panel: rgba(255,255,255,0.06);
  --panel2: rgba(255,255,255,0.04);
  --accent: rgba(140, 255, 195, 0.75);
  --accentTxt:#0b0f14;
}

*{ box-sizing: border-box; }

body{
  margin:0;
  color: var(--txt);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
               Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  background:
    radial-gradient(1200px 700px at 50% 10%, rgba(120, 160, 255, 0.12), transparent 60%),
    radial-gradient(900px 600px at 20% 80%, rgba(120, 255, 190, 0.08), transparent 55%),
    var(--bg0);
}

a{ color: #9fb7ff; text-decoration: none; }
a:hover{ text-decoration: underline; }

.btn{
  background: var(--panel);
  color: var(--txt);
  border: 1px solid var(--border);
  padding: 10px 16px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 1rem;
  user-select: none;
  backdrop-filter: blur(6px);
}
.btn:hover{ background: rgba(255,255,255,0.09); }
.btn:active{ transform: scale(0.98); }

.btn-primary{
  background: var(--accent);
  color: var(--accentTxt);
  font-weight: 800;
  border: none;
}
.btn-danger{
  background: rgba(255, 120, 120, 0.9);
  color: #200;
  border: none;
}
.btn-soft{
  background: rgba(159, 183, 255, 0.85);
  color: #0b0f14;
  font-weight: 800;
  border: none;
}

/* ============ HAMBURGER + DRAWER ============ */
.hamburger{
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 50;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.32);
  backdrop-filter: blur(8px);
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
}
.hamburger:active{ transform: scale(0.98); }

.hamburger span{
  width: 18px;
  height: 2px;
  background: rgba(230,237,243,0.9);
  display:block;
  position: relative;
}
.hamburger span::before,
.hamburger span::after{
  content:"";
  position:absolute;
  left:0;
  width:18px;
  height:2px;
  background: rgba(230,237,243,0.9);
}
.hamburger span::before{ top:-6px; }
.hamburger span::after{ top: 6px; }

.drawer-overlay{
  position: fixed;
  inset:0;
  background: rgba(0,0,0,0.45);
  z-index: 60;
  display:none;
}
.drawer{
  position: fixed;
  top:0;
  left:0;
  height:100%;
  width: 310px;
  max-width: 85vw;
  background: rgba(15, 18, 24, 0.92);
  border-right: 1px solid rgba(255,255,255,0.10);
  backdrop-filter: blur(10px);
  transform: translateX(-105%);
  transition: transform 220ms ease;
  z-index: 70;
  padding: 18px;
  display:flex;
  flex-direction: column;
  gap: 10px;
}
.drawer.open{ transform: translateX(0); }
.drawer-overlay.open{ display:block; }

.drawer-title{
  font-weight: 900;
  letter-spacing: 0.08em;
  color: rgba(230,237,243,0.85);
  font-size: 0.95rem;
  text-transform: uppercase;
  margin: 6px 0 10px;
}

.drawer a, .drawer button{
  width: 100%;
  text-align: left;
}
.drawer .navbtn{
  padding: 12px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.05);
  color: var(--txt);
  cursor: pointer;
  font-size: 1rem;
}
.drawer .navbtn:hover{ background: rgba(255,255,255,0.08); }

.drawer .muted{
  margin-top:auto;
  color: rgba(230,237,243,0.45);
  font-size: 0.92rem;
  line-height: 1.4;
}

/* ============ TOOLS PAGE UI ============ */
.tools-wrap{
  width: min(980px, 92vw);
  margin: 80px auto 40px;
}

.tools-header{
  display:flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 16px;
  background: rgba(255,255,255,0.04);
  backdrop-filter: blur(8px);
}

.tools-header h2{
  margin:0;
  font-size: 1.25rem;
}
.tools-header p{
  margin:0;
  color: rgba(230,237,243,0.60);
  line-height: 1.5;
}

.tabs{
  display:flex;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.tab{
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.22);
  color: rgba(230,237,243,0.85);
  cursor:pointer;
}
.tab.active{
  background: rgba(159, 183, 255, 0.25);
  border-color: rgba(159, 183, 255, 0.55);
}

.panel{
  margin-top: 16px;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 16px;
  background: rgba(255,255,255,0.04);
  backdrop-filter: blur(8px);
  padding: 16px;
}

textarea.input{
  width: 100%;
  min-height: 84px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  padding: 12px;
  color: rgba(230,237,243,0.9);
  font-size: 1rem;
  outline: none;
  resize: vertical;
}
textarea.input:focus{
  border-color: rgba(159, 183, 255, 0.6);
}

.row{
  display:flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items:center;
  margin-top: 12px;
}

.action-row{
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0;
  margin-bottom: 12px;
}

.action-btn{
  min-height: 64px;
  font-size: 1.1rem;
  border-radius: 14px;
}

.action-spacer{
  width: 100%;
}

.notice{
  margin-top: 12px;
  color: rgba(230,237,243,0.55);
  line-height: 1.45;
  font-size: 0.98rem;
}

.toast{
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 90;
  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  padding: 10px 12px;
  color: rgba(230,237,243,0.9);
  backdrop-filter: blur(10px);
  display:none;
}

/* word chips */
.word-zone{
  margin-top: 12px;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 16px;
  background: rgba(0,0,0,0.20);
  padding: 14px;
  line-height: 2.4;
  font-size: 1.08rem;
}

.word-chip{
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.10);
  color: rgba(230,237,243,0.88);
  display: inline-block;
  margin: 2px 0;
  transition: all 0.1s ease;
  user-select: text;
}
.word-chip:hover{
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.20);
}
.word-chip.preview{
  background: rgba(159, 183, 255, 0.18);
  border-color: rgba(159, 183, 255, 0.50);
}
.word-chip.locked{
  background: rgba(46, 125, 50, 0.20);
  border-color: rgba(129, 199, 132, 0.70);
  color: rgba(180, 255, 200, 0.95);
  font-weight: 800;
}

.range-list{
  margin-top: 10px;
  display:flex;
  flex-wrap: wrap;
  gap: 8px;
}
.range-pill{
  display:flex;
  gap:8px;
  align-items:center;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.22);
  color: rgba(230,237,243,0.85);
  font-size: 0.95rem;
}
.range-pill button{
  border: none;
  background: transparent;
  color: rgba(230,237,243,0.7);
  cursor:pointer;
  font-size: 1.05rem;
}
.range-pill button:hover{ color: rgba(255,140,140,0.9); }

/* ============ CARD LIST OVERLAY ============ */
.list-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 95;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.list-overlay.open {
  display: flex;
}

.list-panel {
  width: min(760px, 94vw);
  max-height: 82vh;
  background: rgba(15, 18, 24, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  backdrop-filter: blur(12px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.10);
}

.list-title {
  font-weight: 900;
  letter-spacing: 0.06em;
  color: rgba(230, 237, 243, 0.9);
  text-transform: uppercase;
  font-size: 0.92rem;
}

.list-body {
  padding: 10px;
  overflow: auto;
}

.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  margin-bottom: 10px;
}

.list-item:hover {
  background: rgba(255, 255, 255, 0.07);
}

.list-item.active {
  border-color: rgba(159, 183, 255, 0.55);
  background: rgba(159, 183, 255, 0.10);
}

.li-num {
  width: 54px;
  flex: 0 0 54px;
  text-align: right;
  color: rgba(230, 237, 243, 0.60);
  font-variant-numeric: tabular-nums;
}

.li-phrase {
  flex: 1;
  color: rgba(230, 237, 243, 0.92);
  font-weight: 750;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Üst butonlar tek satır + emoji */
.top-controls {
  flex-wrap: nowrap !important;
}

.top-emoji {
  min-width: 58px;
  padding: 10px 12px;
  white-space: nowrap;
  font-size: 1.15rem;
}

/* Hamburger'i sağ alta al */
.hamburger {
  top: auto !important;
  left: auto !important;
  right: 14px;
  bottom: 14px;
  z-index: 80;
}

/* Drawer içeriği alttan başlasın (parmak reach) */
.drawer {
  justify-content: flex-end;
  padding-bottom: 26px;
}

.drawer .muted {
  margin-top: 10px;
  /* auto değil */
}

/* ================= FLASHCARDS UI (son düzen) ================= */

/* Üst butonlar: uçlar kartla hizalı, ortadaki uzasın */
.top-controls {
  flex-wrap: nowrap !important;
  justify-content: space-between !important;
}

.top-controls .top-emoji {
  flex: 0 0 58px;
}

#btnList.top-grow {
  flex: 1 1 auto;
}

/* Alt bar: sol log, orta nav+sayaç, sağ hamburger. Kenarlar kartla hizalı */
.bottom-bar {
  width: 90%;
  max-width: 650px;
  display: grid;
  grid-template-columns: 58px 1fr 44px;
  gap: 12px;
  align-items: center;
  margin-top: 12px;
  padding-bottom: 10px;
}

.bottom-emoji {
  width: 58px;
  padding: 10px 0;
  font-size: 1.15rem;
}

.nav-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.nav-row {
  display: flex;
  gap: 12px;
}

#counter {
  margin: 0;
  font-size: 0.9rem;
  color: rgba(230, 237, 243, 0.45);
}

/* Hamburger artık bar içinde: fixed olmasın */
.bottom-bar .hamburger {
  position: static !important;
  top: auto !important;
  left: auto !important;
  right: auto !important;
  bottom: auto !important;
  z-index: 80;
}

/* Log overlay: düz siyah ekran */
.log-overlay {
  position: fixed;
  inset: 0;
  background: #000;
  color: #e6edf3;
  z-index: 200;
  display: none;
  padding: 14px;
  overflow: auto;
}

.log-overlay.open {
  display: block;
}

.log-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.log-title {
  font-weight: 900;
  letter-spacing: 0.06em;
}

.log-body {
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.9rem;
  line-height: 1.45;
}

/* ======= READ (TTS) BUTTONS ======= */
.read-seg {
  position: relative;
}

.read-btn-wrap {
  display: flex;
  justify-content: flex-end;

  /* segment ekranda dururken sağ altta görünür kalsın */
  position: sticky;
  bottom: 10px;

  margin-top: 10px;
  pointer-events: none;
  /* sadece buton tıklansın */
}

.read-btn {
  pointer-events: auto;

  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.22);
  color: rgba(230, 237, 243, 0.9);
  padding: 8px 12px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 800;
  font-size: 0.95rem;
  user-select: none;
  backdrop-filter: blur(8px);
}

.read-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
}

.read-btn:active {
  transform: scale(0.98);
}

.read-btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

.read-btn.is-speaking {
  border-color: rgba(255, 140, 140, 0.55);
  background: rgba(255, 140, 140, 0.14);
}
