/* @import url('https://fonts.googleapis.com/css2?family=Roboto+Mono:ital,wght@0,100..700;1,100..700&family=Space+Mono:ital,wght@0,400;0,700;1,400;1,700&display=swap'); */


html, body {
  margin: 0;
  padding: 0;
  font-size: 16px;
  box-sizing: border-box;
  font-family: var(--font-stack-sans-serif);
  color: rgba(0, 0, 0, 0.85);
  line-height: 1.5;
  -moz-osx-font-smoothing: grayscale;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

body > main {
  flex-grow: 1;
}

html.development, body.development {
  border: 4px dashed var(--color-orange);
}

p {
  margin-bottom: var(--base-spacing);
  word-break: break-word;
}

select { 
  height: 40px;
  padding: 0 calc(var(--base-spacing)/4);
}

a {
  cursor: pointer;
  color: black;
}

a.is-link {
  text-decoration: underline;
}

main,
footer,
header,
nav {
  width: 100%;
  margin: 0;
}

/* Match main horizontal padding to nav so content isn't flush */
main {
  padding-left: var(--base-spacing);
  padding-right: var(--base-spacing);
}

main.is-narrow {
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}

/* Full-page editor (notes, journal): no box, full height, terminal-style focus on content */
main.editor-page {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 75px);
  padding-top: calc(var(--base-spacing) / 2);
}

main.editor-page .field {
  margin-bottom: var(--base-spacing);
}

main.editor-page .editor-body,
.editor-body {
  font-family: var(--font-stack-monospace);
  line-height: 1.6;
  min-height: 12em;
  flex: 1 1 0;
}

/* Subtle auto-save indicator: hidden by default, only visible with --show after save */
.note-autosave-indicator {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.note-autosave-indicator--show {
  opacity: 0.6;
  pointer-events: auto;
}

@media (max-width: 768px) {
  main {
    padding-left: calc(var(--base-spacing) / 2);
    padding-right: calc(var(--base-spacing) / 2);
  }
}

.profile-icon {
  display: inline-block;
  width: 32px;
  height: 32px;
  border-radius: 100%;
  background-size: cover;
  background-repeat: no-repeat;
  background-color: #ccc;
  &.is-large {
    width: 48px;
    height: 48px;
  }
}

.profile-header {
  padding-bottom: var(--base-spacing);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.profile-email {
  color: rgba(0, 0, 0, 0.55);
  font-family: var(--font-stack-sans-serif);
  font-size: 0.9rem;
}

.profile-section-heading {
  margin-bottom: calc(var(--base-spacing) / 2);
}

.profile-action-list {
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.profile-action {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--base-spacing);
  padding: var(--base-spacing) 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.profile-action__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 100%;
  color: rgba(0, 0, 0, 0.55);
}

.profile-action__body h3 {
  margin: 0;
  font-size: 1rem;
}

.profile-action__body p {
  margin: 0.25rem 0 0;
  color: rgba(0, 0, 0, 0.58);
  font-family: var(--font-stack-sans-serif);
  font-size: 0.86rem;
  line-height: 1.4;
}

.profile-action__buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: calc(var(--base-spacing) / 2);
}

.api-keys-empty {
  color: rgba(0, 0, 0, 0.52);
}

.api-keys-empty .ph {
  font-size: 1.5rem;
}

.text-success,
.status-success {
  color: var(--color-success);
}

.payment-success-message {
  background-color: var(--color-success-bg);
  border-color: var(--color-success-border);
  color: var(--color-success);
}

.payment-success-icon {
  color: var(--color-success);
}

@media (max-width: 640px) {
  .profile-action {
    grid-template-columns: 32px minmax(0, 1fr);
  }

  .profile-action__buttons {
    grid-column: 2;
    justify-content: flex-start;
  }
}

#main-nav {
  width: 100%;
  min-width: 100%;
  margin-bottom: var(--base-spacing);
  padding: 0 var(--base-spacing);
  section {
    display: flex;
    align-items: center;
    margin: 0;
    max-width: none;
    height: 45px;
    width: 100%;
  }
  .logo {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    &:hover {
      background-color: transparent;
    }
  }
  .logo-40 {
    background-color: transparent;
  }
  border-bottom: 1px solid rgba(0, 0, 0, 0.2);
  a {
    text-align: center;
    justify-content: center;
    line-height: 45px;
    color: rgba(0, 0, 0, 0.8);
    height: 100%;
    font-weight: 500;
    text-decoration: none;
    background: transparent;
    padding: 0 0.5rem;
    margin-right: calc(var(--base-spacing)/4);
    &:hover {
      background: rgba(0, 0, 0, 0.05);
    }
    &.selected {
      border-bottom: 2px solid black;
    }
    @media (max-width: 768px) {
      flex-grow: 1;
    }
  }
}

/* Modal tabs styling similar to main nav */
.button-group [data-toggle-target="tab"] {
  border: none;
  background: transparent;
  padding: 0 0.5rem;
  margin-right: 0.5rem;
  cursor: pointer;
}
.button-group [data-toggle-target="tab"].is-active {
  border-bottom: 2px solid black;
}

@media (max-width: 768px) {
  #main-nav {
    padding: 0 calc(var(--base-spacing)/2);
    a {
      padding: 0 0.25rem;
    }
  }

  #main-nav {
    .label { display: none; }
  }
}

footer {
  padding-bottom: 2rem;
}

.field {
  margin-bottom: calc(var(--base-spacing) * 2);

  .field_with_errors {
    label { color: var(--color-red); }
    input { border-color: var(--color-red); }
  }
}

.note-audio-player {
  max-width: 100%;
  width: 100%;
  display: block;
}

.note-audio-player--full {
  width: 100%;
  max-width: 480px;
}

.note-audio-panel .button.is-disabled {
  opacity: 0.65;
  cursor: not-allowed;
  pointer-events: none;
}

@media (max-width: 640px) {
  .note-audio-player--full {
    max-width: 100%;
  }
}

.field textarea,
.field input[type=text],
.field input[type=email],
.field input[type=password],
.field input[type=number],
.field input[type=url],
.field input[type=tel],
.field input[type=date],
.field input[type=datetime-local],
.field input[type=time] {
  margin: 0.25rem 0;
  width: 100%;
}
.field input[type=checkbox],
.field input[type=radio] {
  margin-right: 0.5rem;
}

.field.field_with_errors {
  input {
    border-color: var(--color-red);
  }
}

input[type=checkbox],
input[type=radio] {
  width: auto;
  width: 25px !important;
  min-width: 25px !important;
}

.box {
  background-color: var(--color-box);
  color: rgba(0, 0, 0, 0.9);
  padding: calc(var(--base-spacing) * 2) calc(var(--base-spacing) * 4);
  border-radius: var(--form-radius);
  line-height: 1.5;
  box-shadow: 0 0.5rem 3rem -0.5rem rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(0, 0, 0, 0.1);

  &.has-shadow {
    box-shadow: 4px 4px 0 0 rgba(0,0,0,0.30);
  }
}

.box:empty {
  display: none;
}

.box {
  &.is-narrow {
    padding: var(--base-spacing) calc(var(--base-spacing) * 2);
  }
  &.is-super-narrow {
    padding: var(--base-spacing) calc(var(--base-spacing) * 1);
  }

  &.is-red,
  &.is-danger {
    background-color: #efd1d1;
    border-color: #f3e1e1;
  }

  &.is-blue,
  &.notice {
    background-color: #d4dff6;
    @media (prefers-color-scheme: dark) {
      color: rgba(0, 0, 0, 0.7);
    }
  }

  &.is-success {
    background-color: var(--color-success-bg);
    border-color: var(--color-success-border);
  }
}

input {
  border-radius: var(--form-radius);
}

.input,
textarea,
input[type=tel],
input[type=time],
input[type=date],
input[type=datetime-local],
input[type=email],
input[type=password],
input[type=number],
input[type=url],
input[type=submit],
input[type=text] {
  display: block;
  box-shadow: inset 0 0.0625em 0.125em rgba(10, 10, 10, 0.05);
  max-width: 100%;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
  align-items: center;
  border: 1px solid rgba(0, 0, 0, 0.2);
  font-size: 1rem;
  height: 2.5em;
  justify-content: flex-start;
  line-height: 1.25;
  padding-bottom: calc(0.5em - 1px);
  padding-left: calc(0.75em - 1px);
  padding-right: calc(0.75em - 1px);
  padding-top: calc(0.5em - 1px);
  position: relative;
}

.input.is-invalid,
textarea.is-invalid,
input[type=tel].is-invalid,
input[type=time].is-invalid,
input[type=date].is-invalid,
input[type=datetime-local].is-invalid,
input[type=email].is-invalid,
input[type=password].is-invalid,
input[type=number].is-invalid,
input[type=submit].is-invalid,
input[type=text].is-invalid {
  border-color: var(--color-red);
}

.input.is-invalid:hover,
textarea.is-invalid:hover,
input[type=tel].is-invalid:hover,
input[type=time].is-invalid:hover,
input[type=date].is-invalid:hover,
input[type=datetime-local].is-invalid:hover,
input[type=email].is-invalid:hover,
input[type=password].is-invalid:hover,
input[type=number].is-invalid:hover,
input[type=submit].is-invalid:hover,
input[type=text].is-invalid:hover {
  border: 1px solid var(--color-red);
}

.input:hover,
textarea:hover,
input[type=tel]:hover,
input[type=time]:hover,
input[type=date]:hover,
input[type=datetime-local]:hover,
input[type=email]:hover,
input[type=password]:hover,
input[type=number]:hover,
input[type=submit]:hover,
input[type=text]:hover {
  border: 1px solid rgba(0, 0, 0, 0.2);
}

input[type=time],
input[type=date],
input[type=datetime-local] {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-color: transparent;
  border: 1px solid rgba(0, 0, 0, 0.1);
  color: inherit;
  cursor: pointer;
  font-family: var(--font-stack-sans-serif);
  padding: 0.5rem 1rem;
  height: auto;
}

@media (prefers-color-scheme: dark) {
  input[type=time],
  input[type=date],
  input[type=datetime-local] {
    background-color: #555;
    color: white;
    border: 1px solid #666;
  }
}

input[type=time]:hover,
input[type=date]:hover,
input[type=datetime-local]:hover {
  filter: brightness(1.2);
}

.button-group {
  display: inline-flex;
}

.button-group .button {
  border: 1px solid rgba(0, 0, 0, 0.1);
  margin: 0;
  border-radius: 0;
  padding: var(--base-spacing);
}

.button-group .button:first-child {
  border-radius: var(--button-radius) 0 0 var(--button-radius);
}

.button-group .button:last-child {
  border-radius: 0 var(--button-radius) var(--button-radius) 0;
}

.button-group .button:not(:last-child) {
  border-right: none;
}

.button-group .button:hover {
  border-color: rgba(0, 0, 0, 0.2);
  z-index: 1;
}

input[type=submit],
button,
.button {
  font-weight: 500;
  font-family: var(--font-stack-sans-serif);
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  border-radius: var(--button-radius);
  background-color: transparent;
  border: 1px solid rgba(0, 0, 0, 0.1);
  color: rgba(0, 0, 0, 0.7);
  justify-content: center;
  padding: 0.5rem 1rem;
  text-align: center;
  white-space: nowrap;
  text-decoration: none;

  &:hover,
  &:focus {
    filter: brightness(1.2);
  }
}

button a,
.button a {
  text-decoration: none;
}

button[disabled],
.button[disabled],
button.disabled,
.button.disabled {
  cursor: not-allowed;
  pointer-events: none;
  opacity: 0.5;
}

button.is-primary,
.button.is-primary {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
  color: white;
}

button.is-small,
.button.is-small {
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;

  &.is-tokens {
    padding: 0;
    .value {
      padding: 0.4rem 0.8rem;
    }
    .amount {
      padding: 0.4rem 0.8rem;
    }
  }
}

button.is-tiny,
.button.is-tiny {
  padding: 0.2rem 0.4rem;
  font-size: 0.6rem;
}

button.is-link,
.button.is-link {
  border-color: transparent;
  font-weight: 500;
  text-decoration: underline;
  color: black;
}

button.is-link:hover,
.button.is-link:hover {
  color: black;
  border-color: transparent;
}

button.is-danger,
.button.is-danger {
  background-color: var(--color-danger);
  border-color: var(--color-danger);
  color: white;
}

.highlight {
  background-color: var(--color-highlight);
  @media (prefers-color-scheme: dark) {
    color: black;
  }
}

.highlight-slant {
  position: relative;
  display: inline-block;
  z-index: 0;
  &:before {
    content: "";
    display: block;
    position: absolute;
    left: 0; top: 0;
    width: 100%;
    transform: translateY(7%) skew(10deg) translateX(-2%) rotate(-1deg);
    height: 100%;
    background-color: yellow;
    z-index: -1;
  }
  @media (prefers-color-scheme: dark) {
    color: black;
  }
}


table {
  border-collapse: collapse;
  border: 1px solid rgba(0, 0, 0, 0.1);
  tr:nth-child(even) {
    background-color: rgba(0, 0, 0, .025);
  }
}

table th,
table td {
  text-align: left;
}

table td {
  padding: calc(var(--base-spacing) / 2);
}

.hint {
  font-family: var(--font-stack-sans-serif);
  opacity: 0.6;
  font-size: 0.8rem;
  line-height: 1.5;
  display: inline-block;
}

hr {
  border-top: 1px solid rgba(0, 0, 0, 0.07);
  border-bottom: none;
}

.tag {
  border: 1px solid transparent;
  font-size: 0.55rem;
  display: inline-block;
  background-color: #e0e0e0;
  color: white;
  padding: 0.12rem 0.32rem;
  text-transform: uppercase;
  font-weight: 500;
  white-space: nowrap;
  letter-spacing: 0;
  line-height: 1.2;
  border-radius: calc(var(--form-radius) / 2);
  font-family: var(--font-stack-sans-serif);
  text-decoration: none; /* ensure tags aren't underlined */
}

/* Deterministic color variants for tags */
.tag.tag--c1 { background-color: #2563eb; }
.tag.tag--c2 { background-color: #7c3aed; }
.tag.tag--c3 { background-color: #ea580c; }
.tag.tag--c4 { background-color: #16a34a; }
.tag.tag--c5 { background-color: #742558; }
.tag.tag--c6 { background-color: #0891b2; }
.tag.tag--c7 { background-color: #ca8a04; }
.tag.tag--c8 { background-color: #9333ea; }
.tag.tag--c9 { background-color: #65a30d; }
.tag.tag--c10 { background-color: #059669; }
.tag.tag--c11 { background-color: #1c9cb9; }
.tag.tag--c12 { background-color: #1d4ed8; }
.tag.tag--c13 { background-color: #d97706; }
.tag.tag--c14 { background-color: #8b5cf6; }
.tag.tag--c15 { background-color: #0d9488; }
.tag.tag--c16 { background-color: #61991c; }
.tag.tag--c17 { background-color: #4d7c0f; }
.tag.tag--c18 { background-color: #3730a3; }
.tag.tag--c19 { background-color: #a16207; }
.tag.tag--c20 { background-color: #166534; }

summary {
  cursor: pointer;
}

legend,
.legend,
label,
.label {
  display: block;
  font-weight: 500;
  font-family: var(--font-stack-sans-serif);
  font-size: 14px;
  font-weight: 600;
  color: rgba(0, 0, 0, 0.6);
}

details[open] > summary::marker {
  content: "-";
  color: rgba(255, 255, 255, 0.5);
}

details summary::marker {
  content: "+";
  color: rgba(255, 255, 255, 0.5);
 }

th {
  font-weight: 500;
  letter-spacing: 0;
  font-size: 0.7rem;
  color: rgba(0, 0, 0, 0.5);
  text-transform: uppercase;
  font-family: var(--font-stack-sans-serif);
  @media (prefers-color-scheme: dark) {
    color: rgba(255, 255, 255, 0.7);
  }
}


.logo-64 {
  width: 42px;
  height: 42px;
  min-width: 42px;
  min-height: 42px;
  background-size: cover;
  background-repeat: no-repeat;
  background-image: url("/images/logo-dark_300.png");
}
@media (prefers-color-scheme: dark) {
  .logo-64 {
    background-image: url("/images/logo-light_300.png");
  }
}


.modal-overlay {
  cursor: pointer;
  position: fixed;
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9000;
  background-color: rgba(0, 0, 0, 0.5);
}

.modal {
  /* Acts as a logical root; avoid clipping children */
  position: static;
  overflow: visible;
}

.modal .box {
  position: fixed;
  z-index: 9001; /* above overlay */
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 800px;
  max-width: 90vw;
  max-height: calc(90vh - 64px);
  overflow: auto;
}

/* Sidebar modal layout */
.sidebar-modal {
  position: fixed;
  z-index: 9001;
  top: 0;
  right: 0;
  height: 100vh;
  width: min(520px, 100vw);
  max-width: 100%;
  background-color: var(--color-box);
  color: rgba(0, 0, 0, 0.9);
  display: flex;
  flex-direction: column;
  border-left: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: -0.5rem 0 3rem -0.5rem rgba(0, 0, 0, 0.15);
  transform: translateX(100%);
  transition: transform 200ms ease-out;
}

.modal:not([hidden]) .sidebar-modal { transform: translateX(0); }


.sidebar-modal__header {
  width: 100%;
  padding: 0; /* allow tabs to span full width edge-to-edge */
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.sidebar-modal__header .button-group { display: flex; width: 100%; }
.sidebar-modal__header .button-group .button { flex: 1; border-radius: 0; }

.sidebar-modal__content {
  padding: calc(var(--base-spacing) * 2);
  flex: 1;
  overflow: auto;
}

.sidebar-modal__footer {
  padding: calc(var(--base-spacing) * 2);
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  background-color: inherit;
}

.sidebar-modal__footer .button,
.sidebar-modal__footer input[type=submit] {
  width: 100%;
}

@media (prefers-color-scheme: dark) {
  .sidebar-modal {
    background-color: #444;
    color: white;
    border-left-color: #555;
  }
  .sidebar-modal__header { border-bottom-color: #555; }
  .sidebar-modal__footer { border-top-color: #555; }
}

/* Wider variant for journal entry editing */
.sidebar-modal--wide {
  width: min(800px, 100vw);
}

/* Ensure hidden attribute works with flex elements */
[hidden] {
  display: none !important;
}

/* Mobile: full-screen modal */
@media (max-width: 640px) {
  .sidebar-modal {
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    border-left: none;
    transform: translateY(-100%);
    box-shadow: none;
  }
  
  .modal:not([hidden]) .sidebar-modal {
    transform: translateY(0);
  }
}

h1, h2, h3, h4, h5, h6 {
  line-height: 1.25;
  font-family: var(--font-stack-headings);
}

h1 {
  letter-spacing: 0;
  font-family: var(--font-stack-headings);
}

@media (max-width: 768px) {
  h1 {
    font-size: 2rem !important;
    line-height: 1.2;
  }
}


@media (prefers-color-scheme: dark) {
  body {
    background-color: #333;
    color: #fff;
    padding-bottom: 4rem;
  }

  #main-nav {
    a { color: rgba(255, 255, 255, 0.85); }
  }

  .notice {
    color: rgba(0, 0, 0, 0.7);
  }

  .box {
    background-color: #444;
    color: white;

    &.notice {
      color: black;
    }

    &.is-red,
    &.is-danger {
      background-color: #3a1c1c;
      border-color: #62312f;
    }
  }

  h1, h2, h3, h4, h5, h6 {
    color: white;
  }

  .profile-header,
  .profile-action-list,
  .profile-action {
    border-color: rgba(255, 255, 255, 0.15);
  }

  .profile-email,
  .profile-action__body p,
  .api-keys-empty {
    color: rgba(255, 255, 255, 0.68);
  }

  .profile-action__icon {
    border-color: rgba(255, 255, 255, 0.18);
    color: rgba(255, 255, 255, 0.68);
  }

  a {
    color: white;
  }

  label, legend {
    color: rgba(255, 255, 255, 0.5);
  }

  .button {
    background-color: #555;
    color: white;
  }

  .button.is-link {
    background: transparent;
    color: white;
  }

  .button.is-link:hover,
  .button.is-link:focus {
    color: white;
  }

  .tag {
    background-color: #555;
    color: white;
  }
  .tag.tag--c1 { background-color: #2f3e63; }
  .tag.tag--c2 { background-color: #4b3a63; }
  .tag.tag--c3 { background-color: #634d2f; }
  .tag.tag--c4 { background-color: #3a5f3a; }
  .tag.tag--c5 { background-color: #633a4f; }
  .tag.tag--c6 { background-color: #2f5163; }
  .tag.tag--c7 { background-color: #635a2f; }
  .tag.tag--c8 { background-color: #3a3a63; }

  input, textarea, select {
    background-color: #555;
    color: white;
    border: 1px solid #666;
  }

  .sticky-character-footer {
    background-color: #333;
    color: white;
    border-color: #555;
  }

  .action-footer {
    background-color: #333;
    color: white;
    border-color: #555;
  }

  legend,
  .legend,
  label,
  .label {
    color: white;
  }
}



.pagination {
  font-family: var(--font-stack-sans-serif);
  .disabled { opacity: 0.5; pointer-events: none; }
  font-size: 1.2rem;
  a, em {
    padding: 0 calc(var(--base-spacing)/4);
  }
  em.current {
    font-style: normal;
    opacity: 0.6;
    pointer-events: none;
  }
}

input[type=file]:hover {
  filter: brightness(1.2);
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  input[type=file] {
    background-color: #555;
    color: white;
    border: 1px solid #666;
  }
}


/* Style the "Choose File" button inside file inputs */
input[type=file]::-webkit-file-upload-button,
input[type=file]::file-selector-button {
  font-weight: 500;
  font-family: var(--font-stack-sans-serif);
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  border-radius: var(--button-radius);
  background-color: transparent;
  border: 1px solid rgba(0, 0, 0, 0.1);
  color: rgba(0, 0, 0, 0.7);
  background: var(--color-primary);
  padding: 0.5rem 1rem;
  margin-right: 1rem;
  margin-inline-end: 1rem;
  color: white;
}

/* Hover state */
input[type=file]::-webkit-file-upload-button:hover,
input[type=file]::file-selector-button:hover {
  filter: brightness(1.2);
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  input[type=file]::-webkit-file-upload-button,
  input[type=file]::file-selector-button {
    background-color: #555;
    color: white;
    border: 1px solid #666;
  }
}

.flashes {
  animation: flashes 5s forwards;
}

/* Flash message text colors, tuned for contrast in both themes */
.flash {
  font-weight: 500;
}
.flash--alert {
  color: #b3261e;
}
.flash--notice {
  color: #1b6e2e;
}
@media (prefers-color-scheme: dark) {
  .flash--alert {
    color: #f0a6a1;
  }
  .flash--notice {
    color: #7ddf97;
  }
}

/* Flashes shake and fade out */
@keyframes flashes {
  0% { transform: translateX(0); opacity: 1; display: none; }
  1% { transform: translateX(-10px); opacity: 1; display: block; }
  2% { transform: translateX(10px); opacity: 1; display: block; }
  3% { transform: translateX(-10px); opacity: 1; display: block; }
  4% { transform: translateX(0); opacity: 1; display: block; }
  80% { transform: translateX(0); opacity: 1; display: block; }
  100% { transform: translateX(0); opacity: 0; display: none; }
}


/* Task cards - mobile-first design */
.tasks-list {
  width: 100%;
}

.task-card {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
  transition: background-color 0.15s ease;
}

.task-card:hover {
  background-color: rgba(0, 0, 0, 0.02);
}

@media (prefers-color-scheme: dark) {
  .task-card:hover {
    background-color: rgba(255, 255, 255, 0.03);
  }
}

.task-complete-form {
  flex-shrink: 0;
}

.task-complete-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  border-radius: var(--button-radius);
  cursor: pointer;
  font-size: 1.4rem;
  color: rgba(0, 0, 0, 0.3);
  transition: all 0.15s ease;
  padding: 0;
}

.task-complete-btn:hover {
  background-color: rgba(0, 0, 0, 0.05);
  color: rgba(0, 0, 0, 0.6);
}

.task-complete-btn.is-completed {
  color: var(--color-primary);
}

.task-complete-btn.is-completed:hover {
  color: var(--color-primary);
  opacity: 0.7;
}

@media (prefers-color-scheme: dark) {
  .task-complete-btn {
    color: rgba(255, 255, 255, 0.4);
  }
  .task-complete-btn:hover {
    background-color: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.7);
  }
  .task-complete-btn.is-completed {
    color: var(--color-primary);
  }
}

.task-content {
  min-width: 0; /* Allows text truncation to work in flex */
}

.task-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.task-title {
  min-width: 0;
  word-break: break-word;
  font-weight: 500;
  line-height: 1.3;
}

/* Meta row: due date, schedule badge, and tags share one aligned line. */
.task-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.3rem 0.4rem;
  margin-top: 0.25rem;
  font-size: 0.8rem;
}

.task-meta__due,
.task-meta__done {
  color: rgba(0, 0, 0, 0.6);
  white-space: nowrap;
}

.task-meta__due.red {
  color: var(--color-red);
}

@media (prefers-color-scheme: dark) {
  .task-meta__due,
  .task-meta__done {
    color: rgba(255, 255, 255, 0.6);
  }
}

/* Used in the detail pane to wrap the tag list. */
.task-tags {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.2rem;
}

/* Points score — fixed-width column so the numbers line up table-style,
   regardless of how many (variable, conditional) action buttons follow. */
.task-score {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 0.18rem;
  flex-shrink: 0;
  width: 3.6rem;
}

.task-score__unit {
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: rgba(0, 0, 0, 0.4);
}

@media (prefers-color-scheme: dark) {
  .task-score__unit {
    color: rgba(255, 255, 255, 0.4);
  }
}

.timing-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.16rem;
  padding: 0.08rem 0.3rem;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: calc(var(--form-radius) / 2);
  background: rgba(0, 0, 0, 0.035);
  color: rgba(0, 0, 0, 0.58);
  font-family: var(--font-stack-sans-serif);
  font-size: 0.55rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0;
  text-transform: uppercase;
  white-space: nowrap;
}

.timing-badge i {
  font-size: 0.7rem;
  line-height: 1;
}

.task-description-input {
  min-height: 14rem;
  resize: vertical;
}

.task-due-date-toggle {
  gap: 0.25rem;
}

.task-due-date-toggle input[type=checkbox] {
  margin-right: 0;
}

.task-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.25rem;
  flex-shrink: 0;
  /* Reserve room for the full (4-button) action set so the score column to its
     left always lands at the same x, even when a row has fewer actions. */
  width: 156px;
  opacity: 0.3;
  transition: opacity 0.15s ease;
}

.task-card:hover .task-actions {
  opacity: 1;
}

/* Always show actions on touch devices */
@media (hover: none) {
  .task-actions {
    opacity: 0.6;
  }
}

.task-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  border-radius: var(--button-radius);
  cursor: pointer;
  font-size: 1rem;
  color: rgba(0, 0, 0, 0.5);
  transition: all 0.15s ease;
  padding: 0;
  text-decoration: none;
}

.task-action-btn:hover {
  background-color: rgba(0, 0, 0, 0.08);
  color: rgba(0, 0, 0, 0.8);
}

@media (prefers-color-scheme: dark) {
  .timing-badge {
    border-color: rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.68);
  }

  .task-action-btn {
    color: rgba(255, 255, 255, 0.5);
  }
  .task-action-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
  }
}

.task-details {
  opacity: 0;
  transition: opacity 0.15s ease;
}

.task-card:hover .task-details {
  opacity: 0.5;
}

/* Mobile: show details always */
@media (max-width: 640px) {
  .task-card {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) auto;
    column-gap: 0.6rem;
    row-gap: 0.25rem;
    align-items: start;
  }

  .task-complete-form {
    grid-column: 1;
    grid-row: 1 / span 2;
    align-self: center;
  }

  .task-content {
    grid-column: 2;
    grid-row: 1;
  }

  .task-score {
    grid-column: 3;
    grid-row: 1;
    align-self: center;
  }

  .task-details {
    opacity: 0.5;
  }

  .task-complete-btn {
    width: 48px;
    height: 48px;
    font-size: 1.75rem;
  }

  .task-action-btn {
    width: 40px;
    height: 40px;
  }

  .task-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    grid-column: 2 / -1;
    grid-row: 2;
    justify-content: flex-end;
    width: auto;
    opacity: 0.6;
  }
}

.score-summary {
  display: grid;
  gap: 0.5rem;
}

.score-summary__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem;
}

.score-summary__primary {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  min-width: 0;
}

.score-summary__value {
  font-size: 1.6rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  letter-spacing: -0.02em;
}

.score-summary__label {
  color: rgba(0, 0, 0, 0.5);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  line-height: 1;
}

.score-summary__compare {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.18rem;
  text-align: right;
  flex-shrink: 0;
}

.score-summary__delta {
  display: inline-flex;
  align-items: center;
  gap: 0.12rem;
  font-size: 0.95rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  color: rgba(0, 0, 0, 0.6);
}

.score-summary__delta i {
  font-size: 0.8rem;
}

.score-summary__delta.is-positive {
  color: #15803d;
}

.score-summary__delta.is-negative {
  color: #b91c1c;
}

.score-summary__sub {
  color: rgba(0, 0, 0, 0.45);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  line-height: 1;
}

.score-summary__foot {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 1rem;
  color: rgba(0, 0, 0, 0.45);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.score-summary__foot strong {
  color: rgba(0, 0, 0, 0.7);
  font-variant-numeric: tabular-nums;
}

@media (prefers-color-scheme: dark) {
  .score-summary__foot {
    color: rgba(255, 255, 255, 0.45);
  }
  .score-summary__foot strong {
    color: rgba(255, 255, 255, 0.75);
  }
}

.score-summary__bar {
  height: 0.28rem;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.08);
}

.score-summary__bar-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--color-primary);
  transition: width 0.3s ease;
}

.metrics-page {
  padding-bottom: calc(var(--base-spacing) * 3);
}

.metrics-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: calc(var(--base-spacing) * 1.5);
}

.metrics-stat,
.metrics-panel {
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: var(--color-box);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.metrics-stat {
  display: grid;
  gap: 0.3rem;
  min-width: 0;
  padding: 0.8rem;
}

.metrics-stat--today {
  border-color: rgba(47, 107, 79, 0.4);
}

.metrics-stat__label,
.metrics-panel__header span,
.metrics-week article span,
.metrics-bars__item span,
.metrics-bars__item small {
  color: rgba(0, 0, 0, 0.52);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.metrics-stat strong {
  min-width: 0;
  font-size: 1.8rem;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}

.metrics-stat__note {
  min-height: 1.2rem;
  color: rgba(0, 0, 0, 0.56);
  font-size: 0.75rem;
}

.metrics-stat__note.is-positive {
  color: #15803d;
}

.metrics-stat__note.is-negative {
  color: #b91c1c;
}

.metrics-panel {
  margin-bottom: calc(var(--base-spacing) * 1.5);
  padding: var(--base-spacing);
}

.metrics-panel__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--base-spacing);
  margin-bottom: var(--base-spacing);
}

.metrics-panel__header h2 {
  margin: 0;
  font-family: var(--font-stack-headings);
  font-size: 1rem;
  line-height: 1.2;
}

.metrics-panel__header span {
  text-align: right;
}

.metrics-bars {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.55rem;
  min-height: 15rem;
}

.metrics-bars__item {
  display: grid;
  grid-template-rows: minmax(8rem, 1fr) auto auto auto;
  gap: 0.25rem;
  min-width: 0;
  text-align: center;
}

.metrics-bars__track {
  display: flex;
  align-items: flex-end;
  height: 100%;
  min-height: 8rem;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(0, 0, 0, 0.035);
}

.metrics-bars__bar {
  width: 100%;
  min-height: 0;
  background: #2f6b4f;
}

.metrics-bars__item.is-today .metrics-bars__track {
  border-color: rgba(47, 107, 79, 0.45);
  background: rgba(47, 107, 79, 0.08);
}

.metrics-bars__item strong {
  min-width: 0;
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
}

.metrics-bars__item small {
  color: rgba(0, 0, 0, 0.38);
  font-size: 0.58rem;
}

.metrics-week {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.metrics-week article {
  display: grid;
  gap: 0.45rem;
  min-width: 0;
}

.metrics-week article strong {
  min-width: 0;
  font-size: 1.2rem;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}

.metrics-progress {
  height: 0.45rem;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.08);
}

.metrics-progress div {
  height: 100%;
  background: var(--color-primary);
}

.metrics-progress--muted div {
  background: rgba(0, 0, 0, 0.35);
}

.metrics-progress--goal div {
  background: #2f6b4f;
}

.metrics-week-days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.35rem;
  margin-top: var(--base-spacing);
}

.metrics-week-days span {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
  padding: 0.45rem 0.35rem;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(0, 0, 0, 0.025);
  color: rgba(0, 0, 0, 0.52);
  font-size: 0.62rem;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
}

.metrics-week-days span.is-today {
  border-color: rgba(47, 107, 79, 0.42);
  background: rgba(47, 107, 79, 0.08);
}

.metrics-week-days strong {
  min-width: 0;
  color: rgba(0, 0, 0, 0.85);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (prefers-color-scheme: dark) {
  .score-summary__label,
  .score-summary__sub {
    color: rgba(255, 255, 255, 0.5);
  }

  .score-summary__delta {
    color: rgba(255, 255, 255, 0.65);
  }

  .score-summary__delta.is-positive {
    color: #86efac;
  }

  .score-summary__delta.is-negative {
    color: #fca5a5;
  }

  .score-summary__bar {
    background: rgba(255, 255, 255, 0.12);
  }

  .metrics-stat__note,
  .metrics-stat__label,
  .metrics-panel__header span,
  .metrics-week article span,
  .metrics-bars__item span,
  .metrics-bars__item small,
  .metrics-week-days span {
    color: rgba(255, 255, 255, 0.55);
  }

  .metrics-stat,
  .metrics-panel {
    border-color: rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.03);
  }

  .metrics-bars__track,
  .metrics-progress,
  .metrics-week-days span {
    border-color: rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.06);
  }

  .metrics-week-days strong {
    color: rgba(255, 255, 255, 0.86);
  }
}

@media (max-width: 420px) {
  .score-summary__value {
    font-size: 1.4rem;
  }

  .metrics-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metrics-stat strong {
    font-size: 1.35rem;
  }

  .metrics-panel {
    padding: 0.75rem;
  }

  .metrics-panel__header {
    display: grid;
    gap: 0.25rem;
  }

  .metrics-panel__header span {
    text-align: left;
  }

  .metrics-bars {
    gap: 0.32rem;
    min-height: 12rem;
  }

  .metrics-bars__item {
    grid-template-rows: minmax(6rem, 1fr) auto auto auto;
  }

  .metrics-bars__track {
    min-height: 6rem;
  }

  .metrics-bars__item strong {
    font-size: 0.72rem;
  }

  .metrics-bars__item span {
    font-size: 0.54rem;
  }

  .metrics-bars__item small {
    display: none;
  }

  .metrics-week {
    grid-template-columns: 1fr;
  }

  .metrics-week-days {
    grid-template-columns: repeat(7, minmax(2rem, 1fr));
    gap: 0.2rem;
  }

  .metrics-week-days span {
    padding: 0.35rem 0.18rem;
    font-size: 0.5rem;
  }

  .metrics-week-days strong {
    font-size: 0.62rem;
  }
}

/* Clickable task title */
.task-title.link {
  color: inherit;
  text-decoration: none;
}
.task-title.link:hover {
  text-decoration: underline;
}

/* Points badge — colour-tiered pill, no "pts" label */
.task-pts {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.7rem;
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  font-size: 0.72rem;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  /* Neutral gray pill; magnitude is conveyed by weight/contrast, not colour. */
  background: rgba(0, 0, 0, 0.05);
}
/* Higher scores read very slightly heavier and darker — extremely subtle. */
.task-pts--t1 { color: rgba(0, 0, 0, 0.45); font-weight: 500; }
.task-pts--t2 { color: rgba(0, 0, 0, 0.52); font-weight: 500; }
.task-pts--t3 { color: rgba(0, 0, 0, 0.62); font-weight: 600; }
.task-pts--t4 { color: rgba(0, 0, 0, 0.72); font-weight: 600; }
.task-pts--t5 { color: rgba(0, 0, 0, 0.85); font-weight: 700; }

/* Estimated (active) scores read as provisional: a touch lighter. */
.task-pts--estimate { background: transparent; opacity: 0.9; }

/* In the list's score column the number stands alone (with a "pts" unit). */
.task-score .task-pts {
  min-width: 0;
  padding: 0;
  background: transparent;
  font-size: 1rem;
  line-height: 1;
}

/* Still being scored: same pill, ellipsis placeholder. */
.task-pts--pending {
  color: rgba(0, 0, 0, 0.35);
  font-weight: 500;
  letter-spacing: 0.05em;
}

@media (prefers-color-scheme: dark) {
  .task-pts { background: rgba(255, 255, 255, 0.08); }
  .task-pts--t1 { color: rgba(255, 255, 255, 0.45); }
  .task-pts--t2 { color: rgba(255, 255, 255, 0.55); }
  .task-pts--t3 { color: rgba(255, 255, 255, 0.65); }
  .task-pts--t4 { color: rgba(255, 255, 255, 0.78); }
  .task-pts--t5 { color: rgba(255, 255, 255, 0.92); }
  .task-pts--estimate { background: transparent; }
  .task-pts--pending { color: rgba(255, 255, 255, 0.4); }
}

/* Detail pane */
.task-detail-chip {
  display: inline-flex;
  align-items: center;
}
.task-detail-description {
  word-break: break-word;
}
.task-detail-description p { margin: 0 0 0.5rem; }

/* Difficulty meter */
.task-meter__label { width: 6.5rem; flex-shrink: 0; }
.task-meter__bar {
  flex: 1;
  height: 0.4rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.08);
  overflow: hidden;
}
.task-meter__fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--color-primary);
}
.task-meter__value { width: 2.2rem; text-align: right; flex-shrink: 0; }

@media (prefers-color-scheme: dark) {
  .task-meter__bar { background: rgba(255, 255, 255, 0.12); }
}

.task-friction-chip { text-transform: capitalize; }

@media (max-width: 640px) {
  .task-title {
    overflow-wrap: anywhere;
  }

  .task-meter {
    align-items: stretch;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.25rem 0.5rem;
  }

  .task-meter__label {
    width: auto;
  }

  .task-meter__bar {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .task-meter__value {
    width: auto;
  }

  .task-score-feedback {
    flex-wrap: wrap;
  }

  .task-score-feedback form {
    flex: 1 1 7rem;
    min-width: 0;
  }

  .task-score-feedback .button {
    width: 100%;
    padding-left: 0.55rem;
    padding-right: 0.55rem;
  }
}

/* Tasks toolbar — groups the filter control with its active state */
.tasks-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.tasks-toolbar__filters {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  min-width: 0;
}

.tasks-toolbar__add {
  flex-shrink: 0;
}

/* Filter panel */
.filters-panel {
  animation: slideDown 0.15s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Filter chips - same as .tag but with readable colors */
.filter-chip {
  border: 1px solid transparent;
  font-size: 0.6rem;
  display: inline-flex;
  align-items: center;
  background-color: #555;
  color: white;
  padding: 0.2rem 0.4rem;
  text-transform: uppercase;
  font-weight: 500;
  white-space: nowrap;
  letter-spacing: 0;
  border-radius: var(--tag-radius);
  text-decoration: none;
}

.filter-chip:hover {
  background-color: #333;
  color: white;
}

@media (prefers-color-scheme: dark) {
  .filter-chip {
    background-color: #888;
  }
  .filter-chip:hover {
    background-color: #aaa;
  }
}

/* Primary color for icons */
i.primary {
  color: var(--color-primary);
}

/* Contribution grid */
.contrib-grid {
  display: flex;
}
.contrib-grid .week { display: flex; flex-direction: column; margin-right: 4px; }
.contrib-grid .month-gap { width: 8px; }
.contrib-grid .day  {
  width: 12px;
  height: 12px;
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 2px;
  margin-bottom: 4px;
}
.contrib-grid .lvl-0 { background: transparent; }
.contrib-grid .lvl-1 { background: rgba(255, 99, 0, 0.2); }
.contrib-grid .lvl-2 { background: rgba(255, 99, 0, 0.4); }
.contrib-grid .lvl-3 { background: rgba(255, 99, 0, 0.6); }
.contrib-grid .lvl-4 { background: rgba(255, 99, 0, 0.9); }

/* Future days in the current month: draw but mute visually */
.contrib-grid .day.is-future {
  background: rgba(0, 0, 0, 0.06);
  border-color: rgba(0, 0, 0, 0.08);
}
@media (prefers-color-scheme: dark) {
  .contrib-grid .day.is-future {
    background: rgba(255, 255, 255, 0.10);
    border-color: rgba(255, 255, 255, 0.14);
  }
}

/* ASCII plant — a winding vine that grows as the week progresses */
.trellis {
  font-family: var(--font-stack-monospace);
  font-size: 13px;
  line-height: 1;
  letter-spacing: 1px;
  margin: 0;
  white-space: pre;
  display: inline-block;
  text-align: left;
  color: rgba(0, 0, 0, 0.18);
}
.trellis .t-ground { color: rgba(120, 72, 40, 0.55); }
.trellis .t-stem   { color: #2f6b4f; font-weight: 600; }
.trellis .t-leaf   { color: #4f9b6f; }
.trellis .t-flower { color: #ff6300; font-weight: 700; }

/* Fixed vine on the landing page, rooted at the bottom */
.trellis-fixed {
  position: fixed;
  left: max(4px, env(safe-area-inset-left));
  bottom: max(0px, env(safe-area-inset-bottom));
  z-index: 1;
  pointer-events: none;
}

@media (max-width: 900px) {
  .trellis-fixed { left: max(2px, env(safe-area-inset-left)); }
  .trellis { font-size: 11px; }
}

@media (max-height: 560px) {
  .trellis { font-size: 10px; }
}

@media (max-height: 400px) {
  .trellis { font-size: 8px; }
}

@media (prefers-color-scheme: dark) {
  .trellis           { color: rgba(255, 255, 255, 0.18); }
  .trellis .t-ground { color: rgba(180, 130, 90, 0.6); }
  .trellis .t-stem   { color: #6fbf8f; }
  .trellis .t-leaf   { color: #8fd4a8; }
  .trellis .t-flower { color: #ff8a3d; }
}

/* Simple spin animation for pending indicators */
.spin {
  display: inline-block;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Preserve line breaks and wrap text */
.pre-line {
  white-space: pre-line;
}

/* Journal entry obfuscation with Flow Block font */
.journal-obfuscated {
  font-family: 'Flow Block', cursive;
  font-size: 1em;
  line-height: 1.5;
  opacity: 0.6;
  transition: font-family 0.3s ease, opacity 0.3s ease;
  cursor: pointer;
  display: block;
  width: 100%;
  height: 1.5em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Make entire journal entry row trigger the reveal */
tr:hover .journal-obfuscated {
  font-family: var(--font-stack-sans-serif);
  font-size: 1em;
  line-height: 1.5;
  opacity: 1;
  height: 1.5em;
  white-space: nowrap;
  text-overflow: ellipsis;
}
