/* Cycle warning indicator */
#gm-cycle-indicator{position:fixed;top:8px;right:10px;z-index:12000;pointer-events:none;opacity:0;transition:opacity .25s ease, transform .25s ease;transform:translateY(-4px);} 
#gm-cycle-indicator.gm-cycle-visible{opacity:1;transform:translateY(0);} 
#gm-cycle-indicator .gm-cycle-icon{display:inline-flex;align-items:center;justify-content:center;width:22px;height:22px;background:#b91c1c;color:#fff;font-size:14px;font-weight:700;border-radius:50%;box-shadow:0 2px 6px rgba(0,0,0,.45);pointer-events:auto;cursor:help;font-family:inherit;} 
#gm-cycle-indicator .gm-cycle-pop{position:absolute;top:26px;right:0;min-width:240px;max-width:300px;background:#111827;color:#e5e7eb;border:1px solid #374151;border-radius:8px;padding:10px 12px;font-size:12px;line-height:1.25;box-shadow:0 8px 24px rgba(0,0,0,.5);opacity:0;transform:translateY(-4px);pointer-events:none;transition:opacity .18s ease, transform .18s ease;} 
#gm-cycle-indicator:hover .gm-cycle-pop{opacity:1;transform:translateY(0);pointer-events:auto;} 
#gm-cycle-indicator .gm-cycle-pop strong{color:#fca5a5;font-weight:600;} 
.notes-confirm-overlay.hidden { display: none !important; }
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
img, svg, video { display: block; max-width: 100%; height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
ul, ol { margin: 0; padding: 0; }

.hidden { display: none; }
.block { display: block; }
.flex { display: flex; }
.inline-flex { display: inline-flex; }

.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }

.h-full { height: 100%; }
.w-full { width: 100%; }
.min-h-0 { min-height: 0; }
.flex-grow { flex-grow: 1; }
.flex-shrink-0 { flex-shrink: 0; }

.overflow-hidden { overflow: hidden; }
.overflow-y-auto { overflow-y: auto; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.p-5 { padding: 1.25rem; }
.p-8 { padding: 2rem; }
.pt-2 { padding-top: 0.5rem; }
.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }

.space-y-2 > * + * { margin-top: 0.5rem; }
.space-y-3 > * + * { margin-top: 0.75rem; }

.items-center { align-items: center; }
.justify-end { justify-content: flex-end; }
.gap-1 { gap: 0.25rem; }
.gap-1\.5 { gap: 0.375rem; }
.gap-2 { gap: 0.5rem; }

.border { border-width: 1px; border-style: solid; }
.border-t { border-top-width: 1px; border-style: solid; }
.rounded { border-radius: 0.25rem; }
.rounded-md { border-radius: 0.375rem; }
.rounded-lg { border-radius: 0.5rem; }

.bg-black { background-color: rgb(0, 0, 0); }
.text-white { color: #fff; }
.text-muted { color: rgb(156, 163, 175); }
.text-hint { color: rgb(107, 114, 128); }
.text-danger { color: rgb(248, 113, 113); }
.text-success { color: rgb(34, 197, 94); }
.text-accent { color: rgb(250, 204, 21); }
.text-plain { color: rgb(229, 231, 235); }
.text-soft { color: rgb(209, 213, 219); }

.text-center { text-align: center; }
.text-xs { font-size: 0.75rem; line-height: 1rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-base { font-size: 1rem; line-height: 1.5rem; }
.text-lg { font-size: 1.125rem; line-height: 1.75rem; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.italic { font-style: italic; }
.leading-relaxed { line-height: 1.625; }

.list-disc { list-style-type: disc; }
.list-decimal { list-style-type: decimal; }
.list-inside { list-style-position: inside; }

.list-decimal.list-inside { padding-left: 0; }

.cursor-pointer { cursor: pointer; }
.cursor-not-allowed { cursor: not-allowed; }
.select-none { user-select: none; }

.shadow-md { box-shadow: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -2px rgba(0,0,0,.1); }
.shadow-lg { box-shadow: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1); }
.shadow-2xl { box-shadow: 0 25px 50px -12px rgba(0,0,0,.25); }

.ring-2 { box-shadow: 0 0 0 2px var(--ring-color, rgba(59,130,246,.5)); }
.ring-yellow-400 { --ring-color: rgb(250, 204, 21); }
.ring-green-400 { --ring-color: rgb(74, 222, 128); }

.transition { transition: all .15s cubic-bezier(.4,0,.2,1); }

.opacity-60 { opacity: 0.6; }

.hover\:bg-blue-700:hover { background-color: rgb(29, 78, 216); }
.hover\:bg-gray-600:hover { background-color: rgb(75, 85, 99); }
.hover\:bg-green-500:hover { background-color: rgb(34, 197, 94); }
.hover\:bg-red-700:hover { background-color: rgb(185, 28, 28); }
.hover\:bg-yellow-400:hover { background-color: rgb(250, 204, 21); }

/* Reset modal enhanced layout */
.reset-modal__dialog { padding: 1.75rem 2rem 2rem; }
.reset-options { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width:640px){ .reset-options { grid-template-columns: 1fr 1fr; } }
.reset-card { background: rgba(31,41,55,0.85); border:1px solid #374151; border-radius:.75rem; padding:1rem .95rem 1rem; display:flex; flex-direction:column; gap:.55rem; position:relative; box-shadow:0 4px 10px -2px rgba(0,0,0,.4); }
.reset-card__title { font-weight:600; color:#facc15; font-size:1rem; letter-spacing:.5px; }
.reset-card__desc { font-size:.75rem; line-height:1.25; color:#d1d5db; flex-grow:1; }
.reset-card__btn { align-self:flex-start; margin-top:.25rem; }
.reset-card:hover { border-color:#4b5563; background:rgba(31,41,55,0.92); }
.reset-footer { 
  display:flex; 
  justify-content:space-between; 
  align-items:center; 
  gap:1.25rem; 
  margin-top:1.5rem; 
  padding-top:.85rem; 
  border-top:1px solid #374151; 
}
.reset-footer .btn { 
  margin-right:auto; 
  padding-left:1.1rem; 
  padding-right:1.1rem; 
}

/* Inline header for reset modal */
.reset-modal__dialog .modal__header { 
  display:flex; 
  align-items:center; 
  gap:.85rem; 
  flex-wrap:wrap; /* wrap on tiny screens */
}
.reset-modal__dialog .modal__header h3 { 
  margin:0; 
  line-height:1.1; 
}
.reset-modal__dialog .modal__header p { 
  margin:0; 
  padding-top:2px; 
  line-height:1.2; 
}

/* Small utility adjustments */
.actions--between { display:flex; justify-content:space-between; align-items:center; }

.accent-yellow-400 { accent-color: #facc15; }


@media (min-width: 768px) {
  .md\:text-sm { font-size: 0.875rem; line-height: 1.25rem; }
  
  
  .controls-group--left .btn,
  .controls-group--right .btn {
    padding: 0.65vh 0.2vw;
    font-size: clamp(0.6rem, 0.8vw, 0.7rem);
    min-width: 0;
    min-height: 3.2vh;
  }
  
  .controls {
    gap: 1.5vw;
    margin-bottom: 1.2vh;
  }
  
  .controls-group--left,
  .controls-group--right {
    gap: 0.8vh;
  }
}

@media (min-width: 1024px) {
  .lg\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lg\:overflow-hidden { overflow: hidden; }
  
  .controls-group--left .btn,
  .controls-group--right .btn {
    padding: 0.6vh 0.2vw;
    font-size: clamp(0.6rem, 0.7vw, 0.7rem);
    min-width: 0;
    min-height: 3vh;
  }
  
  .controls {
    gap: 0.8vw;
    margin-bottom: 1vh;
  }
  
  .layout > .panel .controls .btn {
    padding: 0.7vh 1vw;
    font-size: clamp(0.75rem, 1.1vw, 0.875rem);
    min-width: 0;
    min-height: 3.8vh;
  }
  
  .layout > .panel .controls .btn.small {
    padding: .375rem .75rem;
    font-size: .875rem;
    min-width: auto;
    min-height: auto;
  }
  
  .layout > .panel .controls .btn.xsmall {
    padding: .25rem .5rem;
    font-size: .75rem;
    min-width: auto;
    min-height: auto;
  }
}

@media (min-width: 1440px) {

  .controls-group--left .btn,
  .controls-group--right .btn {
    padding: 0.5vh 0.2vw;
    font-size: clamp(0.6rem, 0.6vw, 0.7rem);
    min-width: 0;
    min-height: 2.8vh;
  }
  
  .layout > .panel .controls .btn {
    padding: 0.6vh 0.8vw;
    font-size: clamp(0.8rem, 0.9vw, 0.875rem);
    min-width: 0;
    min-height: 3.2vh;
  }
  

  .layout > .panel .controls .btn.small {
    padding: .375rem .75rem;
    font-size: .875rem;
    min-width: auto;
    min-height: auto;
  }
  
  .layout > .panel .controls .btn.xsmall {
    padding: .25rem .5rem;
    font-size: .75rem;
    min-width: auto;
    min-height: auto;
  }
}


.span-2 { grid-column: span 2 / span 2; }


:root {
  --bg-900: #111827; --bg-800: #1f2937; --bg-700: #374151; --bg-600: #4b5563;
  --text-200: #e5e7eb; --text-300: #d1d5db; --text-400: #9ca3af; --text-500: #6b7280;
  --yellow-400: #facc15; --yellow-500: #eab308; --blue-600: #2563eb; --sky-600: #0284c7;
  --purple-600: #9333ea; --indigo-600: #4f46e5; --red-600: #dc2626; --green-600: #16a34a; --teal-600: #0d9488;

  --footer-h: 64px;

  /* Difficulty border colors (edit these to change difficulty colors) */
  --difficulty-easy-border: #4b8160;       /* grey for easy */
  --difficulty-medium-border: #816a4d;     /* light orange for medium */
  --difficulty-hard-border: #752b2b;       /* red for hard */
  --difficulty-veryhard-border: #410303;   /* dark red for very hard */
  --difficulty-border-width: 2px;          /* adjust border thickness if desired */

  /* Flip animation tunables */
  --flip-duration: 0.36s;       /* total time per tile (out + in) */
  --flip-half: 0.18s;           /* first half (front -> edge) */
  --flip-stagger: 70ms;         /* wave delay between tiles */
}


.page { background: var(--bg-900); color: var(--text-200); min-height: 100vh; padding: 1rem 1rem calc(var(--footer-h, 64px) + 10px); overflow: auto; }
@media (min-width: 768px){ .page { padding: 1rem 1.25rem calc(var(--footer-h, 64px) + 10px); } }
.container { max-width: 80rem; margin: 0 auto; }
.page-header { text-align: center; margin-bottom: 1.5rem; }
.title { font-size: 3rem; line-height: 1; color: var(--yellow-400, #facc15); margin-bottom: .5rem; margin-top: 0rem; }
.subtitle { color: var(--text-400); margin-bottom: 1rem; }

.layout { display: grid; grid-template-columns: 1fr; gap: 2rem; min-height: calc(100vh - var(--footer-h, 64px) - 2rem); }
@media (min-width: 1024px){ .layout { grid-template-columns: 1fr minmax(auto, 50vw); } }
.layout > * { min-width: 0; }
.grid-wrapper { overflow: visible; display: flex; align-items: flex-start; justify-content: center; min-height: 300px; padding-bottom: 10px; }


#planner-grid { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: .5rem; width: 100%; height: auto; perspective: 900px; }
.cell { aspect-ratio: 1 / 1; border-radius: .5rem; display: flex; align-items: center; justify-content: center; text-align: center; user-select: none; }
.cell { transform-origin: center; }
.cell--lg { font-size: 16px; line-height: 1.25; }
.cell--xs { font-size: 10px; line-height: 1.1; }
.task-cell { background: var(--bg-700); font-weight: 600; border: 2px solid transparent; cursor: pointer; }
.task-cell { backface-visibility: hidden; will-change: transform; }
.task-cell:hover { background: var(--bg-600); }
.reward-cell { background: var(--bg-800); border: 2px solid transparent; font-weight: 700; cursor: pointer; }
.blank-cell { background: transparent; }
.clickable { cursor: pointer; }

/* Top-left logo cell (only main grid, not mini-grid) */
#planner-grid > .blank-cell.logo-cell {
  background: url('../640px gm fav.png') center center / contain no-repeat;
}


.dep-strength-select { position: absolute; top: 4px; right: 4px; font-size: 10px; padding: 1px 4px; background: rgba(17,24,39,0.9); color: #e5e7eb; border: 1px solid rgba(156,163,175,0.5); border-radius: 4px; }

.cell { position: relative; }


.panel { background: var(--bg-800); padding: 1.5rem; border: 1px solid var(--bg-700); border-radius: .5rem; box-shadow: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1); min-width: 0; }
.panel--muted { background: rgba(31,41,55,0.6); padding: .75rem; border-radius: .5rem; }
.section-title { font-size: 1.875rem; line-height: 2.25rem; color: var(--yellow-400); border-top: 2px solid rgba(234,179,8,0.3); padding-top: .75rem; margin-top: .75rem; margin-bottom: .75rem; }


.controls {
  display: flex;
  align-items: stretch; /* make groups equal height */
  justify-content: space-around; /* per request */
  gap: 1vw;
  margin-bottom: 1.5vh;
  min-width: 0;
  flex-wrap: nowrap;
}

.controls-group--left {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1vh;
  align-items: stretch;
  justify-items: center; /* center children horizontally */
  border-right: 2px solid rgba(234,179,8,0.3);
  padding-right: 1vw;
  min-width: 0;
  flex: 1 1 0;
}

.controls-group--right {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)); 
  grid-auto-rows: 1fr; /* equal row heights */
  gap: 0.5vh 0.5vw;
  align-items: stretch; /* rows stretch */
  align-content: stretch; /* grid fills container height */
  min-width: 0;
  flex: 1 1 0;
}
@media (max-width: 640px){
  .controls { gap: 1.5vw; flex-wrap: wrap; align-items: center; }

  .controls-group--left,
  .controls-group--right {
    width: 100%;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1vh;
  }

  .controls-group--left {
    border-right: none;
    padding-right: 0;
  }

  .controls-group--left .btn,
  .controls-group--right .btn {
    padding: 1vh 1.5vw;
    font-size: clamp(0.65rem, 1.8vw, 0.8rem);
    min-width: 0;
    min-height: 4.2vh;
  }
}

@media (max-width: 480px) {

  .controls-group--left .btn,
  .controls-group--right .btn {
    padding: 1.3vh 2vw;
    font-size: clamp(0.7rem, 2.2vw, 0.85rem);
    min-width: 0;
    min-height: 4.8vh;
    border-radius: 0.7vh;
    flex: 1;
  }
  
  .controls {
    gap: 2vw;
    margin-bottom: 2vh;
  }
  
  .controls-group--left,
  .controls-group--right {
    gap: 1.5vh;
  }
  
  .layout > .panel .controls .btn {
    padding: 1.5vh 2.5vw;
    font-size: clamp(0.7rem, 2.5vw, 0.9rem);
    min-width: 0;
    min-height: 6vh;
    flex: 1;
  }
  

  .layout > .panel .controls .btn.small {
    padding: .375rem .75rem;
    font-size: .875rem;
    min-width: auto;
    min-height: auto;
  }
  
  .layout > .panel .controls .btn.xsmall {
    padding: .25rem .5rem;
    font-size: .75rem;
    min-width: auto;
    min-height: auto;
  }
}


.btn { 
  display: inline-flex; 
  align-items: center; 
  justify-content: center; 
  font-weight: 700; 
  color: #fff; 
  padding: .5625rem .9rem; 
  font-size: .9rem; 
  border-radius: .5rem; 
  transition: background-color .2s ease; 
  box-shadow: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -2px rgba(0,0,0,.1); 
}

.controls-group--left .btn,
.controls-group--right .btn { 
  white-space: nowrap; /* single line */
  text-overflow: ellipsis; /* truncate */
  overflow: hidden; /* required for ellipsis */
  padding: 0.8vh 0.6vw; 
  font-size: clamp(0.6rem, 0.9vw, 0.8rem); 
  border-radius: 0.6vh; 
  min-height: 3.2vh;
  min-width: 0; /* allow grid/flex item to shrink */
  width: auto;
  max-width: 100%;
  justify-self: stretch; /* fill the grid column */
  text-align: center;
  box-sizing: border-box;
}

/* Make right group buttons fill their grid cell height so the group matches left group's height */
.controls-group--right .btn {
  height: 100%;
  align-self: stretch;
}

/* Center buttons specifically in the left group */
.controls-group--left .btn {
  justify-self: center; /* center horizontally within left group's grid */
}
.btn:disabled { opacity: .6; cursor: not-allowed; }


.btn.small {
  padding: .375rem .75rem;
  font-size: .875rem;
  min-height: auto;
  min-width: auto;
}

.btn.xsmall {
  padding: .25rem .5rem;
  font-size: .75rem;
  min-height: auto;
  min-width: auto;
}

.btn-primary { background: var(--blue-600); }
.btn-primary:hover { background: #1d4ed8; }
.btn-sky { background: var(--sky-600); }
.btn-sky:hover { background: #0369a1; }
.btn-purple { background: var(--purple-600); }
.btn-purple:hover { background: #7e22ce; }
.btn-danger { background: var(--red-600); }
.btn-danger:hover { background: #b91c1c; }
.btn-warning { background: var(--yellow-500); color: #111827; }
.btn-warning:hover { background: #facc15; }
.btn-teal { background: var(--teal-600); }
.btn-teal:hover { background: #0f766e; }
.btn-secondary { background: var(--bg-600); }
.btn-secondary:hover { background: #6b7280; }

.btn-indigo { background: var(--indigo-600); }
.btn-indigo:hover { background: #4338ca; }
.btn-green { background: var(--green-600); }
.btn-green:hover { background: #15803d; }


.text-plain { color: var(--text-200); }
.text-soft { color: var(--text-300); }
.text-hint { color: var(--text-500); }
.text-danger { color: #f87171; }
.text-warn { color: #fb923c; }
.text-info { color: #38bdf8; }
.heading-xl { font-size: 1.5rem; line-height: 2rem; font-weight: 700; }
.section-title--sm { font-size: 1.125rem; line-height: 1.75rem; font-weight: 600; }


.row-between { display: flex; align-items: center; justify-content: space-between; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.actions--end { justify-content: flex-end; }
.modal__header { display: flex; align-items: center; justify-content: space-between; margin-bottom: .75rem; }
.modal__close { color: var(--text-400); font-size: 1.875rem; line-height: 1; background: transparent; border: 0; cursor: pointer; }
.modal__close:hover { color: #fff; }
.modal__padding { padding: 1.5rem; }
.drawer__header { display: flex; align-items: center; justify-content: space-between; margin-bottom: .5rem; }
.panel-body { display: flex; flex-direction: column; min-height: 0; }
.details-panel { flex: 1 1 auto; min-height: 0; overflow-y: auto; }


.box { border: 1px solid var(--bg-700); border-radius: .5rem; padding: .75rem; background: rgba(17,24,39,0.4); }
.info-box { border: 1px solid var(--bg-700); border-radius: .5rem; padding: .75rem; background: rgba(17,24,39,0.5); }
.list--spaced-sm > * + * { margin-top: 0.25rem; }
.sublist { margin-top: .5rem; padding-left: 1rem; font-size: .875rem; max-height: 8rem; overflow-y: auto; border-left: 2px solid var(--bg-700); }
.bordered-row { border-bottom: 1px solid var(--bg-700); padding: .5rem 0; }
.scroll-sm { max-height: 8rem; overflow-y: auto; }
.scroll-md { max-height: 10rem; overflow-y: auto; }
.hint-text { font-size: .875rem; color: var(--text-400); }
.muted-note { color: var(--text-400); font-size: .875rem; }
.suggestion { min-height: 52px; display: flex; align-items: center; justify-content: center; }
.w-label { width: 10rem; }


.divider-top { border-top: 1px solid var(--bg-700); padding-top: 0.5rem; }

/* Import/Export sections */
.impexp-section { padding-top: 0.25rem; }
.impexp-section + .impexp-section { border-top: 1px solid var(--bg-700); padding-top: 1rem; }
.impexp-section h4 { color: var(--yellow-400); border-top: none; margin: 0; }


.settings-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; color: var(--text-200); }
@media (min-width: 768px){ .settings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .settings-grid .span-2 { grid-column: span 2; } }

.text-muted { color: var(--text-400); }
.text-dim { color: var(--text-500); }
.text-accent { color: var(--yellow-400); }
.text-success { color: #16a34a; }
.small { font-size: .875rem; line-height: 1.25rem; }
.xsmall { font-size: .75rem; line-height: 1rem; }
.center { text-align: center; }
.minh-52 { min-height: 52px; }

.list { margin: 0; padding: 0; }
.list--disc { list-style: disc; }
.list--inside { list-style-position: inside; }
.stack > * + * { margin-top: .75rem; }

.form-grid { display: grid; grid-template-columns: 1fr; gap: .75rem; }
@media (min-width: 768px){ .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .form-grid .span-2 { grid-column: span 2; } }

/* Task edit form custom 3-col layout (Name, Reward, Difficulty) */
.form-grid--task-edit { display:grid; grid-template-columns: 1fr; gap: .75rem; }
@media (min-width: 768px){
  .form-grid--task-edit { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .form-grid--task-edit .span-3 { grid-column: span 3; }
}

/* --------------------------------------------------
  Difficulty borders (applied only when heatmap OFF)
  The JS adds classes: difficulty-low|medium|high|very-high
  Edit the CSS variables above to customize colors.
--------------------------------------------------- */
.task-cell:not([data-heat='1']).difficulty-low { border: var(--difficulty-border-width) solid var(--difficulty-easy-border); }
.task-cell:not([data-heat='1']).difficulty-medium { border: var(--difficulty-border-width) solid var(--difficulty-medium-border); }
.task-cell:not([data-heat='1']).difficulty-high { border: var(--difficulty-border-width) solid var(--difficulty-hard-border); }
.task-cell:not([data-heat='1']).difficulty-very-high { border: var(--difficulty-border-width) solid var(--difficulty-veryhard-border); }

/* Mini grid cells inherit same difficulty border rules */
.mini-grid .task-cell:not([data-heat='1']).difficulty-low { border-color: var(--difficulty-easy-border); }
.mini-grid .task-cell:not([data-heat='1']).difficulty-medium { border-color: var(--difficulty-medium-border); }
.mini-grid .task-cell:not([data-heat='1']).difficulty-high { border-color: var(--difficulty-hard-border); }
.mini-grid .task-cell:not([data-heat='1']).difficulty-very-high { border-color: var(--difficulty-veryhard-border); }

/* ---------------- Notes Panel ---------------- */
.notes-dock-tab { position: fixed; right: 0; top: 40%; transform: translateY(-50%); background: var(--bg-700); color: var(--yellow-400); padding: .5rem .4rem .5rem .6rem; border: 1px solid var(--bg-600); border-right: none; border-radius: .5rem 0 0 .5rem; cursor: pointer; display: flex; align-items: center; gap: .35rem; font-weight: 600; z-index: 60; transition: transform .25s ease, background .25s; box-shadow: 0 4px 12px rgba(0,0,0,.4); }
.notes-dock-tab:hover { transform: translateY(-50%); background: var(--bg-600); padding-left: .9rem; padding-right: .55rem; }
.notes-panel { position: fixed; top: 0; right: 0; height: 100%; width: clamp(340px, 32vw, 520px); background: var(--bg-800); border-left: 2px solid var(--bg-700); box-shadow: 0 20px 40px -12px rgba(0,0,0,.5); transform: translateX(100%); transition: transform .35s cubic-bezier(.4,0,.2,1); z-index: 59; display: flex; flex-direction: column; }
.notes-panel.is-open { transform: translateX(0); }
.notes-panel__header { display: flex; align-items: center; justify-content: space-between; padding: .5rem .75rem; border-bottom:1px solid var(--bg-700); gap:.5rem; }
.notes-panel__tabs { display: flex; align-items: flex-end; flex-wrap: wrap; gap: .35rem; padding: .5rem .75rem .25rem; border-bottom: 1px solid var(--bg-700); }
.note-tab { position: relative; background: var(--bg-700); color: var(--text-200); padding: .4rem .65rem; border-radius: .4rem .4rem 0 0; cursor: pointer; font-size: .75rem; font-weight: 600; display: inline-flex; align-items: center; gap: .4rem; border:1px solid var(--bg-600); border-bottom: none; min-width: 52px; max-width: 140px; }
.note-tab[data-active='1'] { background: var(--bg-600); color: var(--yellow-400); box-shadow: 0 4px 10px -2px rgba(0,0,0,.5); }
.note-tab__color { width:12px; height:12px; border-radius: 3px; border:1px solid rgba(255,255,255,.2); cursor: pointer; }
.note-tab button { background: none; border: none; color: var(--text-400); cursor: pointer; font-size: .8rem; padding: 0; line-height: 1; }
.note-tab button:hover { color: #fff; }
.notes-panel__body { flex:1; min-height:0; padding:.75rem; display:flex; flex-direction:column; }
.notes-editor { flex:1; width:100%; resize:none; background: var(--bg-900); border:1px solid var(--bg-700); border-radius:.5rem; color: var(--text-200); font-family: inherit; font-size:.85rem; line-height:1.45; padding:.75rem .85rem; box-shadow: inset 0 0 0 1px rgba(0,0,0,.4); }
.notes-editor:focus { outline:2px solid var(--note-focus-color, var(--yellow-400)); outline-offset:2px; }
.notes-panel__footer { padding:.5rem .75rem; border-top:1px solid var(--bg-700); display:flex; justify-content:space-between; align-items:center; gap:.5rem; }
.notes-resize-handle { position:absolute; top:0; left:-6px; width:10px; height:100%; cursor: ew-resize; z-index:61; display:flex; align-items:center; justify-content:center; }
.notes-resize-handle:before { content:''; width:4px; height:40px; border-radius:2px; background: var(--bg-700); box-shadow:0 0 0 1px var(--bg-600), 0 0 6px rgba(0,0,0,.5); opacity:.7; transition:background .2s, opacity .2s; }
.notes-resize-handle:hover:before { background: var(--yellow-400); opacity:1; }
.notes-btn { background: var(--yellow-500); color:#1f2937; font-weight:700; border:none; padding:.45rem .75rem; border-radius:.4rem; cursor:pointer; font-size:.75rem; box-shadow:0 2px 4px rgba(0,0,0,.4); }
.notes-btn:hover { background: var(--yellow-400); }
.notes-btn.secondary { background: var(--bg-700); color: var(--text-300); }
.notes-btn.secondary:hover { background: var(--bg-600); color: #fff; }
.notes-empty { font-size:.75rem; color: var(--text-400); font-style:italic; }
.note-tab input { background: transparent; border: none; color: inherit; font: inherit; width: 70px; }
.note-tab:hover, .note-tab input:not(:focus), .note-tab__color, .note-tab button { cursor: pointer; }
.note-tab input:focus { outline: none; }
/* Notes delete confirmation */
.notes-confirm-overlay { position: fixed; inset:0; background: rgba(0,0,0,.55); display:flex; align-items:center; justify-content:center; z-index:120; }
.notes-confirm { background: var(--bg-800); border:1px solid var(--bg-700); border-radius:.75rem; padding:1rem 1.1rem 1rem; width: min(320px,90vw); box-shadow:0 12px 32px -6px rgba(0,0,0,.6); }
.notes-confirm h4 { margin:0 0 .5rem; font-size:1rem; color: var(--yellow-400); }
.notes-confirm p { margin:.25rem 0 .75rem; font-size:.75rem; line-height:1.35; color: var(--text-300); }
.notes-confirm .actions { display:flex; gap:.5rem; justify-content:flex-end; }
.notes-confirm .actions button { flex:0 0 auto; }
@media (max-width: 640px){
  .notes-panel { width: 88vw; }
  .notes-dock-tab { top: unset; bottom: 6rem; }
}
.form-group { display: flex; flex-direction: column; gap: .25rem; font-size: .875rem; }
.label { color: var(--text-300); }
.input, .select, .textarea { background: var(--bg-900); border: 1px solid var(--bg-600); color: var(--text-200); border-radius: .375rem; padding: .375rem .625rem; font-size: .875rem; display: block; width: 100%; }
.textarea { resize: vertical; }
.textarea--sm { height: 6rem; }
.textarea--lg { height: 12rem; }
.minw-200 { min-width: 200px; }

#dependency-web-svg { width: 100%; height: 100%; border-radius: .25rem; display: block; }

.pill { display: inline-block; padding: .125rem .5rem; border-radius: .375rem; font-weight: 700; font-size: .75rem; }
.pill--green { background: #166534; color: #86efac; }
.pill--yellow { background: #854d0e; color: #fde047; }
.pill--orange { background: #9a3412; color: #fdba74; }
.pill--red { background: #991b1b; color: #fca5a5; }
.pill--neutral { background: #374151; color: #e5e7eb; }


#prereq-list .panel--muted {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .5rem .75rem;
}

#prereq-list .pill--neutral {
  flex: 0.5;
  min-width: 0;
  max-width: none;
  padding: .25rem .75rem;
  text-align: center;
  word-break: break-word;
}

#prereq-list .select {
  flex-shrink: 0;
  width: 6rem;
  font-size: .75rem;
  padding: .25rem .5rem;
}

#prereq-list .btn {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .875rem;
}

.site-footer { position: fixed; bottom: 0; left: 0; right: 0; width: 100%; border-top: 1px solid rgba(55,65,81,.8); background: var(--bg-900); color: var(--text-200);  }
.site-footer__inner { width: 100%; padding: 1.25rem 1rem; position: relative; }
@media (min-width: 768px){ .site-footer__inner { padding: 0.1rem 0.1rem; } }
.site-footer__left { position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); text-align: left; }
.site-footer__center { text-align: center; padding: 0 10rem; line-height: 1.375; }
@media (min-width: 768px){ .site-footer__center { padding: 0 14rem; } }
.site-footer__right { position: absolute; right: .75rem; top: 50%; transform: translateY(-50%); }
.donate-btn { 
  display: inline-flex; 
  align-items: center; 
  gap: .75rem; 
  background: var(--yellow-500); 
  color: #111827; 
  font-weight: 700; 
  padding: .5rem .75rem; 
  border-radius: .375rem; 
  box-shadow: 0 1px 3px rgba(0,0,0,.2); 
}
.donate-btn:hover { background: #facc15; }

.drawer { position: fixed; top: 0; right: 0; height: 100%; width: 95vw; background: var(--bg-800); border-left: 1px solid var(--bg-700); box-shadow: 0 25px 50px -12px rgba(0,0,0,.25); transform: translateX(100%); transition: transform .3s cubic-bezier(.4,0,.2,1); z-index: 40; display: flex; flex-direction: column; padding: .75rem; }
@media (min-width: 768px){ .drawer { width: 95vw; } }
@media (min-width: 1024px){ .drawer { width: 1080px; } }
.drawer.is-open { transform: translateX(0); }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,.75); display: flex; align-items: center; justify-content: center; padding: 1rem; z-index: 50; }
.modal.is-hidden { display: none; }
.modal__dialog { background: var(--bg-800); border: 1px solid var(--bg-700); border-radius: .5rem; box-shadow: 0 25px 50px -12px rgba(0,0,0,.25); padding: 1.5rem; max-width: 64rem; width: 100%; max-height: 90vh; display: flex; flex-direction: column; }
.modal__dialog--md { max-width: 28rem; }
.modal__dialog--sm { max-width: 42rem; }
.modal__dialog--lg { max-width: 80rem; width: min(95vw, 1200px); max-height: 85vh; }

.modal__dialog--wide-short {
  max-width: 80rem; 
  width: min(95vw, 1200px);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}
.modal__body {
  flex: 1 1 auto;
  overflow-y: auto;
  min-height: 0;
}


.mini-grid { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: .25rem; background: rgba(17,24,39,0.5); padding: .5rem; border-radius: .25rem; border: 1px solid #374151; max-height: 60vh; overflow: hidden; }
.mini-cell { border: 1px solid #374151; border-radius: .25rem; }


.two-col { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 1024px){ .two-col { grid-template-columns: 1fr 1fr; } }
.two-col > * { min-width: 0; }

/* Plan modal specific layout fixes */
#plan-modal .modal__dialog {
  display: flex;
  flex-direction: column;
  max-height: 90vh;
}

#plan-modal .two-col {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  overflow: hidden;
}

@media (min-width: 1024px) {
  #plan-modal .two-col {
    grid-template-columns: 1fr 1fr;
  }
}

#plan-modal .two-col > div {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* Handle the tailwind max-height class and make content scrollable */
.max-h-\[60vh\] {
  max-height: 60vh;
}

#plan-content {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  max-height: none;
}

/* Version display */
.version-display {
  position: fixed;
  top: 10px;
  left: 10px;
  background: rgba(17, 24, 39, 0.9);
  color: var(--text-400);
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--bg-700);
  z-index: 30;
  transition: all 0.2s ease;
  backdrop-filter: blur(4px);
}

.version-display:hover {
  background: rgba(17, 24, 39, 0.95);
  color: var(--yellow-400);
  border-color: var(--yellow-400);
  transform: translateY(-1px);
}

/* Changelog styles */
.changelog-release {
  border: 1px solid var(--bg-700);
  border-radius: 0.5rem;
  padding: 1rem;
  background: rgba(17, 24, 39, 0.3);
}

.changelog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--bg-700);
}

.changelog-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.changelog-list li {
  padding: 0.25rem 0;
  padding-left: 1rem;
  position: relative;
}

.changelog-list li::before {
  content: '•';
  color: var(--yellow-400);
  position: absolute;
  left: 0;
  font-weight: bold;
}


.is-dragging { outline: 3px solid var(--yellow-400); outline-offset: -2px; }
.anim-highlight { box-shadow: 0 0 0 2px #4ade80, 0 0 0 4px rgba(74,222,128,0.5); }


@font-face {
  font-family: 'RuneScape';
  src: url('../fonts/runescape.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'RuneScape Bold';
  src: url('../fonts/runescape_bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'RuneScape Small';
  src: url('../fonts/runescape_small.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

body { font-family: 'Inter', sans-serif; }
.osrs-font { font-family: 'RuneScape Bold', 'MedievalSharp', cursive; }
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #2d3748; }
::-webkit-scrollbar-thumb { background: #f6e05e; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #ecc94b; }

.task-cell, .reward-cell, .blank-cell { transition: all 0.2s ease-in-out; position: relative; overflow: hidden; }
.task-cell.completed::after {
    content: '✓'; position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%); font-size: 3rem; color: #48bb78;
    font-weight: bold; text-shadow: 0 0 10px rgba(0,0,0,0.7); opacity: 0.9;
}


.selected { 
  border-color: #f6e05e !important; 
  background-color: rgba(246, 224, 94, 0.15) !important; 
  box-shadow: 0 0 18px rgba(246,224,94,0.65), inset 0 0 8px rgba(246,224,94,0.35);
}
.unlocked { border-color: #f6e05e !important; box-shadow: 0 0 15px rgba(246, 224, 94, 0.5); }

.dependency-highlight { box-shadow: 0 0 15px rgba(183, 148, 244, 0.5); }


.prerequisite-high { box-shadow: 0 0 15px rgba(245, 101, 101, 0.5); }
.prerequisite-medium { border-color: #f6ad55 !important; background-color: #5c4025 !important; box-shadow: 0 0 15px rgba(246, 173, 85, 0.5); }
.prerequisite-low { border-color: #4299e1 !important; background-color: #2c425d !important; box-shadow: 0 0 15px rgba(66, 153, 225, 0.5); }


.suggestion-highlight { animation: pulse 1.5s infinite; }
@keyframes pulse {
    0%, 100% { box-shadow: 0 0 20px rgba(56, 189, 248, 0.8); border-color: #38bdf8; }
    50% { box-shadow: 0 0 30px rgba(56, 189, 248, 0.4); border-color: #0ea5e9; }
}

.random-spin { border-color: #f6e05e !important; background-color: rgba(246, 224, 94, 0.15) !important; box-shadow: 0 0 18px rgba(246,224,94,0.65), inset 0 0 8px rgba(246,224,94,0.35); }

#plan-mini-grid .task-cell.completed::after { font-size: 1.2rem; }
#plan-mini-grid .task-cell.completed { background-color: rgba(34, 197, 94, 0.22) !important; border-color: #34d399 !important; }


.task-cell.drag-over {
  outline: 2px dashed #f6e05e;
  outline-offset: -4px;
}


.path-highlight:not([data-heat='1']) { background-color: #3d4a5a !important; border-color: #718096 !important; }
.dependency-highlight { box-shadow: 0 0 15px rgba(183, 148, 244, 0.5); }
.dependency-highlight:not([data-heat='1']) { border-color: #b794f4 !important; background-color: #4b3861 !important; }
.prerequisite-high:not([data-heat='1']) { border-color: #f56565 !important; background-color: #542f2f !important; box-shadow: 0 0 15px rgba(245, 101, 101, 0.5); }
.prerequisite-medium:not([data-heat='1']) { border-color: #f6ad55 !important; background-color: #5c4025 !important; box-shadow: 0 0 15px rgba(246, 173, 85, 0.5); }
.prerequisite-low:not([data-heat='1']) { border-color: #4299e1 !important; background-color: #2c425d !important; box-shadow: 0 0 15px rgba(66, 153, 225, 0.5); }


.layout > .panel {
  padding: 1.2vh; 
}
.layout > .panel .panel-title {
  font-size: clamp(2rem, 4.5vw, 3rem); 
  line-height: 1.1;
  margin: 0 0 1vh; 
  text-align: center;
}
.layout > .panel .controls {
  gap: 1vh; 
  margin-bottom: 1vh; 
}
.layout > .panel .controls .btn {
  padding: 0.9vh 1.8vw; 
  font-size: clamp(0.7rem, 1.6vw, 0.875rem); 
  border-radius: 0.6vh; 
  box-shadow: 0 2px 3px -1px rgba(0,0,0,.12), 0 1px 2px -1px rgba(0,0,0,.12); 
  min-height: 4.5vh;
  min-width: 0; /* don't force width on all buttons */
}


.layout > .panel .controls .btn.small {
  padding: .375rem .75rem;
  font-size: .875rem;
  min-width: auto;
  min-height: auto;
}

.layout > .panel .controls .btn.xsmall {
  padding: .25rem .5rem;
  font-size: .75rem;
  min-width: auto;
  min-height: auto;
}

.layout > .panel .panel--muted {
  padding: 1vh; 
}
#suggestion-panel { 
  margin-bottom: 1vh !important;
}

.layout > .panel #suggestion-panel {
  padding: 0.7vh;
  min-height: 5vh;
}
.layout > .panel #suggestion-panel p { margin: 0; }

#suggestion-panel { display: none !important; }

.layout > .panel .section-title {
  font-size: clamp(1rem, 2.2vw, 1.25rem);
  line-height: 1.75rem;
  margin-bottom: 1vh;
  padding-bottom: 0.3vh;
}

.layout > .panel #details-panel .p-8 {
  padding: 2vh; 
}

.layout > .panel #details-panel .form-grid { gap: 1vh; }
.layout > .panel #details-panel h3.text-2xl {
  font-size: clamp(1rem, 2vw, 1.15rem);
  line-height: 1.6rem;
  margin: 0 0 0.5vh;
}

.layout > .panel #details-panel .border-t { padding-top: 1vh; }

.layout > .panel #details-panel .stack > * + * {
  margin-top: 1vh;
}

.layout > .panel h4.text-lg {
  margin: 0 !important;
}

@media (max-height: 820px) {
  .layout > .panel { padding: 1vh; }
  .layout > .panel .controls { gap: 0.8vh; margin-bottom: 0.8vh; }
  .layout > .panel .btn { 
    padding: 0.8vh 1.5vw; 
    font-size: clamp(0.65rem, 1.4vw, 0.84rem);
    min-height: 4vh;
    min-width: 8vw;
  }
  

  .layout > .panel .btn.small {
    padding: .375rem .75rem;
    font-size: .875rem;
    min-width: auto;
    min-height: auto;
  }
  
  .layout > .panel .btn.xsmall {
    padding: .25rem .5rem;
    font-size: .75rem;
    min-width: auto;
    min-height: auto;
  }
  .layout > .panel .section-title { 
    font-size: clamp(0.9rem, 2vw, 1.15rem); 
    line-height: 1.6rem; 
    margin-bottom: 0.8vh; 
  }
}

/* --------------------------------------------------
   Mobile / small portrait layout overrides
   Goal: Keep original desktop grid + side panel intact while
   making phones use a vertical (grid over panel) flow and tighten spacing.
   We DO NOT touch the desktop breakpoint (>=1024px) so existing layout stays.
--------------------------------------------------- */
@media (max-width: 900px) and (orientation: portrait) {
  /* Switch to simple flex stack for extra consistency & easier ordering */
  .layout { display: flex; flex-direction: column; gap: 1.1rem; }
  #grid-wrapper { order: 1; }
  .layout > .panel { order: 2; }
  /* Slightly reduce gaps so 8x8 stays visible without forcing landscape */
  #planner-grid { gap: .35rem; }
  #planner-grid .task-cell, #planner-grid .reward-cell { font-size: clamp(0.55rem, 2.2vw, 0.75rem); }
  /* Allow the panel content to breathe without feeling crammed */
  .layout > .panel { padding: 1rem .9rem 1.1rem; }
  /* Tighten heading scale for small width */
  .layout > .panel .panel-title { font-size: clamp(1.8rem, 9vw, 2.4rem); }
  /* Controls: stack groups vertically, give buttons full width */
  .controls { flex-direction: column; align-items: stretch; gap: .9rem; }
  .controls-group--left, .controls-group--right { 
    border-right: 0; padding-right: 0; 
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
  .controls-group--left .btn, .controls-group--right .btn { min-height: 42px; font-size: clamp(0.65rem, 3.2vw, 0.85rem); }
  /* Make footer more compact so content area gains space */
  .site-footer__inner { padding: .5rem .75rem; }
  .site-footer__center { padding: 0 1rem; font-size: .65rem; }
  /* Optional: hide long thank you text until expanded (future hook) */
  body.is-mobile .site-footer__center.collapsed { max-height: 2.2em; overflow: hidden; }
  /* Completely hide footer on mobile per request */
  body.is-mobile .site-footer { display: none !important; }
  body.is-mobile .page { padding-bottom: 1rem; } /* remove reserved footer space */
}

/* When body gets the is-mobile class (set by JS) we can progressively enhance
   without relying solely on width/orientation (e.g., future feature toggles). */
body.is-mobile #main-layout { max-width: 100%; }
