/* ===== リセット & ベース ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* 独自カラーパレット */
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --accent: #f59e0b;
    --success: #10b981;
    --error: #ef4444;
    
    /* ニュートラル */
    --gray-50: #fafafa;
    --gray-100: #f5f5f5;
    --gray-200: #e5e5e5;
    --gray-300: #d4d4d4;
    --gray-600: #525252;
    --gray-900: #171717;
    
    /* タイポグラフィ */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    
    /* スペーシング */
    --space-xs: 0.5rem;
    --space-sm: 0.75rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    
    /* ボーダーラディウス */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    
    /* シャドウ */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --shadow-glow: 0 0 0 3px rgb(99 102 241 / 0.1);
}

body {
    font-family: var(--font-family);
    background: linear-gradient(135deg, var(--gray-50) 0%, #ffffff 100%);
    color: var(--gray-900);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===== レイアウト ===== */
.container {
    max-width: 100%;
    margin: 0 auto;
    padding: var(--space-md);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== ヘッダー ===== */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-lg) 0;
    margin-bottom: var(--space-xl);
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    text-decoration: none;
    color: inherit;
}

.logo-icon {
    width: 32px;
    height: 32px;
    color: var(--primary);
    transition: transform 0.3s ease;
}

.logo:hover .logo-icon {
    transform: rotate(15deg);
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-btn {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
    padding: var(--space-sm) var(--space-lg);
    border-radius: var(--radius-lg);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.nav-btn:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* ===== メインコンテンツ ===== */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.hero {
    margin-bottom: var(--space-2xl);
    max-width: 600px;
}

.hero-title {
    font-size: clamp(2rem, 8vw, 3.5rem);
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: var(--space-lg);
}

.title-line {
    display: block;
}

.title-line.accent {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative;
}

.title-line.accent::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 4px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    border-radius: 2px;
}

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--gray-600);
    font-weight: 400;
}

/* ===== 短縮フォーム ===== */
.shortener-card {
    width: 100%;
    max-width: 500px;
    background: white;
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--gray-200);
    position: relative;
    overflow: hidden;
}

.shortener-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%);
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.input-wrapper {
    position: relative;
}

.url-input {
    width: 100%;
    padding: var(--space-lg);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-lg);
    font-size: 1rem;
    transition: all 0.3s ease;
    background: var(--gray-50);
    outline: none;
}

.url-input:focus {
    border-color: var(--primary);
    background: white;
    box-shadow: var(--shadow-glow);
    transform: translateY(-1px);
}

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

/* チェーンアニメーション */
.input-chain {
    position: absolute;
    right: var(--space-lg);
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.url-input:focus + .input-chain {
    opacity: 1;
}

.input-chain::before,
.input-chain::after {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    border: 2px solid var(--primary);
    border-radius: 50%;
}

.input-chain::before {
    top: 0;
    left: 0;
    animation: chainLink 2s infinite;
}

.input-chain::after {
    bottom: 0;
    right: 0;
    animation: chainLink 2s infinite 0.5s;
}

@keyframes chainLink {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.7; }
}

/* ボタン */
.shorten-btn {
    width: 100%;
    padding: var(--space-lg);
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    border-radius: var(--radius-lg);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.shorten-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgb(99 102 241 / 0.3);
}

.shorten-btn:active {
    transform: translateY(0);
}

.btn-text {
    transition: opacity 0.3s ease;
}

.btn-loader {
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    opacity: 0;
    animation: spin 1s linear infinite;
}

.shorten-btn.loading .btn-text {
    opacity: 0;
}

.shorten-btn.loading .btn-loader {
    opacity: 1;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== 結果表示 ===== */
.result {
    margin-top: var(--space-xl);
    opacity: 1;
    transform: translateY(0);
    transition: all 0.5s ease;
}

.result.hidden {
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
}

.result-card {
    background: var(--gray-50);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    border: 1px solid var(--gray-200);
}

.result-url {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
}

.short-url-input {
    flex: 1;
    padding: var(--space-md);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    background: white;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.9rem;
    color: var(--primary);
}

.copy-btn {
    padding: var(--space-md);
    background: var(--success);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.copy-btn:hover {
    background: #059669;
    transform: scale(1.05);
}

.copy-btn svg {
    width: 16px;
    height: 16px;
}

.qr-section {
    display: flex;
    justify-content: center;
}

.qr-code {
    background: white;
    padding: var(--space-md);
    border-radius: var(--radius-md);
    border: 1px solid var(--gray-200);
}

/* ===== ユーティリティ ===== */
.hidden {
    display: none !important;
}

/* ===== レスポンシブ ===== */
@media (min-width: 640px) {
    .container {
        padding: var(--space-xl);
    }
    
    .input-group {
        flex-direction: row;
        align-items: flex-end;
    }
    
    .input-wrapper {
        flex: 1;
    }
    
    .shorten-btn {
        width: auto;
        min-width: 120px;
    }
    
    .result-url {
        align-items: center;
    }
}

@media (min-width: 768px) {
    .shortener-card {
        padding: var(--space-2xl);
    }
}

/* ===== アニメーション ===== */
@media (prefers-reduced-motion: no-preference) {
    .shortener-card {
        animation: slideUp 0.6s ease-out;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}