.app-shell {
  display: flex;
  min-height: calc(100vh - 3.25rem);
}

.site-header__inner {
  gap: 0.75rem;
}

.mobile-nav-button {
  display: none;
}

.sidebar-heading {
  align-items: center;
  border-bottom: 1px solid rgb(var(--c-border-subtle));
  color: rgb(var(--c-text-subtle));
  display: flex;
  font-size: 0.75rem;
  font-weight: 700;
  justify-content: space-between;
  letter-spacing: 0;
  margin-bottom: 0.75rem;
  padding: 0 0.5rem 0.75rem;
}

.sidebar-actions {
  align-items: center;
  display: flex;
  gap: 0.25rem;
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-link {
  align-items: center;
  border-radius: 0.375rem;
  color: rgb(var(--c-text-muted));
  display: flex;
  gap: 0.55rem;
  overflow: hidden;
  padding: 0.45rem 0.55rem;
  text-decoration: none;
}

.nav-link:hover {
  background: rgb(var(--c-surface-sunken));
  color: rgb(var(--c-text));
  text-decoration: none;
}

.nav-link__icon {
  display: inline-flex;
  flex-shrink: 0;
}

.nav-link__label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#scroll-to-top {
  bottom: 1.5rem;
  height: 2.75rem;
  opacity: 0;
  pointer-events: none;
  position: fixed;
  right: 1.5rem;
  transform: translateY(0.5rem);
  transition: opacity 0.2s, transform 0.2s, background 0.15s, color 0.15s, border-color 0.15s;
  width: 2.75rem;
  z-index: 30;
}

#scroll-to-top.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.main-content {
  flex: 1;
  min-width: 0;
  padding: 2.5rem 1.5rem 5rem;
}

/* No overflow:hidden — it would clip dropdown menus (e.g. the format select)
   that extend past the card. Pane corners are rounded individually instead. */
.tool-card {
  background: rgb(var(--c-surface-raised));
  border: 1px solid rgb(var(--c-border));
  border-radius: 0.5rem;
  margin: 0 auto;
  max-width: 64rem;
}

.tool-card--narrow {
  max-width: 34rem;
}

.tool-card--medium {
  max-width: 48rem;
}

.tool-card--wide {
  max-width: 72rem;
}

.tool-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(20rem, 0.9fr);
}

.tool-pane {
  min-width: 0;
  padding: 2rem;
}

.tool-pane + .tool-pane {
  background: rgb(var(--c-surface));
  border-left: 1px solid rgb(var(--c-border));
  border-bottom-right-radius: 0.5rem;
  border-top-right-radius: 0.5rem;
}

.page-title {
  color: rgb(var(--c-text-strong));
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.25;
  margin: 0 0 0.5rem;
}

.page-subtitle {
  color: rgb(var(--c-text-muted));
  font-size: 0.925rem;
  margin: 0 0 1.5rem;
}

.field-group {
  margin-top: 1.25rem;
}

.field-group:first-child {
  margin-top: 0;
}

.field-label {
  color: rgb(var(--c-text));
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.field-row {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field-inline {
  align-items: center;
  display: flex;
  gap: 0.5rem;
}

/* label-left / badge-right row that sits above a control */
.field-head {
  align-items: center;
  display: flex;
  gap: 0.5rem;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.field-head .field-label {
  margin-bottom: 0;
}

.field,
textarea.field,
select.field {
  width: 100%;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem;
  margin-top: 1rem;
}

/* The design-system .btn ships unpadded — only .btn--icon sizes itself. Pad the
   text buttons here, but exclude icon buttons so they keep their compact size. */
.btn:not(.btn--icon) {
  min-height: 2.35rem;
  padding: 0.55rem 0.85rem;
}

.btn--full {
  width: 100%;
}

.btn--danger {
  background: rgb(var(--c-danger));
  border-color: rgb(var(--c-danger));
  color: #fff;
}

.btn--danger:hover {
  background: rgb(var(--c-danger));
  border-color: rgb(var(--c-danger));
  color: #fff;
  filter: brightness(0.92);
}

.home-list {
  display: grid;
  gap: 0.75rem;
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 0;
}

.home-link {
  align-items: center;
  background: rgb(var(--c-surface));
  border: 1px solid rgb(var(--c-border));
  border-radius: 0.5rem;
  color: rgb(var(--c-text));
  display: flex;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  text-decoration: none;
}

.home-link:hover {
  border-color: rgb(var(--c-accent-border));
  color: rgb(var(--c-accent));
  text-decoration: none;
}

.home-link__icon {
  color: rgb(var(--c-text-muted));
  display: inline-flex;
  flex-shrink: 0;
  font-size: 1.2rem;
}

.home-link:hover .home-link__icon {
  color: rgb(var(--c-accent));
}

.ip-badge {
  align-items: center;
  background: rgb(var(--c-surface));
  border: 1px solid rgb(var(--c-border));
  border-radius: 9999px;
  color: rgb(var(--c-text-muted));
  display: inline-flex;
  gap: 0.5rem;
  margin-top: 1rem;
  max-width: 100%;
  min-width: 0;
  padding: 0.3rem 0.4rem 0.3rem 0.85rem;
  width: fit-content;
}

.ip-badge__label {
  color: rgb(var(--c-text-subtle));
  flex-shrink: 0;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.ip-badge__value {
  color: rgb(var(--c-text));
  font-size: 0.9rem;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ip-badge__copy {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 9999px;
  color: rgb(var(--c-text-muted));
  cursor: pointer;
  display: inline-flex;
  flex-shrink: 0;
  height: 1.75rem;
  justify-content: center;
  padding: 0;
  transition: background 0.15s, color 0.15s;
  width: 1.75rem;
}

.ip-badge__copy:hover {
  background: rgb(var(--c-surface-sunken));
  color: rgb(var(--c-text));
}

.ip-badge__copy.is-error {
  color: rgb(var(--c-danger));
}

.ip-badge__copy.is-error:hover {
  color: rgb(var(--c-danger));
}

.muted {
  color: rgb(var(--c-text-muted));
}

.subtle {
  color: rgb(var(--c-text-subtle));
}

.mono,
.tabular-nums {
  font-family: var(--font-mono);
}

.tabular-nums {
  font-variant-numeric: tabular-nums;
}

.text-encrypt-iter-input {
  width: 8rem;
}

.preview-panel,
.output-panel {
  background: rgb(var(--c-surface-raised));
  border: 1px solid rgb(var(--c-border));
  border-radius: 0.5rem;
  min-height: 18rem;
  padding: 1rem;
}

.preview-panel {
  align-items: center;
  display: flex;
  justify-content: center;
  text-align: center;
}

/* Stack overlapping states (placeholder + faded-out result) in one centered cell
   so whichever is visible stays dead-center instead of splitting a flex row.
   place-content centers the track itself; place-items centers within it. */
.preview-panel--stack {
  display: grid;
  place-content: center;
  place-items: center;
}

.preview-panel--stack > * {
  grid-area: 1 / 1;
}

.placeholder-box {
  align-items: center;
  border: 2px dashed rgb(var(--c-border));
  border-radius: 0.5rem;
  color: rgb(var(--c-text-subtle));
  display: flex;
  height: 12rem;
  justify-content: center;
  margin: 0 auto;
  width: 12rem;
}

.placeholder-box--sm {
  height: 7rem;
  width: 7rem;
}

.placeholder-box .icon {
  font-size: 2.75rem;
}

/* input with a trailing icon button (e.g. show/hide password) */
.input-affix {
  position: relative;
}

.input-affix .field {
  padding-right: 2.75rem;
  width: 100%;
}

.input-affix__btn {
  color: rgb(var(--c-text-muted));
  position: absolute;
  right: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
}

.alert {
  margin-top: 1rem;
}

.color-row {
  align-items: center;
  display: flex;
  gap: 0.625rem;
}

/* The swatch button is 2rem tall; match the hex code to the same height and
   center its text so the two line up exactly. display:block on the swatch drops
   the inline-block baseline gap that otherwise skews the picker box height. */
.color-row .cp-swatch {
  display: block;
}

.color-row code {
  align-items: center;
  display: inline-flex;
  height: 2rem;
}

.qr-frame {
  align-items: center;
  aspect-ratio: 1;
  display: flex;
  justify-content: center;
  max-width: 21rem;
  overflow: hidden;
  transition: opacity 0.2s, transform 0.2s;
  width: 100%;
}

.preview-frame {
  align-items: center;
  display: flex;
  justify-content: center;
  min-height: 18rem;
  overflow: hidden;
}

.preview-frame img {
  display: block;
  max-height: 100%;
  max-width: 100%;
  object-fit: contain;
}

.stopwatch-display {
  color: rgb(var(--c-text-strong));
  font-family: var(--font-mono);
  font-size: clamp(3rem, 8vw, 4.6rem);
  font-weight: 700;
  line-height: 1;
  margin: 2rem 0;
  text-align: center;
}

.stopwatch-display__sub {
  color: rgb(var(--c-text-subtle));
  font-size: 0.66em;
}

.lap-list {
  display: grid;
  gap: 0.5rem;
  list-style: none;
  margin: 0;
  max-height: 16rem;
  overflow: auto;
  padding: 0;
}

.lap-item {
  align-items: center;
  background: rgb(var(--c-surface));
  border: 1px solid rgb(var(--c-border));
  border-radius: 0.5rem;
  color: rgb(var(--c-text));
  display: flex;
  font-size: 0.875rem;
  font-weight: 600;
  justify-content: space-between;
  padding: 0.6rem 0.75rem;
}

.text-tool-area {
  min-height: 24rem;
}

.output-panel {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.7;
  overflow: auto;
  white-space: pre-wrap;
}

.table-wrap {
  max-width: 100%;
  overflow-x: auto;
}

.hidden,
[hidden] {
  display: none !important;
}

.flex {
  display: flex !important;
}

.opacity-0 {
  opacity: 0;
}

.opacity-100 {
  opacity: 1;
}

.scale-95 {
  transform: scale(0.95);
}

.scale-100 {
  transform: scale(1);
}

.pointer-events-none {
  pointer-events: none;
}

@media (max-width: 63.99rem) {
  .app-shell {
    display: block;
  }

  .mobile-nav-button {
    display: inline-flex;
  }

  .site-header__brand {
    flex: 1;
    min-width: 0;
  }

  .main-content {
    padding: 1.5rem 1rem 4rem;
  }

  .tool-grid {
    grid-template-columns: 1fr;
  }

  .tool-pane + .tool-pane {
    border-bottom-left-radius: 0.5rem;
    border-left: 0;
    border-top: 1px solid rgb(var(--c-border));
    border-top-right-radius: 0;
  }
}

@media (max-width: 40rem) {
  .field-row {
    grid-template-columns: 1fr;
  }

  .tool-pane {
    padding: 1.25rem;
  }
}
