Build Hokm card game: offline vs-AI + online social/gamification (mock backend)
- Pure-TS Hokm engine (deal, hakem, trump, tricks, scoring, Kot) + AI bots - Persian-luxury RTL UI (Next 16 / React 19 / Tailwind v4 / Framer Motion / Zustand) - Online platform behind OnlineService seam (mock now, .NET SignalR later): auth (phone OTP + email/Google), profiles, friends, private rooms with partner pick, ranked matchmaking, leaderboard, shop - Gamification: ranks/leagues, coins, XP/levels, daily rewards, achievements - i18n fa/en, PWA manifest, engine + gamification sims Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+141
-13
@@ -1,26 +1,154 @@
|
||||
@import "tailwindcss";
|
||||
|
||||
/*
|
||||
FlatRender Hokm — "Persian Luxury" theme.
|
||||
Deep navy/teal table, gold filigree accents, geometric motifs.
|
||||
*/
|
||||
|
||||
:root {
|
||||
--background: #ffffff;
|
||||
--foreground: #171717;
|
||||
--navy-950: #060c1f;
|
||||
--navy-900: #0a142e;
|
||||
--navy-800: #0e1c3f;
|
||||
--navy-700: #14274f;
|
||||
--teal-700: #0d6b6b;
|
||||
--teal-500: #14b8a6;
|
||||
--teal-400: #2dd4bf;
|
||||
--gold-600: #b8860b;
|
||||
--gold-500: #d4af37;
|
||||
--gold-400: #e6c659;
|
||||
--gold-300: #f1da8a;
|
||||
--cream: #f5ecd6;
|
||||
|
||||
--background: var(--navy-950);
|
||||
--foreground: #eef2f8;
|
||||
}
|
||||
|
||||
@theme inline {
|
||||
--color-background: var(--background);
|
||||
--color-foreground: var(--foreground);
|
||||
--font-sans: var(--font-geist-sans);
|
||||
--font-mono: var(--font-geist-mono);
|
||||
--color-navy-950: var(--navy-950);
|
||||
--color-navy-900: var(--navy-900);
|
||||
--color-navy-800: var(--navy-800);
|
||||
--color-navy-700: var(--navy-700);
|
||||
--color-teal-700: var(--teal-700);
|
||||
--color-teal-500: var(--teal-500);
|
||||
--color-teal-400: var(--teal-400);
|
||||
--color-gold-600: var(--gold-600);
|
||||
--color-gold-500: var(--gold-500);
|
||||
--color-gold-400: var(--gold-400);
|
||||
--color-gold-300: var(--gold-300);
|
||||
--color-cream: var(--cream);
|
||||
--font-sans: var(--font-vazir), var(--font-jakarta), system-ui, sans-serif;
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
:root {
|
||||
--background: #0a0a0a;
|
||||
--foreground: #ededed;
|
||||
}
|
||||
html,
|
||||
body {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
background: var(--background);
|
||||
background:
|
||||
radial-gradient(1200px 800px at 50% -10%, rgba(20, 184, 166, 0.12), transparent 60%),
|
||||
radial-gradient(900px 700px at 50% 120%, rgba(212, 175, 55, 0.08), transparent 55%),
|
||||
var(--navy-950);
|
||||
color: var(--foreground);
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
font-family: var(--font-sans);
|
||||
-webkit-font-smoothing: antialiased;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* Persian geometric motif — subtle tiled background */
|
||||
.persian-pattern {
|
||||
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 80 80'%3E%3Cg fill='none' stroke='%23d4af37' stroke-opacity='0.06' stroke-width='1'%3E%3Cpath d='M40 0 L80 40 L40 80 L0 40 Z'/%3E%3Cpath d='M40 16 L64 40 L40 64 L16 40 Z'/%3E%3Ccircle cx='40' cy='40' r='6'/%3E%3C/g%3E%3C/svg%3E");
|
||||
background-size: 80px 80px;
|
||||
}
|
||||
|
||||
/* Felt table surface */
|
||||
.felt {
|
||||
background:
|
||||
radial-gradient(ellipse at 50% 45%, rgba(45, 212, 191, 0.18), transparent 62%),
|
||||
radial-gradient(ellipse at 50% 50%, var(--teal-700) 0%, #0a3a3a 45%, #06201f 100%);
|
||||
box-shadow:
|
||||
inset 0 0 120px rgba(0, 0, 0, 0.55),
|
||||
inset 0 0 0 2px rgba(212, 175, 55, 0.25),
|
||||
0 30px 80px rgba(0, 0, 0, 0.6);
|
||||
}
|
||||
|
||||
.gold-text {
|
||||
background: linear-gradient(180deg, var(--gold-300), var(--gold-500) 55%, var(--gold-600));
|
||||
-webkit-background-clip: text;
|
||||
background-clip: text;
|
||||
color: transparent;
|
||||
}
|
||||
|
||||
.gold-border {
|
||||
border: 1px solid rgba(212, 175, 55, 0.45);
|
||||
}
|
||||
|
||||
.glass {
|
||||
background: rgba(10, 20, 46, 0.72);
|
||||
backdrop-filter: blur(14px);
|
||||
border: 1px solid rgba(212, 175, 55, 0.18);
|
||||
}
|
||||
|
||||
.btn-gold {
|
||||
background: linear-gradient(180deg, var(--gold-400), var(--gold-600));
|
||||
color: #2a1f04;
|
||||
font-weight: 700;
|
||||
box-shadow: 0 8px 24px rgba(212, 175, 55, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.4);
|
||||
transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
|
||||
}
|
||||
.btn-gold:hover {
|
||||
transform: translateY(-1px);
|
||||
filter: brightness(1.05);
|
||||
box-shadow: 0 12px 30px rgba(212, 175, 55, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.5);
|
||||
}
|
||||
.btn-gold:active {
|
||||
transform: translateY(0);
|
||||
}
|
||||
|
||||
/* Card face */
|
||||
.card-face {
|
||||
background: linear-gradient(160deg, #fffdf7, #f3ead2);
|
||||
border: 1px solid rgba(0, 0, 0, 0.12);
|
||||
box-shadow: 0 6px 14px rgba(0, 0, 0, 0.35), inset 0 0 0 1px rgba(255, 255, 255, 0.6);
|
||||
}
|
||||
.card-back {
|
||||
background:
|
||||
repeating-linear-gradient(45deg, rgba(212, 175, 55, 0.22) 0 6px, transparent 6px 12px),
|
||||
linear-gradient(160deg, var(--navy-700), var(--navy-900));
|
||||
border: 1px solid rgba(212, 175, 55, 0.45);
|
||||
box-shadow: 0 6px 14px rgba(0, 0, 0, 0.4), inset 0 0 0 2px rgba(212, 175, 55, 0.25);
|
||||
}
|
||||
|
||||
::-webkit-scrollbar {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
}
|
||||
::-webkit-scrollbar-thumb {
|
||||
background: rgba(212, 175, 55, 0.3);
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
[dir="rtl"] {
|
||||
font-family: var(--font-vazir), system-ui, sans-serif;
|
||||
}
|
||||
|
||||
@keyframes float-up {
|
||||
from {
|
||||
transform: translateY(110vh);
|
||||
}
|
||||
to {
|
||||
transform: translateY(-20vh);
|
||||
}
|
||||
}
|
||||
.float-suit {
|
||||
animation-name: float-up;
|
||||
animation-timing-function: linear;
|
||||
animation-iteration-count: infinite;
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.float-suit {
|
||||
animation: none;
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
+29
-15
@@ -1,33 +1,47 @@
|
||||
import type { Metadata } from "next";
|
||||
import { Geist, Geist_Mono } from "next/font/google";
|
||||
import type { Metadata, Viewport } from "next";
|
||||
import { Vazirmatn, Plus_Jakarta_Sans } from "next/font/google";
|
||||
import "./globals.css";
|
||||
import { I18nProvider } from "@/lib/i18n";
|
||||
|
||||
const geistSans = Geist({
|
||||
variable: "--font-geist-sans",
|
||||
subsets: ["latin"],
|
||||
const vazir = Vazirmatn({
|
||||
variable: "--font-vazir",
|
||||
subsets: ["arabic", "latin"],
|
||||
display: "swap",
|
||||
});
|
||||
|
||||
const geistMono = Geist_Mono({
|
||||
variable: "--font-geist-mono",
|
||||
const jakarta = Plus_Jakarta_Sans({
|
||||
variable: "--font-jakarta",
|
||||
subsets: ["latin"],
|
||||
display: "swap",
|
||||
});
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "Create Next App",
|
||||
description: "Generated by create next app",
|
||||
title: "حکم | Hokm — بازی کارت ایرانی",
|
||||
description: "بازی حکم اصیل ایرانی با حریفهای هوشمند — Persian Hokm card game",
|
||||
manifest: "/manifest.webmanifest",
|
||||
appleWebApp: { capable: true, statusBarStyle: "black-translucent", title: "حکم" },
|
||||
};
|
||||
|
||||
export const viewport: Viewport = {
|
||||
themeColor: "#060c1f",
|
||||
width: "device-width",
|
||||
initialScale: 1,
|
||||
maximumScale: 1,
|
||||
userScalable: false,
|
||||
};
|
||||
|
||||
export default function RootLayout({
|
||||
children,
|
||||
}: Readonly<{
|
||||
children: React.ReactNode;
|
||||
}>) {
|
||||
}: Readonly<{ children: React.ReactNode }>) {
|
||||
return (
|
||||
<html
|
||||
lang="en"
|
||||
className={`${geistSans.variable} ${geistMono.variable} h-full antialiased`}
|
||||
lang="fa"
|
||||
dir="rtl"
|
||||
className={`${vazir.variable} ${jakarta.variable} h-full antialiased`}
|
||||
>
|
||||
<body className="min-h-full flex flex-col">{children}</body>
|
||||
<body className="min-h-full">
|
||||
<I18nProvider>{children}</I18nProvider>
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
}
|
||||
|
||||
+55
-61
@@ -1,65 +1,59 @@
|
||||
import Image from "next/image";
|
||||
"use client";
|
||||
|
||||
import { useEffect } from "react";
|
||||
import { HomeScreen } from "@/components/HomeScreen";
|
||||
import { GameScreen } from "@/components/screens/GameScreen";
|
||||
import { ProfileScreen } from "@/components/screens/ProfileScreen";
|
||||
import { FriendsScreen } from "@/components/screens/FriendsScreen";
|
||||
import { OnlineLobbyScreen } from "@/components/screens/OnlineLobbyScreen";
|
||||
import { RoomScreen } from "@/components/screens/RoomScreen";
|
||||
import { MatchmakingScreen } from "@/components/screens/MatchmakingScreen";
|
||||
import { LeaderboardScreen } from "@/components/screens/LeaderboardScreen";
|
||||
import { ShopScreen } from "@/components/screens/ShopScreen";
|
||||
import { AuthScreen } from "@/components/screens/AuthScreen";
|
||||
import { DailyRewardModal } from "@/components/online/DailyRewardModal";
|
||||
import { useSessionStore } from "@/lib/session-store";
|
||||
import { useUIStore } from "@/lib/ui-store";
|
||||
|
||||
export default function Page() {
|
||||
const screen = useUIStore((s) => s.screen);
|
||||
const init = useSessionStore((s) => s.init);
|
||||
const loading = useSessionStore((s) => s.loading);
|
||||
|
||||
useEffect(() => {
|
||||
init();
|
||||
}, [init]);
|
||||
|
||||
export default function Home() {
|
||||
return (
|
||||
<div className="flex flex-col flex-1 items-center justify-center bg-zinc-50 font-sans dark:bg-black">
|
||||
<main className="flex flex-1 w-full max-w-3xl flex-col items-center justify-between py-32 px-16 bg-white dark:bg-black sm:items-start">
|
||||
<Image
|
||||
className="dark:invert"
|
||||
src="/next.svg"
|
||||
alt="Next.js logo"
|
||||
width={100}
|
||||
height={20}
|
||||
priority
|
||||
/>
|
||||
<div className="flex flex-col items-center gap-6 text-center sm:items-start sm:text-left">
|
||||
<h1 className="max-w-xs text-3xl font-semibold leading-10 tracking-tight text-black dark:text-zinc-50">
|
||||
To get started, edit the page.tsx file.
|
||||
</h1>
|
||||
<p className="max-w-md text-lg leading-8 text-zinc-600 dark:text-zinc-400">
|
||||
Looking for a starting point or more instructions? Head over to{" "}
|
||||
<a
|
||||
href="https://vercel.com/templates?framework=next.js&utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
|
||||
className="font-medium text-zinc-950 dark:text-zinc-50"
|
||||
>
|
||||
Templates
|
||||
</a>{" "}
|
||||
or the{" "}
|
||||
<a
|
||||
href="https://nextjs.org/learn?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
|
||||
className="font-medium text-zinc-950 dark:text-zinc-50"
|
||||
>
|
||||
Learning
|
||||
</a>{" "}
|
||||
center.
|
||||
</p>
|
||||
</div>
|
||||
<div className="flex flex-col gap-4 text-base font-medium sm:flex-row">
|
||||
<a
|
||||
className="flex h-12 w-full items-center justify-center gap-2 rounded-full bg-foreground px-5 text-background transition-colors hover:bg-[#383838] dark:hover:bg-[#ccc] md:w-[158px]"
|
||||
href="https://vercel.com/new?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
<Image
|
||||
className="dark:invert"
|
||||
src="/vercel.svg"
|
||||
alt="Vercel logomark"
|
||||
width={16}
|
||||
height={16}
|
||||
/>
|
||||
Deploy Now
|
||||
</a>
|
||||
<a
|
||||
className="flex h-12 w-full items-center justify-center rounded-full border border-solid border-black/[.08] px-5 transition-colors hover:border-transparent hover:bg-black/[.04] dark:border-white/[.145] dark:hover:bg-[#1a1a1a] md:w-[158px]"
|
||||
href="https://nextjs.org/docs?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
Documentation
|
||||
</a>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
<>
|
||||
{renderScreen(screen)}
|
||||
<DailyRewardModal />
|
||||
{loading && null}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function renderScreen(screen: string) {
|
||||
switch (screen) {
|
||||
case "game":
|
||||
return <GameScreen />;
|
||||
case "auth":
|
||||
return <AuthScreen />;
|
||||
case "profile":
|
||||
return <ProfileScreen />;
|
||||
case "friends":
|
||||
return <FriendsScreen />;
|
||||
case "online":
|
||||
return <OnlineLobbyScreen />;
|
||||
case "room":
|
||||
return <RoomScreen />;
|
||||
case "matchmaking":
|
||||
return <MatchmakingScreen />;
|
||||
case "leaderboard":
|
||||
return <LeaderboardScreen />;
|
||||
case "shop":
|
||||
return <ShopScreen />;
|
||||
default:
|
||||
return <HomeScreen />;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user