:root {
  --bg: #f5f8fd;
  --surface: #ffffff;
  --surface-alt: #eef4fb;
  --text: #272829;
  --text-muted: #6c7a89;
  --heading: #173b6c;
  --accent: #149ddd;
  --accent-hover: #37b3ed;
  --accent-soft: #e4f3fb;
  --border: #dde6f0;
  --shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
  --success: #2e9e5b;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1320;
  --surface: #101b2c;
  --surface-alt: #16263d;
  --text: #c9d1d9;
  --text-muted: #8b98a8;
  --heading: #e6edf3;
  --accent: #37b3ed;
  --accent-hover: #6cc8f2;
  --accent-soft: #16263d;
  --border: #1f3350;
  --shadow: 0 2px 15px rgba(0, 0, 0, 0.4);
  --success: #4cc685;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Open Sans", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: var(--accent-hover);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Top bar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #040b14;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: "Poppins", sans-serif;
  font-weight: 500;
  color: #fff;
}

.back-link:hover {
  color: #37b3ed;
}

.theme-toggle {
  border: 0;
  font-size: 18px;
  background-color: #149ddd;
  color: #fff;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50px;
  cursor: pointer;
  transition: background-color 0.3s;
}

.theme-toggle:hover {
  background-color: #2eafec;
}

.theme-toggle .bi-sun,
[data-theme="dark"] .theme-toggle .bi-moon-stars {
  display: none;
}

[data-theme="dark"] .theme-toggle .bi-sun {
  display: inline;
}

/* Layout */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 16px;
}

.page-title {
  text-align: center;
  padding: 40px 0 24px;
}

.page-title h1 {
  font-family: "Raleway", sans-serif;
  font-size: 32px;
  font-weight: 700;
  color: var(--heading);
  margin: 0 0 20px;
  padding-bottom: 20px;
  position: relative;
}

.page-title h1::after {
  content: "";
  position: absolute;
  width: 50px;
  height: 3px;
  background: var(--accent);
  bottom: 0;
  left: calc(50% - 25px);
}

.page-title p {
  margin: 0 0 8px;
}

.page-title .privacy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--text-muted);
}

/* Input */
.input-card {
  background: var(--surface);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 24px;
}

.input-card label {
  display: block;
  font-family: "Poppins", sans-serif;
  font-weight: 600;
  color: var(--heading);
  margin-bottom: 8px;
}

.input-card textarea {
  width: 100%;
  resize: vertical;
  min-height: 90px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 15px;
}

.input-card textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(20, 157, 221, 0.2);
}

.input-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}

.input-info {
  font-size: 14px;
  color: var(--text-muted);
}

.buttons {
  display: flex;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  border-radius: 50px;
  padding: 9px 22px;
  font-family: "Poppins", sans-serif;
  font-weight: 500;
  font-size: 15px;
  cursor: pointer;
  transition: background-color 0.3s, color 0.3s;
}

.btn-primary {
  background: #149ddd;
  color: #fff;
}

.btn-primary:hover {
  background: #2eafec;
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: wait;
}

.btn-secondary {
  background: var(--accent-soft);
  color: var(--accent);
}

.btn-secondary:hover {
  background: var(--border);
}

[data-theme="dark"] .btn-secondary {
  background: #1f3350;
  color: #e6edf3;
}

[data-theme="dark"] .btn-secondary:hover {
  background: #2a4468;
}

.hint {
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}

kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  padding: 1px 6px;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--surface-alt);
  color: var(--text);
}

/* Results table */
.table-wrapper {
  background: var(--surface);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 32px;
}

.hash-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.hash-table thead th {
  text-align: left;
  font-family: "Poppins", sans-serif;
  font-weight: 600;
  color: #fff;
  background: #149ddd;
  padding: 12px 14px;
  white-space: nowrap;
}

[data-theme="dark"] .hash-table thead th {
  background: #0e6e9c;
}

.hash-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.hash-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  width: 1%;
}

.hash-table .group-row th {
  text-align: left;
  font-family: "Poppins", sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--surface-alt);
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
}

.hash-table .algo {
  font-weight: 600;
  color: var(--heading);
  white-space: nowrap;
  width: 1%;
}

.hash-table .note {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 8px;
  border-radius: 50px;
  font-size: 11px;
  font-weight: 600;
  background: var(--accent-soft);
  color: var(--accent);
}

.hash-table .hash code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  color: var(--text);
  word-break: break-all;
}

.hash-table .hash code.empty {
  color: var(--text-muted);
}

.hash-table .copy {
  width: 1%;
  text-align: right;
}

.copy-btn {
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 16px;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  cursor: pointer;
}

.copy-btn:hover:not(:disabled) {
  background: var(--accent-soft);
}

.copy-btn:disabled {
  color: var(--border);
  cursor: default;
}

.copy-btn.copied {
  color: var(--success);
}

.hash-row:hover td {
  background: var(--surface-alt);
}

/* Small screens: each hash becomes a two-line block */
@media (max-width: 720px) {
  .hash-table thead {
    display: none;
  }

  .hash-table,
  .hash-table tbody {
    display: block;
  }

  .hash-table .group-row {
    display: block;
  }

  .hash-table .group-row th {
    display: block;
  }

  .hash-table .hash-row {
    display: grid;
    grid-template-columns: auto auto 1fr auto;
    grid-template-areas:
      "algo bits chars copy"
      "hash hash hash hash";
    align-items: center;
    column-gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
  }

  .hash-table .hash-row td {
    display: block;
    width: auto;
    padding: 0;
    border: 0;
    background: transparent;
  }

  .hash-table .algo { grid-area: algo; }
  .hash-table .hash-row td:nth-child(2) { grid-area: bits; }
  .hash-table .hash-row td:nth-child(3) { grid-area: chars; }
  .hash-table .hash { grid-area: hash; padding-top: 4px !important; }
  .hash-table .copy { grid-area: copy; }

  .hash-table .num {
    text-align: left;
    font-size: 12px;
    color: var(--text-muted);
  }

  .hash-table .num::after {
    content: " " attr(data-label);
  }
}

.footer {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  padding: 0 16px 32px;
}
