*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'DM Mono', monospace;
  background: #0e0e0e;
  color: #e8e8e8;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 4rem 2rem 7rem;
}
.tb-wrap { max-width: 720px; width: 100%; }
.tb-logo {
  font-family: 'Syne', sans-serif;
  font-size: 80px;
  letter-spacing: 4px;
  line-height: 1;
}
.tb-logo span { color: #e24b4a; }
.tool-card {
  position: relative;
  overflow: hidden;
}
.tool-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: var(--card-bg);
  background-size: cover;
  background-position: center;
  filter: blur(4px) brightness(0.65);
  z-index: 0;
  transform: scale(1.05);
}

.tool-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.2) 0%,
    rgba(0, 0, 0, 0.6) 100%
  );
  z-index: 1;
}

.tool-card > * {
  position: relative;
  z-index: 2;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}
.tb-sub {
  font-size: 13px;
  color: #555;
  margin-top: 8px;
  letter-spacing: 0.06em;
  line-height: 1.7;
  margin-bottom: 2.5rem;
  border-left: 2px solid #222;
  padding-left: 10px;
}
.field { margin-bottom: 1.4rem; }
.field label {
  display: block;
  font-size: 12px;
  letter-spacing: 0.12em;
  color: #555;
  margin-bottom: 7px;
  text-transform: uppercase;
}
.field textarea,
.field input[type="text"],
.field input[type="datetime-local"] {
  width: 100%;
  background: #141414;
  border: 0.5px solid #2a2a2a;
  border-radius: 6px;
  padding: 13px 15px;
  font-family: 'DM Mono', monospace;
  font-size: 15px;
  color: #e8e8e8;
  resize: vertical;
  outline: none;
  transition: border-color 0.15s;
  caret-color: #e24b4a;
}
.field textarea:focus,
.field input:focus { border-color: #444; }
.field textarea::placeholder,
.field input::placeholder { color: #333; }
.condition-label {
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #555;
  margin-bottom: 10px;
}
.condition-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 1.4rem;
}
.field-hint {
  font-size: 11px;
  color: #444;
  margin-top: 6px;
  letter-spacing: 0.04em;
  line-height: 1.6;
}
.tab-btn {
  flex: 1;
  padding: 10px;
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  letter-spacing: 0.06em;
  border: 0.5px solid #2a2a2a;
  border-radius: 6px;
  background: transparent;
  color: #555;
  cursor: pointer;
  transition: all 0.15s;
}
.tab-btn.active {
  background: #1e0e0e;
  border-color: #e24b4a33;
  color: #e24b4a;
}
.tab-btn:not(.active):hover { color: #888; border-color: #444; }
.condition-panel { display: none; }
.condition-panel.active { display: block; }
.divider {
  border: none;
  border-top: 0.5px solid #1e1e1e;
  margin: 1.5rem 0;
}
.submit-btn {
  width: 100%;
  padding: 14px;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 22px;
  letter-spacing: 3px;
  background: #e8e8e8;
  color: #0e0e0e;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}
.submit-btn:hover { opacity: 0.9; }
.submit-btn:active { opacity: 0.7; transform: scale(0.995); }
.output-box {
  display: none;
  margin-top: 1.25rem;
  background: #141414;
  border: 0.5px solid #2a2a2a;
  border-radius: 6px;
  padding: 0.9rem 1.1rem;
}
.output-box.visible { display: block; }
.output-label {
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #444;
  margin-bottom: 8px;
}
.output-url {
  font-size: 14px;
  color: #6ab0e8;
  word-break: break-all;
  cursor: pointer;
  text-underline-offset: 3px;
}
.copy-hint {
  font-size: 12px;
  color: #444;
  margin-top: 6px;
  letter-spacing: 0.05em;
}
.history-btn {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: #111;
  color: #555;
  border: 0.5px solid #2a2a2a;
  border-radius: 6px;
  padding: 7px 13px;
  cursor: pointer;
  transition: all 0.15s;
}
.history-btn:hover { color: #e8e8e8; border-color: #444; }
.drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 99;
}
.drawer-overlay.open { display: block; }
.tb-drawer {
  position: fixed;
  top: 0; right: 0;
  height: 100vh;
  width: 420px;
  background: #0e0e0e;
  border-left: 0.5px solid #1e1e1e;
  z-index: 100;
  transform: translateX(100%);
  transition: transform 0.2s ease;
  display: flex;
  flex-direction: column;
}
.tb-drawer.open { transform: translateX(0); }
.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.1rem 1.1rem 0.9rem;
  border-bottom: 0.5px solid #1e1e1e;
}
.drawer-title {
  font-family: 'Syne', sans-serif;
  font-size: 26px;
  letter-spacing: 0.1px;
  color: #e8e8e8;
}
.drawer-clear {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.05em;
  background: transparent;
  color: #555;
  border: 0.5px solid #2a2a2a;
  border-radius: 5px;
  padding: 4px 9px;
  cursor: pointer;
  transition: all 0.15s;
}
.drawer-clear:hover { color: #e24b4a; border-color: #e24b4a33; background: #1e0e0e; }
.drawer-close {
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  background: transparent;
  color: #444;
  border: 0.5px solid #2a2a2a;
  border-radius: 5px;
  padding: 4px 9px;
  cursor: pointer;
  transition: all 0.15s;
}
.drawer-close:hover { color: #e8e8e8; border-color: #444; }
.drawer-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scrollbar-width: thin;
  scrollbar-color: #222 transparent;
}
.drawer-empty {
  font-size: 11px;
  color: #333;
  text-align: center;
  margin-top: 3rem;
  letter-spacing: 0.06em;
}
.tb-card {
  background: #111;
  border: 0.5px solid #1e1e1e;
  border-radius: 6px;
  padding: 11px 13px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.card-msg {
  font-size: 14px;
  color: #ccc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1;
}
.card-top-right {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}
.card-status {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 3px;
  white-space: nowrap;
}
.status-pending { background: #191300; color: #EF9F27; border: 0.5px solid #EF9F2733; }
.status-active  { background: #091610; color: #5DCAA5; border: 0.5px solid #5DCAA533; }
.card-delete {
  font-size: 9px;
  background: transparent;
  color: #333;
  border: 0.5px solid #2a2a2a;
  border-radius: 3px;
  padding: 2px 6px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: 'DM Mono', monospace;
  line-height: 1.6;
}
.card-delete:hover { color: #e24b4a; border-color: #e24b4a33; background: #1e0e0e; }
.card-id {
  font-size: 10px;
  color: #333;
  letter-spacing: 0.06em;
}
.card-meta {
  display: flex;
  gap: 8px;
  align-items: baseline;
  min-width: 0;
}
.card-meta-label {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #444;
  min-width: 64px;
  flex-shrink: 0;
}
.card-meta-val {
  font-size: 12px;
  color: #666;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.card-url {
  font-size: 12px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-deleting {
  opacity: 0.4;
  pointer-events: none;
  transition: opacity 0.2s;
}
.drawer-key-section {
  border-bottom: 0.5px solid #1e1e1e;
  padding: 0.85rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.drawer-key-label {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #444;
  margin-bottom: 5px;
}
.drawer-key-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.drawer-key-val {
  font-size: 12px;
  color: #555;
  letter-spacing: 0.04em;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.drawer-key-copy {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.05em;
  background: transparent;
  color: #555;
  border: 0.5px solid #2a2a2a;
  border-radius: 4px;
  padding: 3px 8px;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}
.drawer-key-copy:hover { color: #6ab0e8; border-color: #6ab0e833; background: #0d1a26; }
.drawer-key-switch {
  display: flex;
  gap: 6px;
}
.drawer-key-switch input {
  flex: 1;
  background: #141414;
  border: 0.5px solid #2a2a2a;
  border-radius: 5px;
  padding: 7px 10px;
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  color: #e8e8e8;
  outline: none;
  transition: border-color 0.15s;
  caret-color: #e24b4a;
}
.drawer-key-switch input:focus { border-color: #444; }
.drawer-key-switch input::placeholder { color: #333; }
#drawer-key-submit {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.06em;
  background: transparent;
  color: #555;
  border: 0.5px solid #2a2a2a;
  border-radius: 5px;
  padding: 7px 12px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
#drawer-key-submit:hover { color: #5DCAA5; border-color: #5DCAA533; background: #091610; }

/* ── subtitle link colors ── */
.link-tos     { color: #358162; text-decoration: none; }
.link-contact { color: #5b69e9; text-decoration: none; }
.link-tools   { color: #ff6565; text-decoration: none; cursor: pointer; }
.link-tos:hover, .link-contact:hover, .link-tools:hover { text-decoration: underline; }

/* ── view transitions ── */
.view {
  transition: opacity 0.3s ease;
}
.view.hidden {
  display: none;
}

/* ── other tools grid ── */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 3rem;
}
.tool-card {
  background: #111;
  border: 0.5px solid #1e1e1e;
  border-radius: 6px;
  padding: 18px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, background 0.15s;
  cursor: pointer;
}
.tool-card:hover { border-color: #333; background: #141414; }
.tool-card:hover .card-arrow { color: #e8e8e8; }
.card-top-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.card-tag {
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 3px;
}
.tag-tool    { background: #091610; color: #5DCAA5; border: 0.5px solid #5DCAA533; }
.tag-partner { background: #0d1a26; color: #6ab0e8; border: 0.5px solid #6ab0e833; }
.tag-wip     { background: #191300; color: #EF9F27; border: 0.5px solid #EF9F2733; }
.card-arrow {
  font-size: 14px;
  color: #2a2a2a;
  transition: color 0.15s;
  line-height: 1;
}
.card-name {
  font-family: 'Syne', sans-serif;
  font-size: 20px;
  font-weight: 500;
  letter-spacing: 0.5px;
  line-height: 1;
  color: #e8e8e8;
}
.card-desc {
  font-size: 12px;
  color: #9e9e9e;
  line-height: 1.65;
  letter-spacing: 0.04em;
}
.card-url-ext {
  font-size: 11px;
  color: #5c5c5c;
  letter-spacing: 0.04em;
  margin-top: 4px;
}

@media (max-width: 600px) {
  body {
    padding: 2rem 1rem 5rem;
  }
  .tb-logo {
    font-size: 52px;
    letter-spacing: 2px;
  }
  .tb-sub {
    font-size: 11px;
    margin-bottom: 1.8rem;
  }
  .field label {
    font-size: 10px;
  }
  .field textarea,
  .field input[type="text"],
  .field input[type="datetime-local"] {
    font-size: 14px;
    padding: 11px 13px;
  }
  .condition-label {
    font-size: 10px;
  }
  .tab-btn {
    font-size: 11px;
    padding: 9px 6px;
  }
  .submit-btn {
    font-size: 18px;
    padding: 12px;
  }
  .output-url {
    font-size: 12px;
  }
  .history-btn {
    top: auto;
    bottom: 1.25rem;
    right: 1rem;
    font-size: 12px;
    padding: 8px 14px;
  }
  .tb-drawer {
    width: 100%;
  }
  .card-msg {
    font-size: 13px;
  }
  .card-meta-val {
    font-size: 11px;
  }
  .tools-grid {
    grid-template-columns: 1fr;
  }
}

a:visited {
  color: #e86a6a;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: #e86a6a30;
}

/* ── Edit button on card ── */
.card-edit {
  font-size: 11px;
  background: transparent;
  color: #444;
  border: 0.5px solid #2a2a2a;
  border-radius: 3px;
  padding: 2px 6px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: 'DM Mono', monospace;
  line-height: 1.6;
}
.card-edit:hover { color: #6ab0e8; border-color: #6ab0e833; background: #0d1a26; }

/* ── Card clickable cue ── */
.tb-card { cursor: pointer; }
.tb-card:hover { border-color: #333 !important; background: #131313; }

/* ── Edit modal overlay ── */
.edit-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 200;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 3rem 1rem 3rem;
  overflow-y: auto;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.edit-modal-overlay.edit-modal-in  { opacity: 1; }
.edit-modal-overlay.edit-modal-out { opacity: 0; }

.edit-modal {
  background: #0e0e0e;
  border: 0.5px solid var(--modal-border, #2a2a2a);
  border-top: 2px solid var(--modal-accent, #e24b4a);
  border-radius: 8px;
  width: 100%;
  max-width: 600px;
  transform: translateY(16px);
  transition: transform 0.25s ease;
}
.edit-modal-overlay.edit-modal-in .edit-modal { transform: translateY(0); }

.edit-modal-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 1rem 1.1rem 0.85rem;
  border-bottom: 0.5px solid #1e1e1e;
}
.edit-modal-title {
  font-family: 'Syne', sans-serif;
  font-size: 22px;
  color: #e8e8e8;
  flex: 1;
}
.edit-modal-id {
  font-size: 11px;
  color: #444;
  letter-spacing: 0.08em;
  font-family: 'DM Mono', monospace;
}
.edit-modal-close {
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  background: transparent;
  color: #444;
  border: 0.5px solid #2a2a2a;
  border-radius: 5px;
  padding: 4px 9px;
  cursor: pointer;
  transition: all 0.15s;
}
.edit-modal-close:hover { color: #e8e8e8; border-color: #444; }

.edit-modal-body {
  padding: 1.25rem 1.1rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.edit-modal-error {
  font-size: 12px;
  color: #e24b4a;
  letter-spacing: 0.04em;
  min-height: 1rem;
  margin-bottom: 0.75rem;
}

.edit-save-btn {
  background: var(--modal-accent, #e8e8e8);
  color: #0e0e0e;
}

@media (max-width: 600px) {
  .edit-modal-overlay { padding: 1rem 0.5rem; align-items: flex-end; }
  .edit-modal { border-radius: 10px 10px 0 0; max-width: 100%; }
}

/* ── Card clickable state ── */
.tb-card {
  cursor: pointer;
  transition: border-color 0.15s, background 0.12s;
}
.tb-card:hover {
  background: #161616;
}
.tb-card:hover .card-msg {
  color: #e8e8e8;
}

/* ── Edit modal ── */
.edit-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.edit-modal-overlay.edit-modal-in  { opacity: 1; }
.edit-modal-overlay.edit-modal-out { opacity: 0; }

.edit-modal {
  background: #0e0e0e;
  border: 0.5px solid var(--modal-border, #2a2a2a);
  border-top: 2px solid var(--modal-accent, #e24b4a);
  border-radius: 8px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #222 transparent;
  transform: translateY(12px);
  transition: transform 0.2s ease;
}
.edit-modal-overlay.edit-modal-in .edit-modal { transform: translateY(0); }

.edit-modal-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 1rem 1.1rem 0.85rem;
  border-bottom: 0.5px solid #1e1e1e;
  position: sticky;
  top: 0;
  background: #0e0e0e;
  z-index: 1;
}
.edit-modal-title {
  font-family: 'Syne', sans-serif;
  font-size: 22px;
  color: #e8e8e8;
  flex: 1;
}
.edit-modal-id {
  font-size: 11px;
  color: #444;
  letter-spacing: 0.08em;
  font-family: 'DM Mono', monospace;
  background: #141414;
  border: 0.5px solid #222;
  padding: 2px 8px;
  border-radius: 4px;
}
.edit-modal-close {
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  background: transparent;
  color: #444;
  border: 0.5px solid #2a2a2a;
  border-radius: 5px;
  padding: 4px 9px;
  cursor: pointer;
  transition: all 0.15s;
}
.edit-modal-close:hover { color: #e8e8e8; border-color: #444; }

.edit-modal-body {
  padding: 1.1rem;
}

.edit-modal-error {
  font-size: 12px;
  color: #e24b4a;
  min-height: 18px;
  margin-bottom: 0.75rem;
  letter-spacing: 0.04em;
}

.edit-save-btn {
  background: var(--modal-accent, #e8e8e8);
  color: #0e0e0e;
}

@media (max-width: 600px) {
  .edit-modal-overlay { padding: 0; align-items: flex-end; }
  .edit-modal { border-radius: 10px 10px 0 0; max-height: 92vh; }
}