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

/* Reset form elements for iOS */
button, input, select, textarea {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    border-radius: 0;
}

:root {
    --black: #000;
    --white: #fff;
    --gray-100: #f5f5f5;
    --gray-200: #e5e5e5;
    --gray-400: #a3a3a3;
    --gray-500: #737373;
    --gray-600: #525252;
    --gray-800: #262626;
    --gray-900: #171717;
    --red: #dc2626;
}

html, body {
    background: var(--black);
    color: var(--white);
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', system-ui, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

/* Header - fixed, minimal */
header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    height: 48px;
    background: var(--black);
    border-bottom: 1px solid var(--gray-900);
}

.logo {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

nav {
    display: flex;
    align-items: center;
    gap: 20px;
    font-size: 13px;
}

.username {
    color: var(--gray-500);
}

.btn-link {
    color: var(--gray-500);
}

.btn-link:hover {
    color: var(--white);
}

/* Main content */
main {
    padding: 72px 24px 48px;
    max-width: 1080px;
    margin: 0 auto;
}

/* Buttons - minimal, no rounding */
button, .btn, input[type="submit"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 32px;
    padding: 0 12px;
    background: var(--white);
    color: var(--black);
    border: none;
    border-radius: 0 !important;
    -webkit-border-radius: 0 !important;
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    letter-spacing: 0.3px;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
}

button:hover, .btn:hover {
    background: var(--gray-200);
}

.btn-outline {
    background: transparent;
    color: var(--white);
    border: 1px solid var(--gray-800);
}

.btn-outline:hover {
    border-color: var(--gray-600);
}

.btn-text {
    background: transparent;
    color: var(--gray-500);
    padding: 0 8px;
    height: auto;
}

.btn-text:hover {
    color: var(--white);
}

.btn-danger {
    color: var(--red);
}

/* Inputs */
input {
    height: 32px;
    padding: 0 10px;
    background: transparent;
    border: 1px solid var(--gray-800);
    border-radius: 0;
    color: var(--white);
    font-family: inherit;
    font-size: 13px;
    -webkit-appearance: none;
    appearance: none;
}

input:focus {
    outline: none;
    border-color: var(--gray-600);
}

input::placeholder {
    color: var(--gray-600);
}

/* Auth */
.auth-container {
    max-width: 280px;
    margin: 100px auto 0;
}

.auth-container h1 {
    font-size: 20px;
    font-weight: 500;
    margin-bottom: 32px;
}

.auth-container form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-container input {
    height: 40px;
}

.auth-container .btn {
    height: 40px;
    margin-top: 8px;
}

.error {
    color: var(--red);
    font-size: 12px;
    margin-bottom: 16px;
}

.hint {
    color: var(--gray-600);
    margin-top: 24px;
    font-size: 12px;
}

/* Projects page */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.page-header h1 {
    font-size: 16px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.new-project-form {
    display: flex;
    gap: 8px;
}

.new-project-form input {
    width: 160px;
}

/* Project grid */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.project-card {
    background: var(--black);
    border: 1px solid var(--gray-900);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.project-card:hover {
    border-color: var(--gray-800);
}

.project-screenshot {
    aspect-ratio: 16/9;
    background: var(--gray-900);
    overflow: hidden;
}

.project-screenshot img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.9;
}

.project-card:hover .project-screenshot img {
    opacity: 1;
}

.no-screenshot {
    width: 100%;
    height: 100%;
}

.project-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.project-name {
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-indicator {
    width: 6px;
    height: 6px;
    background: var(--gray-600);
}

.status-indicator.running {
    background: #22c55e;
}

.status-indicator.kicking {
    background: #f97316;
}

.project-meta {
    font-size: 11px;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.last-check {
    color: var(--gray-600);
}

.project-card {
    position: relative;
}

.edit-btn {
    position: absolute;
    bottom: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-400);
    background: rgba(0,0,0,0.7);
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 10;
}

.project-card:hover .edit-btn {
    opacity: 1;
}

.edit-btn:hover {
    color: var(--white);
}

.context-menu {
    display: none;
    position: absolute;
    background: var(--gray-900);
    border: 1px solid var(--gray-800);
    z-index: 1000;
    min-width: 100px;
}

.context-item {
    padding: 8px 12px;
    font-size: 12px;
    cursor: pointer;
    color: var(--gray-400);
}

.context-item:hover {
    background: var(--gray-800);
    color: var(--white);
}

.empty-state {
    color: var(--gray-600);
    text-align: center;
    padding: 80px 0;
    font-size: 13px;
}

/* Project detail */
.project-detail {
    max-width: 900px;
    margin: 0 auto;
}

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--gray-900);
}

.detail-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.detail-title h1 {
    font-size: 16px;
    font-weight: 500;
}

.detail-actions {
    display: flex;
    gap: 8px;
}

/* Meta row */
.meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px 32px;
    margin-bottom: 24px;
    font-size: 12px;
}

.meta-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.meta-label {
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 10px;
}

.meta-value {
    color: var(--white);
    word-break: break-all;
}

.meta-value.clickable {
    cursor: pointer;
}

.meta-value.clickable:hover {
    text-decoration: underline;
}

/* Toggle switch */
.toggle-switch {
    cursor: pointer;
    display: flex;
    gap: 4px;
}

.toggle-switch span {
    color: var(--gray-600);
}

.toggle-switch span.active {
    color: var(--white);
}

.toggle-switch .toggle-sep {
    color: var(--gray-800);
}

.toggle-switch:hover span:not(.toggle-sep) {
    color: var(--gray-400);
}

.toggle-switch:hover span.active {
    color: var(--white);
}

.meta-value.active {
    color: var(--white);
}

.meta-actions {
    margin-left: auto;
    display: flex;
    gap: 16px;
}

/* Terminal */
.terminal-section {
    border: 1px solid var(--gray-900);
}

.terminal-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1px solid var(--gray-900);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-500);
}

.terminal-bar a {
    color: var(--gray-600);
}

.terminal-bar a:hover {
    color: var(--white);
}

.terminal-iframe {
    width: 100%;
    height: 500px;
    border: none;
    display: block;
    background: var(--black);
}

.terminal-placeholder {
    height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    color: var(--gray-600);
    font-size: 12px;
}

/* Mobile */
@media (max-width: 480px) {
    main {
        padding: 60px 16px 32px;
    }

    header {
        padding: 0 16px;
    }

    .detail-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .meta-row {
        gap: 12px 20px;
    }

    .meta-actions {
        margin-left: 0;
        margin-top: 8px;
        width: 100%;
    }
}
