* { box-sizing: border-box; }

/* id/class kurallari hidden ozniteligini ezmesin */
[hidden] { display: none !important; }

/* --- giris / kayit / davet ekrani --- */
body.locked { overflow: hidden; }
body.locked > header,
body.locked > nav,
body.locked > .toolbar,
body.locked > main { filter: blur(6px); pointer-events: none; user-select: none; }

#gate, #join {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(20, 22, 25, 0.82);
}

#gate-form, #join-form {
  width: min(360px, 100%);
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 30px 26px 26px;
  border-radius: 4px;
  background: #ffe066;
  color: #2b2b2b;
  box-shadow: 6px 10px 28px rgba(0, 0, 0, 0.5);
  transform: rotate(-1.2deg);
}

#gate-form h1, #join-form h1 {
  margin: 0;
  font-size: 26px;
  letter-spacing: 1px;
}

#gate-form p, #join-form p {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  opacity: 0.75;
}

.gate-invite {
  padding: 9px 10px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.12);
  opacity: 1 !important;
  font-weight: 600;
}

.gate-tabs {
  display: flex;
  gap: 6px;
  padding: 4px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.12);
}

.gate-tabs button {
  flex: 1;
  padding: 8px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: #2b2b2b;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  opacity: 0.6;
}

.gate-tabs button.active { background: rgba(255, 255, 255, 0.75); opacity: 1; }

#gate-form input, #join-form input {
  padding: 11px 12px;
  border: none;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.72);
  color: #2b2b2b;
  font-size: 14px;
}

#gate-form > button, #join-form > button {
  padding: 11px 16px;
  border: none;
  border-radius: 4px;
  background: #2b2b2b;
  color: #ffe066;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

#gate-form > button:hover, #join-form > button:hover { background: #3d3d3d; }
#gate-form > button:disabled { opacity: 0.6; cursor: default; }

#join-form > button.ghost {
  background: transparent;
  color: #2b2b2b;
  font-weight: 600;
  opacity: 0.7;
}

.gate-error {
  margin: 0;
  padding: 8px 10px;
  border-radius: 4px;
  background: #d92b2b;
  color: #fff;
  font-size: 13px;
  opacity: 1 !important;
}

/* --- ayarlar --- */
#settings {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 20px;
  overflow: auto;
  background: rgba(15, 17, 19, 0.7);
}

#settings-box {
  width: min(520px, 100%);
  background: #33373d;
  border: 1px solid #474d55;
  border-radius: 10px;
  padding: 22px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
}

.settings-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.settings-head h2 { margin: 0; font-size: 19px; }

.settings-head button {
  border: none;
  background: transparent;
  color: #b9bec6;
  font-size: 18px;
  cursor: pointer;
}

#settings section {
  padding: 16px 0;
  border-top: 1px solid #43484f;
}

#settings h3 {
  margin: 0 0 10px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: #ffd84d;
}

#settings label {
  display: block;
  margin-bottom: 10px;
  font-size: 13px;
  color: #b9bec6;
}

#settings .opt { opacity: 0.6; font-size: 12px; }

#settings input {
  display: block;
  width: 100%;
  margin-top: 5px;
  padding: 9px 11px;
  border: none;
  border-radius: 5px;
  background: #3c4046;
  color: #eee;
  font-size: 14px;
}

#settings input:disabled { opacity: 0.5; }

#settings button {
  padding: 9px 14px;
  border: 1px solid #50565e;
  border-radius: 6px;
  background: #3c4046;
  color: #e6e9ed;
  font-size: 13px;
  cursor: pointer;
}

#settings button:hover:not(:disabled) { background: #464b52; }
#settings button:disabled { opacity: 0.45; cursor: default; }
#settings button.danger { border-color: #a33; color: #ff8080; background: transparent; }
#settings button.danger:hover:not(:disabled) { background: #4a2020; }

#settings .row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

#settings .note {
  margin: 14px 0 6px;
  font-size: 12px;
  color: #8c939c;
}

#settings code {
  display: block;
  padding: 9px 10px;
  border-radius: 5px;
  background: #26292d;
  color: #ffd84d;
  font-size: 12px;
  overflow-wrap: anywhere;
}

#member-list {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 13px;
  color: #d4d8dd;
}

#member-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid #3c4046;
}

#member-list button { padding: 4px 9px; font-size: 12px; }

#set-msg {
  margin: 10px 0 0;
  padding: 8px 10px;
  border-radius: 4px;
  font-size: 13px;
}

#set-msg.ok { background: #1f4d2e; color: #b6f0c6; }
#set-msg.err { background: #4a2020; color: #ff9d9d; }

.settings-foot {
  display: flex;
  justify-content: flex-end;
  padding-top: 16px;
  border-top: 1px solid #43484f;
}

body {
  margin: 0;
  padding: 24px;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: #2f3237;
  color: #eee;
}

header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

h1 {
  margin: 0;
  font-size: 26px;
  letter-spacing: 1px;
}

#board-select {
  padding: 9px 12px;
  border: 1px solid #43484f;
  border-radius: 6px;
  background: #33373d;
  color: #ffd84d;
  font-size: 14px;
  font-weight: 600;
  max-width: 220px;
}

#board-new, #settings-btn {
  padding: 8px 12px;
  border: 1px solid #43484f;
  border-radius: 6px;
  background: #33373d;
  color: #c8cdd4;
  font-size: 15px;
  cursor: pointer;
}

#board-new:hover, #settings-btn:hover { background: #3c4046; }

#new-task {
  display: flex;
  gap: 8px;
  flex: 1;
  min-width: 320px;
}

#new-task input,
#new-task select,
.toolbar select {
  padding: 10px 12px;
  border: none;
  border-radius: 6px;
  background: #3c4046;
  color: #eee;
  font-size: 14px;
}

#title { width: 150px; }
#description { flex: 1; min-width: 120px; }
#category { width: 120px; }

/* kategori sekmeleri */
#tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border: 1px solid #43484f;
  border-radius: 20px;
  background: #33373d;
  color: #c8cdd4;
  font-size: 13px;
  cursor: pointer;
}

.tab:hover { background: #3c4046; }

.tab.active {
  background: #ffd84d;
  border-color: #ffd84d;
  color: #2f3237;
  font-weight: 700;
}

.tab-count {
  background: rgba(0, 0, 0, 0.22);
  border-radius: 20px;
  padding: 1px 8px;
  font-size: 11px;
  font-weight: 600;
}

.tab.active .tab-count { background: rgba(0, 0, 0, 0.18); }

.tab-del {
  margin-left: -2px;
  padding: 0 2px;
  font-size: 12px;
  line-height: 1;
  opacity: 0;
  border-radius: 3px;
  transition: opacity 0.15s ease, background 0.15s ease;
}

.tab:hover .tab-del { opacity: 0.55; }
.tab .tab-del:hover { opacity: 1; background: rgba(0, 0, 0, 0.25); }

/* onay penceresi */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
}

.modal {
  width: min(440px, calc(100vw - 40px));
  background: #33373d;
  border: 1px solid #474d55;
  border-radius: 10px;
  padding: 22px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
}

.modal h3 { margin: 0 0 8px; font-size: 17px; }

.modal p {
  margin: 0 0 18px;
  font-size: 14px;
  color: #b9bec6;
  line-height: 1.45;
}

.modal-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.modal button {
  padding: 9px 14px;
  border: 1px solid #50565e;
  border-radius: 6px;
  background: #3c4046;
  color: #e6e9ed;
  font-size: 13px;
  cursor: pointer;
}

.modal button:hover { background: #464b52; }

.modal button.primary {
  background: #ffd84d;
  border-color: #ffd84d;
  color: #2f3237;
  font-weight: 700;
}

.modal button.primary:hover { background: #ffe57a; }

.modal button.danger {
  background: transparent;
  border-color: #a33;
  color: #ff8080;
}

.modal button.danger:hover { background: #4a2020; }

.modal-warn {
  display: block;
  margin-top: 12px;
  font-size: 12px;
  color: #767c85;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  font-size: 13px;
  color: #b9bec6;
}

.toolbar select { padding: 7px 10px; font-size: 13px; }

.hint { color: #767c85; font-style: italic; }

#new-task button {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  background: #ffd84d;
  color: #2f3237;
  font-weight: 700;
  cursor: pointer;
}

#new-task button:hover { background: #ffe57a; }

main {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

@media (max-width: 800px) {
  main { grid-template-columns: 1fr; }
}

.board {
  background: #26292d;
  border: 2px dashed transparent;
  border-radius: 10px;
  padding: 16px;
  min-height: 320px;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.board.dragover { background: #2e3339; border-color: #6b7280; }

.board h2 {
  margin: 0 0 16px;
  font-size: 16px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: #b9bec6;
}

.count {
  display: inline-block;
  background: #3c4046;
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 12px;
  margin-left: 6px;
}

.notes { display: flex; flex-wrap: wrap; gap: 16px; }

.note {
  --rot: 0deg;
  position: relative;
  width: 190px;
  min-height: 200px;
  padding: 16px 40px 34px 14px;
  touch-action: none;
  color: #2b2b2b;
  box-shadow: 3px 4px 10px rgba(0, 0, 0, 0.35);
  transform: rotate(var(--rot));
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
  overflow-wrap: anywhere;
  cursor: grab;
  user-select: none;
}

.note:hover { transform: rotate(0deg) scale(1.03); }

.note.dragging {
  position: fixed;
  z-index: 100;
  margin: 0;
  cursor: grabbing;
  pointer-events: none;
  transform: rotate(4deg) scale(1.05);
  box-shadow: 10px 20px 30px rgba(0, 0, 0, 0.5);
  transition: none;
}

.note.dragging:hover { transform: rotate(4deg) scale(1.05); }

body.is-dragging { cursor: grabbing; }
body.is-dragging .note:hover { transform: rotate(var(--rot)); }

/* notun birakilacagi bosluk */
.placeholder {
  border: 2px dashed #5b636d;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.03);
  flex: 0 0 auto;
}

/* kagit yukaridan dusup masaya konuyor */
.note.falling {
  animation: fall 0.55s cubic-bezier(0.25, 0.7, 0.35, 1.05) both;
}

@keyframes fall {
  0% {
    transform: translateY(-170px) rotate(calc(var(--rot) - 14deg)) scale(1.08);
    box-shadow: 10px 22px 30px rgba(0, 0, 0, 0.45);
    opacity: 0;
  }
  35% { opacity: 1; }
  62% {
    transform: translateY(7px) rotate(calc(var(--rot) + 3.5deg)) scale(0.995);
    box-shadow: 2px 3px 7px rgba(0, 0, 0, 0.4);
  }
  82% { transform: translateY(-4px) rotate(calc(var(--rot) - 1.5deg)) scale(1); }
  100% {
    transform: translateY(0) rotate(var(--rot)) scale(1);
    box-shadow: 3px 4px 10px rgba(0, 0, 0, 0.35);
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .note.falling { animation: none; }
}

.note.todo { background: #ffe066; }
.note.done { background: #ff6b6b; }

.note.done h3,
.note.done p { text-decoration: line-through; opacity: 0.85; }

.note h3 { margin: 0 0 8px; font-size: 16px; }

.note p {
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
  white-space: pre-wrap;
}

/* igne: yarida kalan / devam eden isler */
.note.pinned {
  box-shadow: 3px 4px 10px rgba(0, 0, 0, 0.35), 0 0 0 2px rgba(214, 40, 40, 0.55);
  padding-top: 24px;
}

.pin-stub {
  position: absolute;
  top: -9px;
  left: 50%;
  transform: translateX(-50%) rotate(-8deg);
  font-size: 20px;
  line-height: 1;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.45));
  pointer-events: none;
}

.note button.pin-btn { filter: grayscale(1); opacity: 0.75; }
.note button.pin-btn.on { filter: none; opacity: 1; background: rgba(0, 0, 0, 0.32); }

/* AI kurallari */
.rules {
  margin-top: 10px;
  padding: 7px 8px;
  border-left: 3px solid rgba(0, 0, 0, 0.35);
  background: rgba(0, 0, 0, 0.07);
  border-radius: 0 4px 4px 0;
}

.rules.hidden { display: none; }

.rules-head {
  display: block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.6px;
  opacity: 0.6;
  margin-bottom: 3px;
}

.rules p { margin: 0; font-size: 11.5px; line-height: 1.35; }

/* yerinde duzenleme */
.editable { cursor: text; border-radius: 3px; }
.badge.editable { cursor: pointer; }
.editable:hover { background: rgba(0, 0, 0, 0.09); box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.09); }
.badge.editable:hover { box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.25); }
.note p.faint { opacity: 0.45; font-style: italic; }

.inline-edit {
  width: 100%;
  border: none;
  border-radius: 3px;
  padding: 3px 5px;
  font: inherit;
  color: #2b2b2b;
  background: rgba(255, 255, 255, 0.72);
  resize: vertical;
}

textarea.inline-edit { min-height: 56px; }

.badge .inline-edit { width: 92px; font-size: 10px; text-transform: none; }

.rules-edit {
  width: 100%;
  min-height: 60px;
  border: none;
  border-radius: 3px;
  padding: 5px 6px;
  font: inherit;
  font-size: 11.5px;
  background: rgba(255, 255, 255, 0.6);
  color: #2b2b2b;
  resize: vertical;
}

.note button.has-rules { background: rgba(0, 0, 0, 0.32); color: #fff; }

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

.badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.4px;
  padding: 2px 7px;
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.13);
  text-transform: uppercase;
}

.badge.cat { background: rgba(0, 0, 0, 0.22); }
.badge.prio.p3 { background: #d92b2b; color: #fff; }
.badge.prio.p2 { background: #e08800; color: #fff; }
.badge.prio.p1 { background: rgba(0, 0, 0, 0.18); }

.badge.diff { display: inline-flex; gap: 3px; padding: 5px 7px; }

.badge.diff i {
  width: 5px;
  height: 9px;
  border-radius: 1px;
  background: rgba(0, 0, 0, 0.18);
}

.badge.diff i.on { background: rgba(0, 0, 0, 0.62); }

.note .date {
  position: absolute;
  left: 14px;
  bottom: 12px;
  font-size: 11px;
  opacity: 0.65;
}

.note .actions {
  position: absolute;
  right: 8px;
  top: 8px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.note:hover .actions { opacity: 1; }

.note button {
  border: none;
  background: rgba(0, 0, 0, 0.12);
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  padding: 3px 7px;
  color: #2b2b2b;
}

.note button:hover { background: rgba(0, 0, 0, 0.25); }

.empty { color: #6d737b; font-size: 14px; font-style: italic; }
