/* Masi Masa — Karambol Position Studio styles
 * Isolated namespace (.masa-*) — does NOT affect rest of site.
 */
.masa-wrap {
    min-height: calc(100vh - 80px);
    background: linear-gradient(180deg, #0a0f1c 0%, #0f172a 100%);
    color: #f1f5f9;
    padding: 32px 16px 64px;
}
.masa-container {
    max-width: 1100px;
    margin: 0 auto;
}
.masa-header {
    text-align: center;
    margin-bottom: 24px;
    padding-top: 16px;
}
.masa-title {
    font-size: clamp(28px, 5vw, 44px);
    font-weight: 800;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0 0 8px;
}
.masa-subtitle {
    font-size: clamp(14px, 2vw, 17px);
    color: #cbd5e1;
    margin: 0 0 12px;
    text-transform: uppercase;
    letter-spacing: 2px;
}
.masa-intro {
    font-size: 14px;
    color: #94a3b8;
    max-width: 640px;
    margin: 0 auto;
    line-height: 1.6;
}

/* Canvas stage */
.masa-stage {
    position: relative;
    background: #0f172a;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    margin-bottom: 20px;
    user-select: none;
    -webkit-user-select: none;
}
.masa-stage {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}
.masa-stage canvas {
    display: block;
    max-width: 100%;
    height: auto;
    /* 2-parmak pinch tarayıcıya, tek parmak hareket JS'e (mobile zoom destekli) */
    touch-action: pinch-zoom;
    margin: 0 auto;
}
.masa-water-text {
    display: none; /* Watermark drawn directly on canvas */
}

/* Toolbar */
/* Sade mini header — başlık ortada, ikonlar sağda */
.masa-header-mini {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 4px 14px;
    margin-bottom: 8px;
    position: relative;
}
.masa-title-mini {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 0.12em;
    color: #22d3ee !important;
    text-transform: uppercase;
    text-shadow: 0 0 18px rgba(34,211,238,0.45), 0 2px 4px rgba(0,0,0,0.4);
    display: inline-block;
    visibility: visible;
    opacity: 1;
    white-space: nowrap;
    line-height: 1.2;
    z-index: 2;
    position: relative;
}
/* Light tema için kontrast */
:root[data-theme="light"] .masa-title-mini {
    color: #0e7490 !important;
    text-shadow: 0 0 10px rgba(14,116,144,0.25);
}
.masa-header-actions {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    gap: 6px;
}
.masa-icon-btn {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.04);
    color: rgba(255,255,255,0.7);
    font-size: 15px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    font-family: inherit;
}
.masa-icon-btn:hover {
    background: rgba(6,182,212,0.18);
    color: #67e8f9;
    border-color: rgba(103,232,249,0.35);
}
.masa-icon-btn.is-active {
    background: rgba(6,182,212,0.22);
    color: #67e8f9;
    border-color: rgba(103,232,249,0.5);
}

/* Help panel — açılır kapanır */
.masa-help-panel {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 10px;
    padding: 14px 18px;
    margin: 0 4px 16px;
    color: rgba(255,255,255,0.85);
    font-size: 14px;
    line-height: 1.55;
    animation: masaFadeIn 0.25s ease;
}
.masa-help-panel[hidden] { display: none !important; }
.masa-help-intro {
    margin: 0 0 10px;
    color: #f1f5f9;
}
.masa-help-list {
    margin: 0;
    padding-left: 20px;
}
.masa-help-list li {
    margin: 4px 0;
    color: rgba(255,255,255,0.75);
}
@keyframes masaFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Note row — açılır kapanır */
.masa-note-row[hidden] { display: none !important; }

.masa-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-bottom: 16px;
    align-items: center;
    position: relative;  /* share menu absolute için */
}

/* Sade ikon buton (newline, sil, sıfırla) */
.masa-btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    justify-content: center;
}
.masa-btn-icon-glyph {
    font-size: 18px;
    line-height: 1;
}

/* Paylaş dropdown */
.masa-share-wrap {
    position: relative;
}
.masa-share-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 220px;
    background: #0f172a;
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 10px;
    padding: 6px;
    box-shadow: 0 10px 32px rgba(0,0,0,0.55);
    z-index: 50;
    display: flex;
    flex-direction: column;
    gap: 2px;
    animation: masaFadeIn 0.15s ease;
}
.masa-share-menu[hidden] { display: none !important; }
.masa-share-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 7px;
    font-size: 14px;
    font-weight: 500;
    background: transparent;
    color: #e2e8f0;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    text-align: left;
    font-family: inherit;
    transition: all 0.12s;
}
.masa-share-item:hover {
    background: rgba(103,232,249,0.10);
    color: #67e8f9;
}
.masa-share-wa svg { color: #25d366; }
.masa-divider {
    width: 1px;
    height: 24px;
    background: rgba(255,255,255,0.15);
    margin: 0 4px;
}
.masa-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    white-space: nowrap;
    background: transparent;
    color: inherit;
    font-family: inherit;
}
.masa-btn-primary {
    background: #06b6d4;
    color: #ffffff;
}
.masa-btn-primary:hover {
    background: #0891b2;
    transform: translateY(-1px);
}
.masa-btn-secondary {
    background: rgba(255,255,255,0.08);
    color: #f1f5f9;
    border-color: rgba(255,255,255,0.15);
}
.masa-btn-secondary:hover {
    background: rgba(255,255,255,0.14);
}
.masa-btn-secondary.is-active {
    background: rgba(6,182,212,0.25);
    border-color: rgba(6,182,212,0.6);
    color: #67e8f9;
}
.masa-btn-ghost {
    background: transparent;
    color: #cbd5e1;
    border-color: rgba(255,255,255,0.12);
}
.masa-btn-ghost:hover {
    background: rgba(255,255,255,0.05);
    color: #f1f5f9;
}
.masa-btn-wa {
    background: #25d366;
    color: #ffffff;
}
.masa-btn-wa:hover {
    background: #1eb854;
    transform: translateY(-1px);
}

/* Note input */
.masa-note-row {
    margin-bottom: 12px;
}
.masa-input {
    width: 100%;
    padding: 11px 14px;
    border-radius: 10px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    color: #f1f5f9;
    font-size: 14px;
    font-family: inherit;
}
.masa-input:focus {
    outline: none;
    border-color: #06b6d4;
    background: rgba(255,255,255,0.1);
}
.masa-input::placeholder {
    color: #64748b;
}

/* Hints */
.masa-hints {
    margin-top: 24px;
    padding: 16px 20px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    font-size: 14px;
}
.masa-hints summary {
    cursor: pointer;
    color: #cbd5e1;
    font-weight: 600;
    list-style: none;
}
.masa-hints summary::-webkit-details-marker { display: none; }
.masa-hints[open] summary {
    margin-bottom: 8px;
}
.masa-hints ul {
    margin: 0;
    padding-left: 20px;
    color: #94a3b8;
    line-height: 1.7;
}

/* Toast */
.masa-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(40px);
    background: #0f172a;
    color: #f1f5f9;
    padding: 12px 24px;
    border-radius: 10px;
    border: 1px solid rgba(6,182,212,0.4);
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    opacity: 0;
    transition: all 0.25s;
    pointer-events: none;
    z-index: 9999;
    font-weight: 600;
    font-size: 14px;
}
.masa-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Prevent print + ctrl-a select */
.masa-wrap, .masa-wrap * {
    -webkit-user-drag: none;
}
@media print {
    .masa-wrap { display: none; }
    body::after { content: "Masi Masa pozisyon stüdyosu yazdırılamaz. Lütfen 'Görüntü İndir' kullanın."; }
}

/* Mobile */
@media (max-width: 640px) {
    .masa-toolbar {
        gap: 6px;
    }
    .masa-btn {
        padding: 8px 12px;
        font-size: 13px;
    }
    .masa-btn-icon {
        width: 38px;
        height: 38px;
    }
    .masa-btn-icon-glyph {
        font-size: 17px;
    }
    .masa-divider {
        display: none;
    }
    .masa-header-mini {
        padding: 8px 76px 12px 8px; /* sağda ikonlar için yer */
        margin-bottom: 4px;
    }
    .masa-title-mini {
        font-size: 18px !important;
        letter-spacing: 0.08em !important;
    }
    .masa-icon-btn {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    .masa-help-panel {
        font-size: 13px;
        padding: 12px 14px;
    }
    .masa-share-menu {
        right: auto;
        left: 50%;
        transform: translateX(-50%);
        min-width: 240px;
    }
}

/* Landscape (yatay) mobil — kompakt mod, masa ekrana sığsın */
@media (orientation: landscape) and (max-height: 540px) {
    .masa-wrap { padding-top: 4px; padding-bottom: 4px; }
    .masa-container { padding-left: 8px; padding-right: 8px; }
    .masa-header-mini {
        padding: 4px 4px;
        margin-bottom: 4px;
    }
    .masa-title-mini { font-size: 15px; letter-spacing: 0.03em; }
    .masa-icon-btn {
        width: 26px;
        height: 26px;
        font-size: 12px;
    }
    .masa-help-panel {
        padding: 8px 12px;
        font-size: 12px;
        margin-bottom: 6px;
    }
    .masa-help-list { padding-left: 16px; }
    .masa-toolbar {
        margin-bottom: 6px;
        gap: 4px;
    }
    .masa-btn {
        padding: 5px 10px;
        font-size: 12px;
    }
    .masa-btn-icon {
        width: 32px;
        height: 32px;
    }
    .masa-btn-icon-glyph { font-size: 15px; }
    .masa-note-row { margin-bottom: 4px; }
    .masa-input { padding: 6px 10px; font-size: 12px; }
}

/* Header masa link highlight */
.nav-masa-link {
    color: #06b6d4 !important;
    position: relative;
}
.nav-masa-link::after {
    content: '🆕';
    font-size: 10px;
    margin-left: 4px;
}

/* Anasayfa banner */
.masa-banner {
    background: linear-gradient(135deg, #1e3a8a 0%, #0e7490 60%, #06b6d4 100%);
    padding: 28px 24px;
    border-radius: 16px;
    margin: 24px 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    box-shadow: 0 8px 32px rgba(6,182,212,0.2);
}
.masa-banner-text {
    flex: 1;
    min-width: 260px;
}
.masa-banner h2 {
    color: #fff;
    font-size: clamp(18px, 3vw, 26px);
    font-weight: 800;
    margin: 0 0 6px;
    letter-spacing: -0.01em;
}
.masa-banner p {
    color: rgba(255,255,255,0.85);
    font-size: 14px;
    margin: 0;
    line-height: 1.5;
}
.masa-banner-cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    color: #0e7490;
    padding: 12px 22px;
    border-radius: 10px;
    font-weight: 800;
    font-size: 15px;
    text-decoration: none;
    transition: all 0.15s;
    white-space: nowrap;
}
.masa-banner-cta:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 6px 16px rgba(0,0,0,0.2);
}

/* ──────────────────────────────────────────────────────────
 * Diamond System — Korner-5 paneli
 * ────────────────────────────────────────────────────────── */
.masa-korner-panel {
    margin: 12px 0 0;
    padding: 12px 14px;
    background: linear-gradient(135deg, rgba(14,116,144,0.18) 0%, rgba(34,211,238,0.10) 100%);
    border: 1px solid rgba(34,211,238,0.35);
    border-radius: 10px;
    color: #e2f5fb;
    font-size: 13px;
    line-height: 1.4;
}
.masa-korner-title {
    font-weight: 800;
    font-size: 13px;
    letter-spacing: 0.02em;
    color: #67e8f9;
    margin-bottom: 8px;
}
.masa-korner-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}
.masa-korner-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 6px 12px;
    background: rgba(0,0,0,0.25);
    border-radius: 8px;
    min-width: 64px;
}
.masa-korner-cue-cell { border-left: 3px solid #2563eb; }   /* ÇIKIŞ mavi */
.masa-korner-tgt-cell { border-left: 3px solid #dc2626; }   /* ATIŞ kırmızı */
.masa-korner-res-cell { border-left: 3px solid #16a34a; }   /* VARIŞ yeşil */
.masa-korner-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(255,255,255,0.65);
    font-weight: 600;
}
.masa-korner-value {
    font-size: 22px;
    font-weight: 800;
    color: #fff;
    line-height: 1;
    margin-top: 2px;
    font-variant-numeric: tabular-nums;
}
.masa-korner-op {
    font-size: 18px;
    font-weight: 800;
    color: rgba(255,255,255,0.55);
}
.masa-korner-clear {
    margin-left: auto;
    background: rgba(239,68,68,0.18);
    color: #fca5a5;
    border: 1px solid rgba(239,68,68,0.35);
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
}
.masa-korner-clear:hover {
    background: rgba(239,68,68,0.35);
    color: #fff;
}
.masa-korner-hint {
    margin-top: 8px;
    font-size: 11px;
    color: rgba(255,255,255,0.65);
    line-height: 1.45;
}

/* Diamond toggle button aktif durum */
#btnDiamond.is-active {
    background: linear-gradient(135deg, #0e7490 0%, #22d3ee 100%);
    color: #fff;
    border-color: #22d3ee;
    box-shadow: 0 0 0 2px rgba(34,211,238,0.25);
}

@media (max-width: 540px) {
    .masa-korner-row { gap: 4px; }
    .masa-korner-cell { padding: 4px 8px; min-width: 52px; }
    .masa-korner-value { font-size: 18px; }
    .masa-korner-label { font-size: 9px; }
    .masa-korner-op { font-size: 14px; }
}
