/* ========================================
   COMMON.CSS - 全ページ共通スタイル
   ======================================== */

/* リセット & ベース設定 */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    width: 100%;
    overflow: hidden;
    touch-action: manipulation; /* ダブルタップズーム抑制 */
}

body {
    background-color: #000;
    color: #fff;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Hiragino Sans', 'Noto Sans JP', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    line-height: 1.6;
}

a {
    color: inherit;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

button {
    touch-action: manipulation;
}

button {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font: inherit;
    -webkit-tap-highlight-color: transparent;
}

input {
    font: inherit;
}

/* ========================================
   レイアウト - SP縦持ち特化
   ======================================== */

.app-container {
    width: min(100vw, calc(100vh * 9 / 16 * 1.2));
    height: 100%;
    max-width: 100vw;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

/* ========================================
   ヘッダー
   ======================================== */

.header {
    flex-shrink: 0;
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    background: rgba(0, 0, 0, 0.8);
}

.header__menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin: -0.5rem;
    margin-right: 0;
    transition: opacity 0.2s;
    flex-shrink: 0;
}

.header__menu-btn:hover {
    opacity: 0.7;
}

.header__menu-btn:active {
    opacity: 0.5;
}

.header__title {
    font-size: 1.125rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    flex-direction: column;
    line-height: 1;
}

.header__title a {
    display: flex;
    flex-direction: column;
}

.logo-remote {
    font-size: 0.5rem;
    font-weight: 400;
    opacity: 0.5;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    margin-bottom: 3px;
}

.logo-tiny {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.header__actions {
    display: flex;
    align-items: center;
    gap: 0;
    flex-shrink: 0;
    margin-right: -0.5rem;
}

.header__action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    transition: opacity 0.2s;
}

.header__action-btn:hover {
    opacity: 0.7;
}

.header__action-btn:active {
    opacity: 0.5;
}

/* ========================================
   メインコンテンツ
   ======================================== */

.main-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* スクロールバー */
.main-content::-webkit-scrollbar {
    width: 4px;
}

.main-content::-webkit-scrollbar-track {
    background: transparent;
}

.main-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
}

.main-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* ========================================
   フッター
   ======================================== */

.footer {
    flex-shrink: 0;
    padding: 1rem;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer p {
    font-size: 0.75rem;
    opacity: 0.5;
}

/* ========================================
   オーバーレイ（共通）
   ======================================== */

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 20px;
    visibility: hidden;
    pointer-events: none;
}

.overlay::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.overlay.is-open {
    visibility: visible;
    pointer-events: auto;
}

.overlay.is-open::before {
    opacity: 1;
}

/* オーバーレイパネル */
.overlay__panel {
    position: relative;
    width: min(90vw, calc(100vh * 9 / 16 * 1.1));
    max-height: 85vh;
    background: #111;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 1.5rem;
    z-index: 1;
    transform: scale(0.9);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    overflow-y: auto;
}

.overlay.is-open .overlay__panel {
    transform: scale(1);
    opacity: 1;
}

/* オーバーレイ閉じるボタン */
.overlay__close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}

.overlay__close:hover {
    opacity: 0.7;
}

.overlay__close:active {
    opacity: 0.5;
}

/* オーバーレイタイトル */
.overlay__title {
    font-size: 1.125rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-right: 2.5rem;
}

/* オーバーレイコンテンツ */
.overlay__content {
    margin-top: 1.5rem;
}

/* ========================================
   メニューナビゲーション
   ======================================== */

.menu-nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-top: 1.5rem;
}

.menu-nav__item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-radius: 8px;
    transition: background-color 0.2s;
}

.menu-nav__item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.menu-nav__item:active {
    background: rgba(255, 255, 255, 0.15);
}

.menu-nav__item span {
    font-size: 1rem;
    font-weight: 500;
}

/* ========================================
   検索ボックス
   ======================================== */

.search-box {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 0.25rem 0.5rem 0.25rem 1rem;
}

.search-box__input {
    flex: 1;
    background: none;
    border: none;
    color: #fff;
    padding: 0.75rem 0;
    outline: none;
}

.search-box__input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.search-box__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    transition: opacity 0.2s;
}

.search-box__btn:hover {
    opacity: 0.7;
}

/* ========================================
   マイページメニュー
   ======================================== */

.mypage-menu {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.mypage-menu__item {
    display: block;
    padding: 1rem;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    font-weight: 500;
    transition: background-color 0.2s, border-color 0.2s;
}

.mypage-menu__item:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
}

.mypage-menu__item:active {
    background: rgba(255, 255, 255, 0.15);
}

/* ========================================
   コンテンツセクション
   ======================================== */

.content-section {
    padding: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    background-color: rgba(255, 255, 255, 0.05);
}

.content-section h2 {
    font-size: 1.125rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.content-section p {
    font-size: 0.875rem;
    line-height: 1.6;
    opacity: 0.8;
}

/* ========================================
   ユーティリティ
   ======================================== */

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }

/* ========================================
   リンクボタン共通アニメーション
   ======================================== */

a[data-press] {
    transition: transform 0.15s ease, background-color 0.2s, border-color 0.2s, opacity 0.2s;
}

a[data-press]:active {
    transform: scale(0.95);
}

/* ========================================
   ヘッダーバッジ
   ======================================== */

.header__action-btn {
    position: relative;
}

.header__badge {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: #e53935;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    border-radius: 9px;
    display: none;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* ========================================
   マイページ - ゲスト
   ======================================== */

.mypage-guest {
    text-align: center;
}

.mypage-guest__status {
    font-size: 0.875rem;
    opacity: 0.6;
    margin-bottom: 1.5rem;
}

.mypage-guest__info {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    text-align: left;
}

.mypage-guest__info p {
    font-size: 0.875rem;
    opacity: 0.8;
    margin-bottom: 0.5rem;
}

.mypage-guest__info ul {
    list-style: none;
    margin: 0.75rem 0;
    padding-left: 0.5rem;
}

.mypage-guest__info li {
    font-size: 0.875rem;
    padding: 0.25rem 0;
    padding-left: 1.5rem;
    position: relative;
}

.mypage-guest__info li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: #4caf50;
}

.mypage-guest__btn {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    transition: opacity 0.2s, transform 0.15s;
}

.mypage-guest__btn:hover {
    opacity: 0.9;
}

.mypage-guest__btn:active {
    transform: scale(0.98);
}

.mypage-guest__btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.mypage-guest__link {
    margin-top: 1rem;
}

.mypage-link-btn {
    font-size: 0.875rem;
    opacity: 0.6;
    text-decoration: underline;
    transition: opacity 0.2s;
}

.mypage-link-btn:hover {
    opacity: 1;
}

/* ========================================
   マイページ - メンバー
   ======================================== */

.mypage-member__profile {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.mypage-member__avatar {
    opacity: 0.6;
}

.mypage-member__name {
    font-size: 1.125rem;
    font-weight: 600;
}

.mypage-member__stats {
    display: flex;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.mypage-stat {
    flex: 1;
    text-align: center;
}

.mypage-stat__label {
    font-size: 0.75rem;
    opacity: 0.6;
    display: block;
    margin-bottom: 0.25rem;
}

.mypage-stat__value {
    font-size: 1.25rem;
    font-weight: 600;
}

.mypage-member__actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
}

.mypage-action-btn {
    display: block;
    width: 100%;
    padding: 0.875rem 1rem;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background-color 0.2s, border-color 0.2s;
}

.mypage-action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
}

.mypage-pending {
    display: none; /* 承認待ちがある場合のみJSで表示 */
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.mypage-pending__title {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

/* ========================================
   通知リスト
   ======================================== */

.notification-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.notification-empty {
    text-align: center;
    opacity: 0.5;
    padding: 2rem 0;
    font-size: 0.875rem;
}

.notification-item {
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.notification-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.notification-item.is-unread {
    border-left: 3px solid #e53935;
}

.notification-item__title {
    font-size: 0.9375rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.notification-item__date {
    font-size: 0.75rem;
    opacity: 0.5;
}

/* ========================================
   引き継ぎコード
   ======================================== */

.overlay__panel--wide {
    width: min(95vw, 400px);
}

.link-section {
    padding: 1rem 0;
}

.link-section__title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.link-section__desc {
    font-size: 0.8125rem;
    opacity: 0.6;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.link-code-box {
    text-align: center;
    margin-bottom: 1rem;
}

.link-code-display {
    font-size: 2rem;
    font-weight: 700;
    font-family: 'SF Mono', 'Roboto Mono', monospace;
    letter-spacing: 0.1em;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    opacity: 0.3;
    transition: opacity 0.3s;
}

.link-code-display.is-active {
    opacity: 1;
    color: #4caf50;
}

.link-code-timer {
    font-size: 0.75rem;
    opacity: 0.6;
    margin-top: 0.5rem;
}

.link-code-btn {
    width: 100%;
    padding: 0.875rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background-color 0.2s, border-color 0.2s;
}

.link-code-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.5);
}

.link-code-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.link-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 0;
    opacity: 0.4;
    font-size: 0.75rem;
}

.link-divider::before,
.link-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: currentColor;
}

.link-input-box {
    display: flex;
    gap: 0.5rem;
}

.link-input {
    flex: 1;
    padding: 0.875rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: #fff;
    font-size: 1rem;
    font-family: 'SF Mono', 'Roboto Mono', monospace;
    letter-spacing: 0.05em;
    text-align: center;
}

.link-input:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.5);
}

.link-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
    font-family: inherit;
    letter-spacing: normal;
}

.link-input-btn {
    padding: 0.875rem 1.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 8px;
    transition: opacity 0.2s;
}

.link-input-btn:hover {
    opacity: 0.9;
}

.link-result {
    margin-top: 0.75rem;
    font-size: 0.8125rem;
    text-align: center;
}

.link-result.is-success {
    color: #4caf50;
}

.link-result.is-error {
    color: #e53935;
}

.link-pending-empty {
    font-size: 0.8125rem;
    opacity: 0.5;
    text-align: center;
    padding: 1rem 0;
}

.link-pending-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

.link-pending-item__code {
    font-family: 'SF Mono', 'Roboto Mono', monospace;
    font-size: 0.875rem;
}

.link-pending-item__date {
    font-size: 0.75rem;
    opacity: 0.5;
    margin-left: 0.5rem;
}

.link-pending-item__actions {
    display: flex;
    gap: 0.5rem;
}

.link-pending-item__btn {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 4px;
    transition: opacity 0.2s;
}

.link-pending-item__btn.is-approve {
    background: #4caf50;
    color: #fff;
}

.link-pending-item__btn.is-reject {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.link-pending-item__btn:hover {
    opacity: 0.8;
}

/* ========================================
   スコアセクション（ホーム）
   ======================================== */

.home-score {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    padding: 1.5rem;
}

.score-guest {
    text-align: center;
    max-width: 280px;
}

.score-guest__icon {
    opacity: 0.3;
    margin-bottom: 1rem;
}

.score-guest__text {
    font-size: 0.9375rem;
    opacity: 0.7;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.score-guest__btn {
    padding: 0.875rem 2rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    font-size: 0.9375rem;
    font-weight: 600;
    border-radius: 8px;
    transition: opacity 0.2s, transform 0.15s;
}

.score-guest__btn:hover {
    opacity: 0.9;
}

.score-guest__btn:active {
    transform: scale(0.98);
}

.score-member {
    width: 100%;
    max-width: 320px;
}

.score-total {
    text-align: center;
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.2) 0%, rgba(118, 75, 162, 0.2) 100%);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    margin-bottom: 1.5rem;
}

.score-total__label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    opacity: 0.7;
    margin-bottom: 0.5rem;
}

.score-total__value {
    font-size: 2.5rem;
    font-weight: 700;
}

.score-total__value small {
    font-size: 1rem;
    opacity: 0.6;
}

.score-games__title {
    font-size: 0.875rem;
    font-weight: 600;
    opacity: 0.7;
    margin-bottom: 0.75rem;
}

.score-game-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 280px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

/* カスタムスクロールバー */
.score-game-list::-webkit-scrollbar {
    width: 4px;
}

.score-game-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.score-game-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
}

.score-game-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

.score-game-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

.score-game-item__logo-wrap {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: 
        repeating-linear-gradient(
            45deg,
            rgba(255, 255, 255, 0.12) 0px,
            rgba(255, 255, 255, 0.12) 1px,
            transparent 1px,
            transparent 4px
        ),
        repeating-linear-gradient(
            -45deg,
            rgba(255, 255, 255, 0.12) 0px,
            rgba(255, 255, 255, 0.12) 1px,
            transparent 1px,
            transparent 4px
        ),
        linear-gradient(135deg, rgba(80, 60, 100, 0.9), rgba(40, 30, 60, 0.9));
    display: flex;
    align-items: center;
    justify-content: center;
}

.score-game-item__logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 3px;
}

.score-game-item__logo-placeholder {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.score-game-item__name {
    flex: 1;
    font-size: 0.875rem;
    opacity: 0.9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.score-game-item__score {
    font-size: 1rem;
    font-weight: 600;
    flex-shrink: 0;
    min-width: 60px;
    text-align: right;
}

.score-empty {
    text-align: center;
    font-size: 0.875rem;
    opacity: 0.5;
    padding: 1rem 0;
}

/* スコア注釈 */
.score-note {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
    text-align: center;
}
