*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  min-height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  font-weight: 700;
  background: #fff;
  color: #000;
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
}

code,
.app-url,
.modal-url,
.card-url-line {
  font-family: "SF Mono", "Fira Code", "Cascadia Code", Consolas, monospace;
}

.topnav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  padding: 0 32px;
  border-bottom: 3px solid #000;
  background: #000;
  color: #fff;
}

.topnav-brand {
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-decoration: none;
}

.topnav-links {
  display: flex;
  flex: 1;
  gap: 32px;
  margin-left: 36px;
}

.topnav-links a {
  color: #fff;
  text-decoration: none;
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 4px 0;
}

.topnav-links a.active {
  border-bottom: 3px solid #ff3333;
}

.topnav-links a:hover {
  color: #ff3333;
}

.topnav-user {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #00cc66;
}

.sign-out-button,
.refresh-button,
.modal-close,
.modal-toggle,
.btn-link {
  border: 3px solid #000;
  background: #fff;
  color: #000;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  text-decoration: none;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.sign-out-button {
  border-color: #fff;
  background: #000;
  color: #fff;
}

.sign-out-button:hover,
.refresh-button:hover,
.modal-close:hover,
.modal-toggle:hover,
.btn-link:hover {
  background: #ff3333;
  border-color: #ff3333;
  color: #fff;
}

.modal-toggle.active {
  background: #00cc66;
  border-color: #00cc66;
  color: #000;
}

.user-main {
  padding: 40px 48px 48px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  margin-bottom: 24px;
}

.page-header h1 {
  font-size: 48px;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  line-height: 1;
}

.subtitle,
.page-subtitle {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 6px;
}

.back-link {
  display: inline-block;
  color: #ff3333;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  text-decoration: none;
  margin-bottom: 18px;
}

.search-bar {
  margin-bottom: 28px;
}

.search-bar input {
  width: 100%;
  padding: 16px 20px;
  font-size: 18px;
  font-weight: 700;
  border: 3px solid #000;
  background: #fff;
  color: #000;
  outline: none;
  letter-spacing: 0.03em;
}

.search-bar input:focus {
  background: #000;
  color: #fff;
}

.search-bar input::placeholder {
  color: #000;
  opacity: 0.3;
}

.app-grid,
.tab-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
}

.tab-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.app-card {
  border: 2px solid #000;
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  min-height: 280px;
  margin-right: -2px;
  margin-bottom: -2px;
  background: #fff;
  color: #000;
  cursor: pointer;
  text-align: left;
  text-decoration: none;
  transition: none;
}

.app-card:hover {
  background: #000;
  color: #fff;
  position: relative;
  z-index: 1;
}

.app-name {
  font-size: 28px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  line-height: 1.1;
  margin-bottom: 12px;
  overflow-wrap: anywhere;
}

.app-url {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  margin-bottom: 18px;
  word-break: break-all;
}

.card-detail-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-top: 2px solid currentColor;
  padding: 10px 0;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.card-detail-row strong {
  max-width: 55%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-url-line {
  font-size: 11px;
  line-height: 1.45;
  word-break: break-all;
  opacity: 0.7;
  margin-top: 6px;
}

.app-protocol {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding-top: 18px;
  border-top: 2px solid currentColor;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.15em;
}

.expires {
  margin-left: auto;
  opacity: 0.6;
  text-align: right;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #ff3333;
}

.status-running {
  background: #00cc66;
}

.status-stopped {
  background: #ff3333;
}

.launch-indicator {
  font-size: 32px;
  line-height: 1;
  margin-top: 8px;
  text-align: right;
}

.tab-card {
  appearance: none;
}

.tab-card-top {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge {
  display: inline-flex;
  align-items: center;
  border: 2px solid currentColor;
  padding: 4px 8px;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.badge-active {
  color: #00a656;
}

.badge-pinned {
  color: #ff3333;
}

.badge-loading {
  color: #d28a00;
}

.app-card:hover .badge {
  color: #fff;
}

.empty-state {
  border: 3px dashed #000;
  min-height: 240px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.empty-state strong {
  font-size: 24px;
  font-weight: 900;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  background: rgba(0, 0, 0, 0.72);
}

.tab-modal {
  width: min(1180px, 96vw);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  border: 3px solid #000;
  background: #fff;
  color: #000;
}

.modal-header,
.modal-footer {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 20px 24px;
  border-bottom: 3px solid #000;
}

.modal-header {
  align-items: flex-start;
}

.modal-header > div:first-child {
  flex: 1;
  min-width: 0;
}

.modal-footer {
  border-top: 3px solid #000;
  border-bottom: 0;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.modal-header h2 {
  font-size: 26px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
  overflow-wrap: anywhere;
}

.modal-actions {
  display: flex;
  flex-shrink: 0;
  gap: 10px;
  align-items: flex-start;
}

.modal-url {
  font-size: 12px;
  word-break: break-all;
  overflow-wrap: anywhere;
}

.screenshot-stage {
  position: relative;
  min-height: 360px;
  overflow: auto;
  background: #f4f4f4;
  display: flex;
  align-items: center;
  justify-content: center;
  outline: none;
}

.screenshot-stage.interactive {
  cursor: crosshair;
  box-shadow: inset 0 0 0 4px #00cc66;
}

.screenshot-stage.interactive:focus {
  box-shadow: inset 0 0 0 4px #00cc66, inset 0 0 0 8px #000;
}

.screenshot-stage img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: auto;
}

.screenshot-loading,
.screenshot-error {
  padding: 24px;
  font-size: 14px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.screenshot-error {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  z-index: 2;
  border: 3px solid #ff3333;
  background: #fff;
  color: #ff3333;
}

.auth-main {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.sign-in-container {
  width: 480px;
  max-width: 100%;
  border: 3px solid #000;
}

.sign-in-header {
  background: #000;
  color: #fff;
  padding: 40px 40px 32px;
  text-align: center;
}

.sign-in-header h1 {
  font-size: 48px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.sign-in-header p,
.sign-in-footer p {
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.sign-in-body {
  padding: 40px;
}

.form-group {
  margin-bottom: 24px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-bottom: 8px;
}

.form-group input {
  width: 100%;
  padding: 16px;
  font-size: 18px;
  font-weight: 700;
  border: 3px solid #000;
  background: #fff;
  color: #000;
  outline: none;
}

.form-group input:focus {
  background: #000;
  color: #fff;
}

.btn-sign-in {
  width: 100%;
  padding: 20px;
  font-size: 20px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  background: #000;
  color: #fff;
  border: 3px solid #000;
  cursor: pointer;
}

.btn-sign-in:hover {
  background: #ff3333;
  border-color: #ff3333;
}

.sign-in-footer {
  border-top: 3px solid #000;
  padding: 24px 40px;
  text-align: center;
}

.error-banner {
  border: 3px solid #ff3333;
  color: #ff3333;
  padding: 12px 14px;
  margin-bottom: 20px;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

@media (max-width: 1100px) {
  .app-grid,
  .tab-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .topnav {
    height: auto;
    min-height: 64px;
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
    padding: 18px;
  }

  .topnav-links,
  .topnav-user {
    margin-left: 0;
    width: 100%;
    justify-content: space-between;
  }

  .user-main {
    padding: 28px 20px;
  }

  .page-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .page-header h1 {
    font-size: 38px;
  }

  .app-grid,
  .tab-grid {
    grid-template-columns: 1fr;
  }

  .modal-backdrop {
    padding: 12px;
  }

  .modal-header,
  .modal-footer {
    flex-direction: column;
  }
}
